当前位置: 首页>>代码示例>>Python>>正文


Python resources.pulp_bindings函数代码示例

本文整理汇总了Python中pulp_node.resources.pulp_bindings函数的典型用法代码示例。如果您正苦于以下问题:Python pulp_bindings函数的具体用法?Python pulp_bindings怎么用?Python pulp_bindings使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了pulp_bindings函数的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: run_synchronization

    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
开发者ID:pulp,项目名称:pulp,代码行数:32,代码来源:model.py

示例2: delete

 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)
开发者ID:pulp,项目名称:pulp,代码行数:7,代码来源:model.py

示例3: _distributors

 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)
开发者ID:BrnoPCmaniak,项目名称:pulp,代码行数:7,代码来源:validation.py

示例4: purge_orphans

 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)
开发者ID:alanoe,项目名称:pulp,代码行数:8,代码来源:model.py

示例5: add

 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)
开发者ID:pulp,项目名称:pulp,代码行数:8,代码来源:model.py

示例6: update

 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)
开发者ID:pulp,项目名称:pulp,代码行数:9,代码来源:model.py

示例7: purge_orphans

    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)
开发者ID:pulp,项目名称:pulp,代码行数:10,代码来源:model.py

示例8: add

 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)
开发者ID:alanoe,项目名称:pulp,代码行数:12,代码来源:model.py

示例9: _cancel_synchronization

 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)
开发者ID:pulp,项目名称:pulp,代码行数:12,代码来源:model.py

示例10: fetch

 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
开发者ID:pulp,项目名称:pulp,代码行数:13,代码来源:model.py

示例11: test_verify_ssl_true

    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)
开发者ID:AndreaGiardini,项目名称:pulp,代码行数:14,代码来源:test_resources.py

示例12: fetch_all

 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
开发者ID:pulp,项目名称:pulp,代码行数:14,代码来源:model.py

示例13: add

 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)
开发者ID:fdammeke,项目名称:pulp,代码行数:22,代码来源:model.py


注:本文中的pulp_node.resources.pulp_bindings函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。