示例#1
0
文件: model.py 项目: taftsanders/pulp
 def delete(self):
     """
     Delete this repository.
     """
     bindings = resources.pulp_bindings()
     bindings.repo.delete(self.repo_id)
     log.info('Repository: %s, deleted', self.repo_id)
示例#2
0
文件: model.py 项目: pulp/pulp
 def delete(self):
     """
     Delete this importer.
     """
     bindings = resources.pulp_bindings()
     bindings.repo_importer.delete(self.repo_id, self.imp_id)
     log.info("Importer: %s/%s, deleted", self.repo_id, self.imp_id)
示例#3
0
文件: model.py 项目: taftsanders/pulp
 def delete(self):
     """
     Delete this distributor.
     """
     bindings = resources.pulp_bindings()
     bindings.repo_distributor.delete(self.repo_id, self.dist_id)
     log.info('Distributor: %s/%s, deleted', self.repo_id, self.dist_id)
示例#4
0
文件: model.py 项目: pulp/pulp
 def delete(self):
     """
     Delete this distributor.
     """
     bindings = resources.pulp_bindings()
     bindings.repo_distributor.delete(self.repo_id, self.dist_id)
     log.info("Distributor: %s/%s, deleted", self.repo_id, self.dist_id)
示例#5
0
 def _distributors(self):
     bindings = resources.pulp_bindings()
     http = bindings.server_info.get_distributors()
     if http.response_code == httplib.OK:
         return set([p[TYPE_ID] for p in http.response_body])
     else:
         raise Exception('get distributors failed:%d', http.response_code)
示例#6
0
文件: model.py 项目: pulp/pulp
 def delete(self):
     """
     Delete this repository.
     """
     bindings = resources.pulp_bindings()
     bindings.repo.delete(self.repo_id)
     log.info("Repository: %s, deleted", self.repo_id)
示例#7
0
文件: model.py 项目: taftsanders/pulp
 def delete(self):
     """
     Delete this importer.
     """
     bindings = resources.pulp_bindings()
     bindings.repo_importer.delete(self.repo_id, self.imp_id)
     log.info('Importer: %s/%s, deleted', self.repo_id, self.imp_id)
示例#8
0
文件: model.py 项目: pulp/pulp
    def run_synchronization(self, progress, cancelled, options):
        """
        Run a repo_sync() on this repository.
        :param progress: A progress report.
        :type progress: pulp_node.progress.RepositoryProgress
        :param options: node synchronization options.
        :type options: dict
        :return: The task result.
        """
        warnings.warn(TASK_DEPRECATION_WARNING, NodeDeprecationWarning)

        bindings = resources.pulp_bindings()
        poller = TaskPoller(bindings)
        max_download = options.get(constants.MAX_DOWNLOAD_CONCURRENCY_KEYWORD, constants.DEFAULT_DOWNLOAD_CONCURRENCY)
        node_certificate = options[constants.PARENT_SETTINGS][constants.NODE_CERTIFICATE]
        key, certificate = Bundle.split(node_certificate)
        configuration = {
            importer_constants.KEY_MAX_DOWNLOADS: max_download,
            importer_constants.KEY_MAX_SPEED: options.get(constants.MAX_DOWNLOAD_BANDWIDTH_KEYWORD),
            importer_constants.KEY_SSL_CLIENT_KEY: key,
            importer_constants.KEY_SSL_CLIENT_CERT: certificate,
            importer_constants.KEY_SSL_VALIDATION: False,
        }
        http = bindings.repo_actions.sync(self.repo_id, configuration)
        if http.response_code != httplib.ACCEPTED:
            raise RepoSyncRestError(self.repo_id, http.response_code)
        # The repo sync is returned with a single sync task in the Call Report
        task = http.response_body.spawned_tasks[0]
        result = poller.join(task.task_id, progress, cancelled)
        if cancelled():
            self._cancel_synchronization(task)
        return result
