예제 #1
0
    def run(self, args):
        """Run 'dists' subcommand."""
        lines = []
        dists = avail_dists()
        for dist in dists:
            modules = None
            try:
                cfg_fp = open(resolve_dist_path(dist))
                modules = load_service_config(cfg_fp).get('Config', 'modules').split(',')
                cfg_fp.close()
            except IOError as err:
                _log.error("Failed to get list of modules for dist '%s': %s", dist, err)
                continue

            lines.extend([
                "* %s" % dist,
                "    modules: %s" % ', '.join(modules),
                '',
            ])

        print '\n'.join(lines)
        return 0
예제 #2
0
    def run(self, args):
        """Run 'dists' subcommand."""
        lines = []
        dists = avail_dists()
        for dist in dists:
            modules = None
            try:
                cfg_fp = open(resolve_dist_path(dist))
                modules = load_service_config(cfg_fp).get('Config', 'modules').split(',')
                cfg_fp.close()
            except IOError as err:
                self.log.error("Failed to get list of modules for dist '%s': %s", dist, err)
                continue

            lines.extend([
                "* %s" % dist,
                "    modules: %s" % ', '.join(modules),
                '',
            ])

        print '\n'.join(lines)
        return 0
예제 #3
0
 def test_resolve_dist_path(self):
     with patch('hod.config.config.resource_filename', side_effect=lambda pks, *args: os.path.join('/path/to/python/pkgs/', *args)):
         self.assertEqual(hcc.resolve_dist_path('Program-1.2.3'), '/path/to/python/pkgs/etc/hod/Program-1.2.3/hod.conf')