Esempio n. 1
0
    def setup(self, org_id, download_policy=DOWNLOAD_POLICY_ON_DEMAND):
        # type: (int, str) -> Tuple[Dict, List[Dict]]
        """Setup the repositories on server.

        Recommended usage: repository only setup, for full content setup see
            setup_content.
        """
        if self._repos_info:
            raise RepositoryAlreadyCreated('Repositories already created')
        setup_data = setup_cdn_and_custom_repositories(
            org_id, self.repos_data, download_policy=download_policy)
        self._custom_product_info, self._repos_info = setup_data
        return setup_data
Esempio n. 2
0
    def setup(self, org_id, download_policy=DOWNLOAD_POLICY_ON_DEMAND,
              synchronize=True):
        # type: (int, str, bool) -> Tuple[Dict, List[Dict]]
        """Setup the repositories on server.

        Recommended usage: repository only setup, for full content setup see
            setup_content.
        """
        if self._repos_info:
            raise RepositoryAlreadyCreated('Repositories already created')
        setup_data = setup_cdn_and_custom_repositories(
            org_id,
            self.repos_data,
            download_policy=download_policy,
            synchronize=synchronize,
        )
        self._custom_product_info, self._repos_info = setup_data
        return setup_data
Esempio n. 3
0
    def setUpClass(cls):
        """Setup must ensure there is an Org with Golden Ticket enabled.


        Option 1) SQL::

            UPDATE
                 cp_owner
            SET
                 content_access_mode = 'org_environment',
                 content_access_mode_list='entitlement,org_environment'
            WHERE account='{org.label}';

        Option 2) manifest::

            Change manifest file as it looks like:

                Consumer:
                    Name: ExampleCorp
                    UUID: c319a1d8-4b30-44cd-b2cf-2ccba4b9a8db
                    Content Access Mode: org_environment
                    Type: satellite

        :steps:

            1. Create a new organization.
            2. Use either option 1 or option 2 (described above) to activate
               the Golden Ticket.
            3. Create a Product and CV for org.
            4. Add a repository pointing to a real repo which requires a
               RedHat subscription to access.
            5. Create Content Host and assign that gated repos to it.
            6. Sync the gated repository.
        """
        super(ContentAccessTestCase, cls).setUpClass()
        # Create Organization
        cls.org = make_org()
        # upload organization manifest with org environment access enabled
        cls.manifest = manifests.clone(org_environment_access=True)
        manifests.upload_manifest_locked(cls.org['id'],
                                         cls.manifest,
                                         interface=manifests.INTERFACE_CLI)
        # Create repositories
        cls.repos = [
            # Red Hat Enterprise Linux 7
            {
                'product': PRDS['rhel'],
                'repository-set': REPOSET['rhel7'],
                'repository': REPOS['rhel7']['name'],
                'repository-id': REPOS['rhel7']['id'],
                'releasever': REPOS['rhel7']['releasever'],
                'arch': REPOS['rhel7']['arch'],
                'cdn': True,
            },
            # Red Hat Satellite Tools
            {
                'product': PRDS['rhel'],
                'repository-set': REPOSET['rhst7'],
                'repository': REPOS['rhst7']['name'],
                'repository-id': REPOS['rhst7']['id'],
                'url': settings.sattools_repo['rhel7'],
                'cdn': bool(settings.cdn
                            or not settings.sattools_repo['rhel7']),
            },
        ]
        cls.custom_product, cls.repos_info = setup_cdn_and_custom_repositories(
            cls.org['id'], cls.repos)
        # Create a content view
        content_view = make_content_view({u'organization-id': cls.org['id']})
        # Add repositories to content view
        for repo_info in cls.repos_info:
            ContentView.add_repository({
                u'id': content_view['id'],
                u'organization-id': cls.org['id'],
                u'repository-id': repo_info['id'],
            })
        # Publish the content view
        ContentView.publish({u'id': content_view['id']})
        cls.content_view = ContentView.info({u'id': content_view['id']})