示例#9
0
文件: model.py 项目: pombreda/pulp
 def run_synchronization(self, progress, cancelled, options):
     """
     Run a repo_sync() on this repository.
     :param progress: A progress report.
     :type progress: pulp_node.progress.RepositoryProgress
     :param options: node synchronization options.
     :type options: dict
     :return: The task result.
     """
     bindings = resources.pulp_bindings()
     poller = TaskPoller(bindings)
     max_download = options.get(
         constants.MAX_DOWNLOAD_CONCURRENCY_KEYWORD,
         constants.DEFAULT_DOWNLOAD_CONCURRENCY)
     node_certificate = options[constants.PARENT_SETTINGS][constants.NODE_CERTIFICATE]
     key, certificate = Bundle.split(node_certificate)
     configuration = {
         importer_constants.KEY_MAX_DOWNLOADS: max_download,
         importer_constants.KEY_MAX_SPEED: options.get(constants.MAX_DOWNLOAD_BANDWIDTH_KEYWORD),
         importer_constants.KEY_SSL_CLIENT_KEY: key,
         importer_constants.KEY_SSL_CLIENT_CERT: certificate,
         importer_constants.KEY_SSL_VALIDATION: False,
     }
     http = bindings.repo_actions.sync(self.repo_id, configuration)
     if http.response_code != httplib.ACCEPTED:
         raise RepoSyncRestError(self.repo_id, http.response_code)
     # The repo sync is returned with a single sync task in the Call Report
     task = http.response_body.spawned_tasks[0]
     result = poller.join(task.task_id, progress, cancelled)
     if cancelled():
         self._cancel_synchronization(task)
     return result
示例#10
0
文件: model.py 项目: alanoe/pulp
 def purge_orphans():
     """
     Purge orphaned units within the inventory.
     """
     bindings = resources.pulp_bindings()
     http = bindings.content_orphan.remove_all()
     if http.response_code != httplib.ACCEPTED:
         raise PurgeOrphansError(http.response_code)
示例#11
0
 def purge_orphans():
     """
     Purge orphaned units within the inventory.
     """
     bindings = resources.pulp_bindings()
     http = bindings.content_orphan.remove_all()
     if http.response_code != httplib.ACCEPTED:
         raise PurgeOrphansError(http.response_code)
示例#12
0
文件: model.py 项目: pulp/pulp
 def add(self):
     """
     Add this importer to the inventory.
     """
     conf = self.details["config"]
     bindings = resources.pulp_bindings()
     bindings.repo_importer.create(self.repo_id, self.imp_id, conf)
     log.info("Importer %s/%s, added", self.repo_id, self.imp_id)
示例#13
0
文件: model.py 项目: taftsanders/pulp
 def add(self):
     """
     Add this importer to the inventory.
     """
     conf = self.details['config']
     bindings = resources.pulp_bindings()
     bindings.repo_importer.create(self.repo_id, self.imp_id, conf)
     log.info('Importer %s/%s, added', self.repo_id, self.imp_id)
示例#14
0
文件: model.py 项目: pulp/pulp
 def update(self, configuration):
     """
     Update this importer.
     :param configuration: The updated configuration.
     :type configuration: dict
     """
     bindings = resources.pulp_bindings()
     bindings.repo_importer.update(self.repo_id, self.imp_id, configuration)
     log.info("Importer: %s/%s, updated", self.repo_id, self.imp_id)
示例#15
0
文件: model.py 项目: pulp/pulp
 def update(self, delta):
     """
     Update this repository.
     :param delta: The properties that need to be updated.
     :type delta: dict
     """
     bindings = resources.pulp_bindings()
     bindings.repo.update(self.repo_id, delta)
     log.info("Repository: %s, updated", self.repo_id)
示例#16
0
文件: model.py 项目: pombreda/pulp
 def update(self, configuration):
     """
     Update this repository-distributor in the inventory.
     :param configuration: The updated configuration.
     :type configuration: dict
     """
     bindings = resources.pulp_bindings()
     bindings.repo_distributor.update(self.repo_id, self.dist_id, configuration)
     log.info('Distributor: %s/%s, updated', self.repo_id, self.dist_id)
