Exemple #1
0
    def puppet_module_info(cls, options):
        """Provides puppet-module info related to content-view's version."""
        cls.command_sub = 'puppet-module info'

        if options is None:
            options = {}

        result = cls.execute(cls._construct_command(options))

        # info_dictionary required to convert result.stdout
        # to dictionary format
        return info_dictionary(result)
    def version_info(cls, options):
        """Provides version info related to content-view's version."""
        cls.command_sub = 'version info'

        if options is None:
            options = {}

        result = cls.execute(cls._construct_command(options), expect_csv=False)

        # info_dictionary required to convert result.stdout
        # to dictionary format
        return info_dictionary(result)
Exemple #3
0
    def filter_info(cls, options):
        """
        Provides filter info related to content-view's version.
        """

        cls.command_sub = "filter info"

        if options is None:
            options = {}

        result = cls.execute(cls._construct_command(options), expect_csv=False)

        # info_dictionary required to convert result.stdout
        # to dictionary format
        updated_result = info_dictionary(result)

        return updated_result
Exemple #4
0
    def version_info(cls, options):
        """
        Provides version info related to content-view's version.
        """

        cls.command_sub = "version info"

        if options is None:
            options = {}

        result = cls.execute(cls._construct_command(options), expect_csv=False)

        # info_dictionary required to convert result.stdout
        # to dictionary format
        updated_result = info_dictionary(result)

        return updated_result
Exemple #5
0
    def test_parse_list_attributes(self):
        """Can parse list attributes"""
        output = FakeSSHResult(stdout=[
            'Partition tables:',
            ' ptable1',
            ' ptable2',
            ' ptable3',
            ' ptable4',
        ])

        result = info_dictionary(output)
        self.assertDictEqual(result.stdout, {
            'partition-tables': [
                'ptable1',
                'ptable2',
                'ptable3',
                'ptable4',
            ],
        })
Exemple #6
0
    def test_parse_list_attributes(self):
        """Can parse list attributes"""
        output = FakeSSHResult(stdout=[
            'Partition tables:',
            ' ptable1',
            ' ptable2',
            ' ptable3',
            ' ptable4',
        ])

        result = info_dictionary(output)
        self.assertDictEqual(result.stdout, {
            'partition-tables': [
                'ptable1',
                'ptable2',
                'ptable3',
                'ptable4',
            ],
        })
Exemple #7
0
    def test_parse_dict_attributes(self):
        """Can parse dict attributes"""
        output = FakeSSHResult(stdout=[
            'Content:',
            ' 1) Repo Name: repo1',
            '    URL:       /custom/url1',
            ' 2) Repo Name: repo2',
            '    URL:       /custom/url2',
        ])

        result = info_dictionary(output)
        self.assertDictEqual(result.stdout, {
            'content': [{
                'repo-name': 'repo1',
                'url': '/custom/url1',
            }, {
                'repo-name': 'repo2',
                'url': '/custom/url2',
            }],
        })
Exemple #8
0
    def test_parse_dict_attributes(self):
        """Can parse dict attributes"""
        output = FakeSSHResult(stdout=[
            'Content:',
            ' 1) Repo Name: repo1',
            '    URL:       /custom/url1',
            ' 2) Repo Name: repo2',
            '    URL:       /custom/url2',
        ])

        result = info_dictionary(output)
        self.assertDictEqual(result.stdout, {
            'content': [{
                'repo-name': 'repo1',
                'url': '/custom/url1',
            }, {
                'repo-name': 'repo2',
                'url': '/custom/url2',
            }],
        })
Exemple #9
0
    def info(cls, options=None):
        """
        Gets information by provided: options dictionary.
        @param options: ID (sometimes name or id).
        """

        cls.command_sub = "info"

        if options is None:
            options = {}

        if cls.command_requires_org and 'organization-id' not in options:
            raise Exception('organization-id option is required for %s.info' %
                            cls.__name__)

        result = cls.execute(cls._construct_command(options), expect_csv=False)

        # info_dictionary required to convert result.stdout to dic format
        updated_result = info_dictionary(result)

        return updated_result
Exemple #10
0
    def info(cls, options=None):
        """
        Gets information by provided: options dictionary.
        @param options: ID (sometimes name or id).
        """

        cls.command_sub = "info"

        if options is None:
            options = {}

        if cls.command_requires_org and 'organization-id' not in options:
            raise Exception(
                'organization-id option is required for %s.info' %
                cls.__name__)

        result = cls.execute(cls._construct_command(options), expect_csv=False)

        # info_dictionary required to convert result.stdout to dic format
        updated_result = info_dictionary(result)

        return updated_result
Exemple #11
0
    def test_parse_simple(self):
        """Can parse a simple info output"""
        output = FakeSSHResult(stdout=[
            'Id:                 19',
            'Full name:          4iv01o2u 10.5',
            'Release name:',
            '',
            'Family:',
            'Name:               4iv01o2u',
            'Major version:      10',
            'Minor version:      5',
        ])

        result = info_dictionary(output)
        self.assertDictEqual(result.stdout, {
            'id': '19',
            'full-name': '4iv01o2u 10.5',
            'release-name': {},
            'family': {},
            'name': '4iv01o2u',
            'major-version': '10',
            'minor-version': '5',
        })
Exemple #12
0
    def test_parse_simple(self):
        """Can parse a simple info output"""
        output = FakeSSHResult(stdout=[
            'Id:                 19',
            'Full name:          4iv01o2u 10.5',
            'Release name:',
            '',
            'Family:',
            'Name:               4iv01o2u',
            'Major version:      10',
            'Minor version:      5',
        ])

        result = info_dictionary(output)
        self.assertDictEqual(result.stdout, {
            'id': '19',
            'full-name': '4iv01o2u 10.5',
            'release-name': {},
            'family': {},
            'name': '4iv01o2u',
            'major-version': '10',
            'minor-version': '5',
        })