Esempio n. 4
0
    def setUpClass(cls):
        """Setup must ensure there is an Org with Golden Ticket enabled.

        Option 1) SQL::

            UPDATE
                 cp_owner
            SET
                 content_access_mode = 'org_environment',
                 content_access_mode_list='entitlement,org_environment'
            WHERE account='{org.label}';

        Option 2) manifest::

            Change manifest file as it looks like:

                Consumer:
                    Name: ExampleCorp
                    UUID: c319a1d8-4b30-44cd-b2cf-2ccba4b9a8db
                    Content Access Mode: org_environment
                    Type: satellite

        :steps:

            1. Create a new organization.
            2. Use either option 1 or option 2 (described above) to activate
               the Golden Ticket.
            3. Create a Product and CV for org.
            4. Add a repository pointing to a real repo which requires a
               RedHat subscription to access.
            5. Create Content Host and assign that gated repos to it.
            6. Create Host with no attached subscriptions.
            7. Sync the gated repository.

        """
        super(ContentAccessTestCase, cls).setUpClass()
        # Create Organization
        cls.org = entities.Organization().create()
        # upload organization manifest with org environment access enabled
        manifests.upload_manifest_locked(
            cls.org.id, manifests.clone(org_environment_access=True))
        # Create repositories
        cls.repos = [
            # Red Hat Enterprise Linux 7
            {
                'product': PRDS['rhel'],
                'repository-set': REPOSET['rhel7'],
                'repository': REPOS['rhel7']['name'],
                'repository-id': REPOS['rhel7']['id'],
                'releasever': REPOS['rhel7']['releasever'],
                'arch': REPOS['rhel7']['arch'],
                'cdn': True,
            },
            # Red Hat Satellite Tools
            {
                'product': PRDS['rhel'],
                'repository-set': REPOSET['rhst7'],
                'repository': REPOS['rhst7']['name'],
                'repository-id': REPOS['rhst7']['id'],
                'url': settings.sattools_repo['rhel7'],
                'cdn': bool(settings.cdn
                            or not settings.sattools_repo['rhel7']),
            },
        ]
        cls.custom_product, cls.repos_info = setup_cdn_and_custom_repositories(
            cls.org.id, cls.repos)
        # Create a content view
        content_view = entities.ContentView(
            organization=cls.org,
            repository=[
                entities.Repository(id=repo_info['id'])
                for repo_info in cls.repos_info
            ],
        ).create()
        # Publish the content view
        call_entity_method_with_timeout(content_view.publish, timeout=1500)
        cls.content_view = content_view.read()
    def setUpClass(cls):
        """Setup must ensure there is an Org with Golden Ticket enabled.

        Option 1) SQL::

            UPDATE
                 cp_owner
            SET
                 content_access_mode = 'org_environment',
                 content_access_mode_list='entitlement,org_environment'
            WHERE account='{org.label}';

        Option 2) manifest::

            Change manifest file as it looks like:

                Consumer:
                    Name: ExampleCorp
                    UUID: c319a1d8-4b30-44cd-b2cf-2ccba4b9a8db
                    Content Access Mode: org_environment
                    Type: satellite

        :steps:

            1. Create a new organization.
            2. Use either option 1 or option 2 (described above) to activate
               the Golden Ticket.
            3. Create a Product and CV for org.
            4. Add a repository pointing to a real repo which requires a
               RedHat subscription to access.
            5. Create Content Host and assign that gated repos to it.
            6. Create Host with no attached subscriptions.
            7. Sync the gated repository.

        """
        super(ContentAccessTestCase, cls).setUpClass()
        # Create Organization
        cls.org = entities.Organization().create()
        # upload organization manifest with org environment access enabled
        manifests.upload_manifest_locked(
            cls.org.id,
            manifests.clone(org_environment_access=True)
        )
        # Create repositories
        cls.repos = [
            # Red Hat Enterprise Linux 7
            {
                'product': PRDS['rhel'],
                'repository-set': REPOSET['rhel7'],
                'repository': REPOS['rhel7']['name'],
                'repository-id': REPOS['rhel7']['id'],
                'releasever': REPOS['rhel7']['releasever'],
                'arch': REPOS['rhel7']['arch'],
                'cdn': True,
            },
            # Red Hat Satellite Tools
            {
                'product': PRDS['rhel'],
                'repository-set': REPOSET['rhst7'],
                'repository': REPOS['rhst7']['name'],
                'repository-id': REPOS['rhst7']['id'],
                'url': settings.sattools_repo['rhel7'],
                'cdn': bool(
                    settings.cdn or not settings.sattools_repo['rhel7']),
            },
        ]
        cls.custom_product, cls.repos_info = setup_cdn_and_custom_repositories(
            cls.org.id, cls.repos)
        # Create a content view
        content_view = entities.ContentView(
            organization=cls.org,
            repository=[entities.Repository(id=repo_info['id'])
                        for repo_info in cls.repos_info],
        ).create()
        # Publish the content view
        call_entity_method_with_timeout(content_view.publish, timeout=1500)
        cls.content_view = content_view.read()
    def setUpClass(cls):
        """Setup must ensure there is an Org with Golden Ticket enabled.


        Option 1) SQL::

            UPDATE
                 cp_owner
            SET
                 content_access_mode = 'org_environment',
                 content_access_mode_list='entitlement,org_environment'
            WHERE account='{org.label}';

        Option 2) manifest::

            Change manifest file as it looks like:

                Consumer:
                    Name: ExampleCorp
                    UUID: c319a1d8-4b30-44cd-b2cf-2ccba4b9a8db
                    Content Access Mode: org_environment
                    Type: satellite

        :steps:

            1. Create a new organization.
            2. Use either option 1 or option 2 (described above) to activate
               the Golden Ticket.
            3. Create a Product and CV for org.
            4. Add a repository pointing to a real repo which requires a
               RedHat subscription to access.
            5. Create Content Host and assign that gated repos to it.
            6. Sync the gated repository.
        """
        super(ContentAccessTestCase, cls).setUpClass()
        # Create Organization
        cls.org = make_org()
        # upload organization manifest with org environment access enabled
        cls.manifest = manifests.clone(org_environment_access=True)
        manifests.upload_manifest_locked(
            cls.org['id'],
            cls.manifest,
            interface=manifests.INTERFACE_CLI
        )
        # Create repositories
        cls.repos = [
            # Red Hat Enterprise Linux 7
            {
                'product': PRDS['rhel'],
                'repository-set': REPOSET['rhel7'],
                'repository': REPOS['rhel7']['name'],
                'repository-id': REPOS['rhel7']['id'],
                'releasever': REPOS['rhel7']['releasever'],
                'arch': REPOS['rhel7']['arch'],
                'cdn': True,
            },
            # Red Hat Satellite Tools
            {
                'product': PRDS['rhel'],
                'repository-set': REPOSET['rhst7'],
                'repository': REPOS['rhst7']['name'],
                'repository-id': REPOS['rhst7']['id'],
                'url': settings.sattools_repo['rhel7'],
                'cdn': bool(
                    settings.cdn or not settings.sattools_repo['rhel7']),
            },
        ]
        cls.custom_product, cls.repos_info = setup_cdn_and_custom_repositories(
            cls.org['id'], cls.repos)
        # Create a content view
        content_view = make_content_view({u'organization-id': cls.org['id']})
        # Add repositories to content view
        for repo_info in cls.repos_info:
            ContentView.add_repository({
                u'id': content_view['id'],
                u'organization-id': cls.org['id'],
                u'repository-id': repo_info['id'],
            })
        # Publish the content view
        ContentView.publish({u'id': content_view['id']})
        cls.content_view = ContentView.info({u'id': content_view['id']})