Exemplo n.º 1
0
    def test_generate_puppet_data(self):
        expected_unit_key = {'author': 'jdob', 'name': 'valid', 'version': '1.0.0'}
        unit_key, unit_metadata = generate_puppet_data(self.filename)

        self.assertEqual(unit_key, expected_unit_key)
        self.assertEqual(unit_metadata['description'], 'Valid Module Description')
        self.assertEqual(unit_metadata['license'], 'Apache License, Version 2.0')
        self.assertEqual(unit_metadata['project_page'], 'http://example.org/jdob-valid')
Exemplo n.º 2
0
    def get_content_data(cls, content_type, filepath):
        unit_key = metadata = None
        if content_type == "yum":
            try:
                unit_key, metadata = generate_rpm_data(filepath)
            except InvalidRPMError:
                print _("Invalid rpm '%s'. Please check the file and try again.") % filepath
        elif content_type == "puppet":
            try:
                unit_key, metadata = generate_puppet_data(filepath)
            except ExtractionException:
                print _("Invalid puppet module '%s'. Please check the file and try again.") % filepath
        else:
            print _("Content type '%s' not valid. Must be puppet or yum.") % content_type

        return unit_key, metadata
Exemplo n.º 3
0
    def get_content_data(cls, content_type, filepath):
        unit_key = metadata = None
        if content_type == "yum":
            try:
                unit_key, metadata = generate_rpm_data(filepath)
            except InvalidRPMError:
                print _("Invalid rpm '%s'. Please check the file and try again.") % filepath
        elif content_type == "puppet":
            try:
                unit_key, metadata = generate_puppet_data(filepath)
            except ExtractionException:
                print _(
                    "Invalid puppet module '%s'. Please make sure the file is valid and is named "
                    + "author-name-version.tar.gz (eg: puppetlabs-ntp-2.0.1.tar.gz)."
                ) % filepath

        return unit_key, metadata