示例#17
0
文件: model.py 项目: taftsanders/pulp
 def update(self, configuration):
     """
     Update this importer.
     :param configuration: The updated configuration.
     :type configuration: dict
     """
     bindings = resources.pulp_bindings()
     bindings.repo_importer.update(self.repo_id, self.imp_id, configuration)
     log.info('Importer: %s/%s, updated', self.repo_id, self.imp_id)
示例#18
0
文件: model.py 项目: pulp/pulp
 def update(self, configuration):
     """
     Update this repository-distributor in the inventory.
     :param configuration: The updated configuration.
     :type configuration: dict
     """
     bindings = resources.pulp_bindings()
     bindings.repo_distributor.update(self.repo_id, self.dist_id, configuration)
     log.info("Distributor: %s/%s, updated", self.repo_id, self.dist_id)
示例#19
0
文件: model.py 项目: taftsanders/pulp
 def update(self, delta):
     """
     Update this repository.
     :param delta: The properties that need to be updated.
     :type delta: dict
     """
     bindings = resources.pulp_bindings()
     bindings.repo.update(self.repo_id, delta)
     log.info('Repository: %s, updated', self.repo_id)
示例#20
0
文件: model.py 项目: pulp/pulp
    def purge_orphans():
        """
        Purge orphaned units within the inventory.
        """
        warnings.warn(TASK_DEPRECATION_WARNING, NodeDeprecationWarning)

        bindings = resources.pulp_bindings()
        http = bindings.content_orphan.remove_all()
        if http.response_code != httplib.ACCEPTED:
            raise PurgeOrphansError(http.response_code)
示例#21
0
文件: model.py 项目: taftsanders/pulp
    def purge_orphans():
        """
        Purge orphaned units within the inventory.
        """
        warnings.warn(TASK_DEPRECATION_WARNING, NodeDeprecationWarning)

        bindings = resources.pulp_bindings()
        http = bindings.content_orphan.remove_all()
        if http.response_code != httplib.ACCEPTED:
            raise PurgeOrphansError(http.response_code)
示例#22
0
文件: model.py 项目: taftsanders/pulp
 def add(self):
     """
     Add this repository-distributor to the inventory.
     """
     bindings = resources.pulp_bindings()
     bindings.repo_distributor.create(self.repo_id,
                                      self.details['distributor_type_id'],
                                      self.details['config'],
                                      self.details['auto_publish'],
                                      self.dist_id)
     log.info('Distributor: %s/%s, added', self.repo_id, self.dist_id)
示例#23
0
文件: model.py 项目: pulp/pulp
 def _cancel_synchronization(self, task):
     """
     Cancel a task associated with a repository synchronization.
     :param task: A running task.
     :type task: pulp.bindings.responses.Task
     """
     bindings = resources.pulp_bindings()
     http = bindings.tasks.cancel_task(task.task_id)
     if http.response_code == httplib.ACCEPTED:
         log.info("Task [%s] canceled", task.task_id)
     else:
         log.error("Task [%s] cancellation failed http=%s", task.task_id, http.response_code)
示例#24
0
文件: model.py 项目: pombreda/pulp
 def _cancel_synchronization(self, task):
     """
     Cancel a task associated with a repository synchronization.
     :param task: A running task.
     :type task: pulp.bindings.responses.Task
     """
     bindings = resources.pulp_bindings()
     http = bindings.tasks.cancel_task(task.task_id)
     if http.response_code == httplib.ACCEPTED:
         log.info('Task [%s] cancelled', task.task_id)
     else:
         log.error('Task [%s] cancellation failed http=%s', task.task_id, http.response_code)
示例#25
0
文件: model.py 项目: alanoe/pulp
 def add(self):
     """
     Add this repository-distributor to the inventory.
     """
     bindings = resources.pulp_bindings()
     bindings.repo_distributor.create(
         self.repo_id,
         self.details['distributor_type_id'],
         self.details['config'],
         self.details['auto_publish'],
         self.dist_id)
     log.info('Distributor: %s/%s, added', self.repo_id, self.dist_id)
