本文整理汇总了Python中pulp.common.config.read_json_config函数的典型用法代码示例。如果您正苦于以下问题:Python read_json_config函数的具体用法?Python read_json_config怎么用?Python read_json_config使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了read_json_config函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: entry_point
def entry_point():
"""
This method allows us to announce this importer to the Pulp Platform.
:return: importer class as its config
:rtype: tuple
"""
return ISOImporter, config_utils.read_json_config(CONF_FILENAME)
示例2: entry_point
def entry_point():
"""
Entry point that pulp platform uses to load the importer
:return: importer class and its config
:rtype: Importer, dict
"""
plugin_config = read_json_config(constants.IMPORTER_CONFIG_FILE_NAME)
return DockerImporter, plugin_config
示例3: entry_point
def entry_point():
"""
Entry point that pulp platform uses to load the importer
:return: importer class and its config
:rtype: Importer, dict
"""
config = read_json_config(constants.IMPORTER_CONFIG_FILE_PATH)
return WebImporter, config
示例4: test_read_json_config
def test_read_json_config(self, mock_open, exists):
exists.return_value = True
mock_open.return_value.read.return_value = '{"foo":"bar"}'
config = read_json_config("server/foo")
mock_open.assert_called_once_with('/etc/pulp/server/foo', 'r')
self.assertEqual(config, {'foo': 'bar'})
示例5: entry_point
def entry_point():
"""
Entry point that pulp platform uses to load the importer
:return: importer class and its config
:rtype: Importer, {}
"""
plugin_config = read_json_config(CONF_FILENAME)
return PuppetModuleImporter, plugin_config
示例6: entry_point
def entry_point():
"""
Entry point that pulp platform uses to load the importer
:return: importer class and its config
:rtype: Importer, dict
"""
plugin_config = read_json_config(constants.IMPORTER_CONFIG_RELATIVE_PATH)
return OpenstackImageImporter, plugin_config
示例7: entry_point
def entry_point():
"""
Entry point that pulp platform uses to load the distributor
:return: distributor class and its config
:rtype: Distributor, dict
"""
plugin_config = copy.deepcopy(PLUGIN_DEFAULT_CONFIG)
edited_config = read_json_config(constants.DISTRIBUTOR_CONFIG_FILE_PATH)
plugin_config.update(edited_config)
return WebDistributor, plugin_config
示例8: entry_point
def entry_point():
config = read_json_config(CONF_FILE_PATH)
return GroupISODistributor, config
示例9: read_json_config
from pulp.plugins.config import PluginCallConfiguration
from pulp.server.db.connection import get_collection
from pulp.server.managers.repo import _common as common_utils
from pulp_rpm.plugins.distributors.yum.publish import Publisher
YUM_DISTRIBUTOR_ID = 'yum_distributor'
REPO_WORKING_DIR = '/var/lib/pulp/working/%s/distributors/' + YUM_DISTRIBUTOR_ID
OLD_ROOT_PUBLISH_DIR = '/var/lib/pulp/published'
OLD_HTTP_PUBLISH_DIR = os.path.join(OLD_ROOT_PUBLISH_DIR, 'http', 'repos')
OLD_HTTPS_PUBLISH_DIR = os.path.join(OLD_ROOT_PUBLISH_DIR, 'https', 'repos')
NEW_DISTRIBUTOR_CONF_FILE_PATH = 'server/plugins.conf.d/%s.json' % YUM_DISTRIBUTOR_ID
NEW_DISTRIBUTOR_CONF = read_json_config(NEW_DISTRIBUTOR_CONF_FILE_PATH)
def migrate(*args, **kwargs):
"""
For each repository with a yum distributor, clean up the old yum distributor's
mess and re-publish the repository with the new distributor.
"""
distributor_collection = get_collection('repo_distributors')
yum_distributors = list(distributor_collection.find({'distributor_type_id': YUM_DISTRIBUTOR_ID}))
repo_collection = get_collection('repos')
repo_ids = list(set(d['repo_id'] for d in yum_distributors))
repos = dict((r['id'], r) for r in repo_collection.find({'id': {'$in': repo_ids}}))
示例10: entry_point
def entry_point():
config = read_json_config(CONF_FILE_PATH)
return YumHTTPDistributor, config
示例11: entry_point
def entry_point():
config = read_json_config(CONF_FILE_PATH)
return ISORsyncDistributor, config
示例12: entry_point
def entry_point():
return WinImporter, config_utils.read_json_config(CONF_FILENAME)
示例13: test_read_json_config_non_existent_file
def test_read_json_config_non_existent_file(self):
config = read_json_config("bad/file/name")
self.assertEqual(config, {})
示例14: test_read_json_config_prepended_slash_in_path
def test_read_json_config_prepended_slash_in_path(self, mock_open, exists):
exists.return_value = True
mock_open.return_value.read.return_value = '{"foo":"bar"}'
read_json_config("/server/foo")
mock_open.assert_called_once_with('/etc/pulp/server/foo', 'r')
示例15: read_json_config
import logging
import os
from pulp.common.config import read_json_config
from pulp_rpm.plugins.distributors.yum import configuration
from pulp_rpm.common.ids import TYPE_ID_DISTRIBUTOR_YUM
_logger = logging.getLogger(__name__)
CONF_FILE_PATH = 'server/plugins.conf.d/%s.json' % TYPE_ID_DISTRIBUTOR_YUM
config = read_json_config(CONF_FILE_PATH)
def walk_and_clean_directories(base_directory):
"""
Walk through all of the directories inside of the base dir and clean the orphaned directories.
The leaves should be directories with a listing file and a symlink. If there is no symlink,
the directory is part of the relative url of a repo that has been deleted and it should be
removed.
:param base_directory: directory to search for orphaned directories
:type base_directory: str
:raises: OSError can occur if migration occurs durring a concurrent publish
"""
for path, dirs, files in os.walk(base_directory):
is_orphan = not dirs and (files == ['listing'] or files == [])
if is_orphan and path != base_directory: