~chris.macnaughton/mojo/string-logs

« back to all changes in this revision

Viewing changes to mojo/phase.py

  • Committer: Ryan Beisner
  • Date: 2018-01-26 23:13:11 UTC
  • mfrom: (462.1.12 mojo3)
  • Revision ID: ryan.beisner@canonical.com-20180126231311-4bsirj5x6ajvhbv8
[chris.macnaughton, r=1chb1n] Additional py3 run time fixes for mojo

Show diffs side-by-side

added added

removed removed

Lines of Context:
25
25
import mojo.juju
26
26
import mojo.juju.utils
27
27
import codetree
 
28
import six
28
29
from deployer.config import ConfigStack
29
30
 
30
31
 
215
216
        with chdir(workspace.build_dir):
216
217
            try:
217
218
                tmpl_vars = {'series': project.series}
218
 
                with tempfile.NamedTemporaryFile() as rendered_collect:
 
219
                with tempfile.NamedTemporaryFile(mode='wt') as rendered_collect:
219
220
                    with open(config) as inp:
220
221
                        try:
221
222
                            rendered_collect.write(Template(inp.read()).render(**tmpl_vars))
363
364
            command = env_vars + [script]
364
365
            try:
365
366
                output = subprocess.check_output(command, stderr=subprocess.STDOUT)
 
367
                if six.PY3:
 
368
                    output = output.decode('utf-8')
366
369
            except subprocess.CalledProcessError as e:
367
370
                if gather_debug_logs:
368
371
                    exception_output = self._gather_debug_logs(e, workspace, stage)