示例#26
0
文件: model.py 项目: pulp/pulp
 def add(self):
     """
     Add this repository-distributor to the inventory.
     """
     bindings = resources.pulp_bindings()
     bindings.repo_distributor.create(
         self.repo_id,
         self.details["distributor_type_id"],
         self.details["config"],
         self.details["auto_publish"],
         self.dist_id,
     )
     log.info("Distributor: %s/%s, added", self.repo_id, self.dist_id)
示例#27
0
文件: model.py 项目: taftsanders/pulp
 def fetch(repo_id, imp_id):
     """
     Fetch the repository-importer from the inventory.
     :return: The fetched importer.
     :rtype: Importer
     """
     try:
         bindings = resources.pulp_bindings()
         http = bindings.repo_importer.importer(repo_id, imp_id)
         details = http.response_body
         return Importer(repo_id, imp_id, details)
     except NotFoundException:
         return None
示例#28
0
文件: model.py 项目: pulp/pulp
 def fetch(repo_id, imp_id):
     """
     Fetch the repository-importer from the inventory.
     :return: The fetched importer.
     :rtype: Importer
     """
     try:
         bindings = resources.pulp_bindings()
         http = bindings.repo_importer.importer(repo_id, imp_id)
         details = http.response_body
         return Importer(repo_id, imp_id, details)
     except NotFoundException:
         return None
示例#29
0
    def test_verify_ssl_true(self, read_config):
        """
        Make sure that verify_ssl is passed correctly when it is true.
        """
        ca_path = '/some/path'
        node_config = {'parent_oauth': {'key': 'some_key', 'secret': 'ssssh!', 'user_id': 'bgates'},
                       'main': {'verify_ssl': 'True', 'ca_path': ca_path}}
        node_config = config.Config(node_config).graph()
        read_config.return_value = node_config

        bindings = resources.pulp_bindings()

        self.assertEqual(bindings.bindings.server.ca_path, ca_path)
        self.assertEqual(bindings.bindings.server.verify_ssl, True)
示例#30
0
文件: model.py 项目: taftsanders/pulp
 def fetch_all():
     """
     Fetch all repositories from the inventory.
     :return: A list of: Repository
     :rtype: list
     """
     repositories = []
     bindings = resources.pulp_bindings()
     for repository in bindings.repo_search.search():
         repo_id = repository['id']
         details = {'repository': repository, 'distributors': []}
         r = Repository(repo_id, details)
         repositories.append(r)
     return repositories
示例#31
0
文件: model.py 项目: pulp/pulp
 def fetch_all():
     """
     Fetch all repositories from the inventory.
     :return: A list of: Repository
     :rtype: list
     """
     repositories = []
     bindings = resources.pulp_bindings()
     for repository in bindings.repo_search.search():
         repo_id = repository["id"]
         details = {"repository": repository, "distributors": []}
         r = Repository(repo_id, details)
         repositories.append(r)
     return repositories
示例#32
0
文件: model.py 项目: taftsanders/pulp
 def fetch(repo_id, dist_id):
     """
     Fetch the repository-distributor from the inventory.
     :param repo_id: The repository ID.
     :type repo_id: str
     :param dist_id: A distributor ID.
     :type dist_id: str
     :return: The fetched distributor.
     :rtype: Distributor
     """
     try:
         bindings = resources.pulp_bindings()
         http = bindings.repo_distributor.distributor(repo_id, dist_id)
         details = http.response_body
         return Distributor(repo_id, dist_id, details)
     except NotFoundException:
         return None
