from .module_info import ModuleInfo
-__version__ = '0.1.1'
+__version__ = '0.1.2'
LOG = logging.getLogger(__name__)
if not isinstance(module_info, ModuleInfo):
raise TypeError(self.msg_invalid_modinfo_type.format(module_info.__class__.__name__))
- self._set_item(module_info.name, module_info)
+ self._set_item(module_info.full_name, module_info)
# -------------------------------------------------------------------------
def as_dict(self, short=True):
from .module_info import ModuleInfo
+from .module_list import ModuleInfoDict
+
LOG = logging.getLogger(__name__)
DEFAULT_PARENT_DIR = '/etc/puppetlabs/code/fileserver'
def output_modules_json(self, module_infos):
output_list = []
- for module_info in module_infos:
+ for full_name in module_infos.keys():
+ module_info = module_infos[full_name]
output_data = self.get_output_data(module_info)
output_list.append(output_data)
# -------------------------------------------------------------------------
def output_modules_html(self, module_infos):
- if not module_infos:
+ if not len(module_infos):
self.print_out()
self.print_out('<h2>Keine passenden Module gefunden.</h2>')
self.print_out()
line_class = 'even'
- for module_info in module_infos:
+ for full_name in module_infos.keys():
+ module_info = module_infos[full_name]
nr_modules += 1
if nr_modules % 2:
line_class = 'odd'
nr_modules = 0
- for module_info in module_infos:
+ for full_name in module_infos.keys():
+ module_info = module_infos[full_name]
nr_modules += 1
output_data = self.get_output_data(module_info)
for key in label.keys():
self.print_out(header)
self.print_out('=' * len(header))
- for module_info in module_infos:
+ for full_name in module_infos.keys():
+ module_info = module_infos[full_name]
nr_modules += 1
output_data = self.get_output_data(module_info)
if not output_data['forge_version']:
raise ShowModulesUncriticalError(
"Cache file {!r} not readable.".format(self.cache_file))
- data = []
+ modules = ModuleInfoDict(
+ appname=self.appname, verbose=self.verbose, base_dir=self.base_dir)
+
LOG.debug("Reading {!r} ...".format(self.cache_file))
try:
with open(self.cache_file, 'r', **self.open_args) as fh:
if not in_main_branches:
continue
if self.should_display(module_info):
- data.append(module_info)
+ modules.append(module_info)
except yaml.YAMLError as e:
raise ShowModulesUncriticalError(
"Could not evaluate content of {f!r}: {e}".format(f=self.cache_file, e=e))
if self.verbose > 3:
- LOG.debug("Content of {f!r}:\n{c}".format(f=self.cache_file, c=pp(data)))
- if not data:
+ LOG.debug("Content of {f!r}:\n{c}".format(f=self.cache_file, c=pp(modules.as_list())))
+ if not len(modules):
LOG.debug("Did not found any matching modules.")
- return data
+ return modules
# -------------------------------------------------------------------------
def should_display(self, module_info):