~plumgrid-team/charms/trusty/nova-cloud-controller/trunk

« back to all changes in this revision

Viewing changes to tests/charmhelpers/contrib/amulet/utils.py

  • Committer: Liam Young
  • Date: 2015-04-23 14:51:08 UTC
  • Revision ID: liam.young@canonical.com-20150423145108-f72ihu03ajimclx7
Tags: 15.04
[gnuoy,trivial] Pre-release charmhelper sync

Show diffs side-by-side

added added

removed removed

Lines of Context:
79
79
        for k, v in six.iteritems(commands):
80
80
            for cmd in v:
81
81
                output, code = k.run(cmd)
 
82
                self.log.debug('{} `{}` returned '
 
83
                               '{}'.format(k.info['unit_name'],
 
84
                                           cmd, code))
82
85
                if code != 0:
83
86
                    return "command `{}` returned {}".format(cmd, str(code))
84
87
        return None
86
89
    def _get_config(self, unit, filename):
87
90
        """Get a ConfigParser object for parsing a unit's config file."""
88
91
        file_contents = unit.file_contents(filename)
89
 
        config = ConfigParser.ConfigParser()
 
92
 
 
93
        # NOTE(beisner):  by default, ConfigParser does not handle options
 
94
        # with no value, such as the flags used in the mysql my.cnf file.
 
95
        # https://bugs.python.org/issue7005
 
96
        config = ConfigParser.ConfigParser(allow_no_value=True)
90
97
        config.readfp(io.StringIO(file_contents))
91
98
        return config
92
99