示例#33
0
文件: model.py 项目: pulp/pulp
 def fetch(repo_id, dist_id):
     """
     Fetch the repository-distributor from the inventory.
     :param repo_id: The repository ID.
     :type repo_id: str
     :param dist_id: A distributor ID.
     :type dist_id: str
     :return: The fetched distributor.
     :rtype: Distributor
     """
     try:
         bindings = resources.pulp_bindings()
         http = bindings.repo_distributor.distributor(repo_id, dist_id)
         details = http.response_body
         return Distributor(repo_id, dist_id, details)
     except NotFoundException:
         return None
示例#34
0
文件: model.py 项目: taftsanders/pulp
 def fetch(repo_id):
     """
     Fetch a specific repository from the inventory.
     :param repo_id: Repository ID.
     :type repo_id: str
     :return: The fetched repository.
     :rtype: Repository
     """
     details = {}
     bindings = resources.pulp_bindings()
     try:
         http = bindings.repo.repository(repo_id)
         details['repository'] = http.response_body
         http = bindings.repo_distributor.distributors(repo_id)
         details['distributors'] = http.response_body
         http = bindings.repo_importer.importers(repo_id)
         details['importers'] = http.response_body
         return Repository(repo_id, details)
     except NotFoundException:
         return None
示例#35
0
文件: model.py 项目: pulp/pulp
 def fetch(repo_id):
     """
     Fetch a specific repository from the inventory.
     :param repo_id: Repository ID.
     :type repo_id: str
     :return: The fetched repository.
     :rtype: Repository
     """
     details = {}
     bindings = resources.pulp_bindings()
     try:
         http = bindings.repo.repository(repo_id)
         details["repository"] = http.response_body
         http = bindings.repo_distributor.distributors(repo_id)
         details["distributors"] = http.response_body
         http = bindings.repo_importer.importers(repo_id)
         details["importers"] = http.response_body
         return Repository(repo_id, details)
     except NotFoundException:
         return None
示例#36
0
文件: model.py 项目: fdammeke/pulp
 def add(self):
     """
     Add the repository and associated plugins.
     """
     # repository
     bindings = resources.pulp_bindings()
     bindings.repo.create(
         self.repo_id,
         self.basic_properties['display_name'],
         self.basic_properties['description'],
         self.basic_properties['notes'])
     # distributors
     for details in self.distributors:
         dist_id = details['id']
         dist = Distributor(self.repo_id, dist_id, details)
         dist.add()
     # importers
     for details in self.importers:
         imp_id = details['id']
         importer = Importer(self.repo_id, imp_id, details)
         importer.add()
     log.info('Repository: %s, added', self.repo_id)
示例#37
0
文件: model.py 项目: taftsanders/pulp
 def add(self):
     """
     Add the repository and associated plugins.
     """
     # repository
     bindings = resources.pulp_bindings()
     bindings.repo.create(self.repo_id,
                          self.basic_properties['display_name'],
                          self.basic_properties['description'],
                          self.basic_properties['notes'])
     bindings.repo.update(
         self.repo_id, {'scratchpad': self.basic_properties['scratchpad']})
     # distributors
     for details in self.distributors:
         dist_id = details['id']
         dist = Distributor(self.repo_id, dist_id, details)
         dist.add()
     # importers
     for details in self.importers:
         imp_id = details['id']
         importer = Importer(self.repo_id, imp_id, details)
         importer.add()
     log.info('Repository: %s, added', self.repo_id)
示例#38
0
文件: model.py 项目: pulp/pulp
 def add(self):
     """
     Add the repository and associated plugins.
     """
     # repository
     bindings = resources.pulp_bindings()
     bindings.repo.create(
         self.repo_id,
         self.basic_properties["display_name"],
         self.basic_properties["description"],
         self.basic_properties["notes"],
     )
     bindings.repo.update(self.repo_id, {"scratchpad": self.basic_properties["scratchpad"]})
     # distributors
     for details in self.distributors:
         dist_id = details["id"]
         dist = Distributor(self.repo_id, dist_id, details)
         dist.add()
     # importers
     for details in self.importers:
         imp_id = details["id"]
         importer = Importer(self.repo_id, imp_id, details)
         importer.add()
     log.info("Repository: %s, added", self.repo_id)