本文整理汇总了Python中Bcfg2.Server.Plugins.Packages.Collection.Collection.__init__方法的典型用法代码示例。如果您正苦于以下问题:Python Collection.__init__方法的具体用法?Python Collection.__init__怎么用?Python Collection.__init__使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Bcfg2.Server.Plugins.Packages.Collection.Collection
的用法示例。
在下文中一共展示了Collection.__init__方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from Bcfg2.Server.Plugins.Packages.Collection import Collection [as 别名]
# 或者: from Bcfg2.Server.Plugins.Packages.Collection.Collection import __init__ [as 别名]
def __init__(self, metadata, sources, cachepath, basepath, debug=False):
Collection.__init__(self, metadata, sources, cachepath, basepath, debug=debug)
self.keypath = os.path.join(self.cachepath, "keys")
self._helper = None
if self.use_yum:
#: Define a unique cache file for this collection to use
#: for cached yum metadata
self.cachefile = os.path.join(self.cachepath, "cache-%s" % self.cachekey)
if not os.path.exists(self.cachefile):
os.mkdir(self.cachefile)
#: The path to the server-side config file used when
#: resolving packages with the Python yum libraries
self.cfgfile = os.path.join(self.cachefile, "yum.conf")
self.write_config()
self.cmd = Executor()
else:
self.cachefile = None
self.cmd = None
if HAS_PULP and self.has_pulp_sources:
_setup_pulp()
if self.pulp_cert_set is None:
certdir = os.path.join(self.basepath, "pulp", os.path.basename(PulpCertificateSet.certpath))
try:
os.makedirs(certdir)
except OSError:
err = sys.exc_info()[1]
if err.errno == errno.EEXIST:
pass
else:
self.logger.error("Could not create Pulp consumer " "cert directory at %s: %s" % (certdir, err))
self.pulp_cert_set = PulpCertificateSet(certdir)
示例2: __init__
# 需要导入模块: from Bcfg2.Server.Plugins.Packages.Collection import Collection [as 别名]
# 或者: from Bcfg2.Server.Plugins.Packages.Collection.Collection import __init__ [as 别名]
def __init__(self, metadata, sources, basepath, debug=False):
Collection.__init__(self, metadata, sources, basepath, debug=debug)
self.keypath = os.path.join(self.basepath, "keys")
if len(sources):
config = sources[0].config
self.use_yum = has_yum and config.getboolean("yum",
"use_yum_libraries",
default=False)
else:
self.use_yum = False
if self.use_yum:
self.cachefile = os.path.join(self.cachepath,
"cache-%s" % self.cachekey)
if not os.path.exists(self.cachefile):
os.mkdir(self.cachefile)
self.configdir = os.path.join(self.basepath, "yum")
if not os.path.exists(self.configdir):
os.mkdir(self.configdir)
self.cfgfile = os.path.join(self.configdir,
"%s-yum.conf" % self.cachekey)
self.write_config()
self.helper = self.config.get("yum", "helper",
default="/usr/sbin/bcfg2-yum-helper")
if has_pulp:
_setup_pulp(self.config)
示例3: __init__
# 需要导入模块: from Bcfg2.Server.Plugins.Packages.Collection import Collection [as 别名]
# 或者: from Bcfg2.Server.Plugins.Packages.Collection.Collection import __init__ [as 别名]
def __init__(self, metadata, sources, basepath):
Collection.__init__(self, metadata, sources, basepath)
self.keypath = os.path.join(self.basepath, "keys")
if len(sources):
config = sources[0].config
self.use_yum = has_yum
try:
self.use_yum &= config.getboolean("yum", "use_yum_libraries")
except (ConfigParser.NoOptionError, ConfigParser.NoSectionError):
self.use_yum = False
else:
self.use_yum = False
if self.use_yum:
self.cachefile = os.path.join(self.cachepath,
"cache-%s" % self.cachekey)
if not os.path.exists(self.cachefile):
os.mkdir(self.cachefile)
self.configdir = os.path.join(self.basepath, "yum")
if not os.path.exists(self.configdir):
os.mkdir(self.configdir)
self.cfgfile = os.path.join(self.configdir,
"%s-yum.conf" % self.cachekey)
self.write_config()
try:
self.helper = self.config.get("yum", "helper")
except ConfigParser.NoOptionError:
self.helper = "/usr/sbin/bcfg2-yum-helper"
if has_pulp:
_setup_pulp(self.config)
示例4: __init__
# 需要导入模块: from Bcfg2.Server.Plugins.Packages.Collection import Collection [as 别名]
# 或者: from Bcfg2.Server.Plugins.Packages.Collection.Collection import __init__ [as 别名]
def __init__(self, metadata, sources, cachepath, basepath, debug=False):
# we define an __init__ that just calls the parent __init__,
# so that we can set the docstring on __init__ to something
# different from the parent __init__ -- namely, the parent
# __init__ docstring, minus everything after ``.. -----``,
# which we use to delineate the actual docs from the
# .. autoattribute hacks we have to do to get private
# attributes included in sphinx 1.0 """
Collection.__init__(self, metadata, sources, cachepath, basepath, debug=debug)
示例5: __init__
# 需要导入模块: from Bcfg2.Server.Plugins.Packages.Collection import Collection [as 别名]
# 或者: from Bcfg2.Server.Plugins.Packages.Collection.Collection import __init__ [as 别名]
def __init__(self, metadata, sources, basepath, debug=False):
Collection.__init__(self, metadata, sources, basepath, debug=debug)
self.keypath = os.path.join(self.basepath, "keys")
if self.use_yum:
self.cachefile = os.path.join(self.cachepath, "cache-%s" % self.cachekey)
if not os.path.exists(self.cachefile):
os.mkdir(self.cachefile)
self.cfgfile = os.path.join(self.cachefile, "yum.conf")
self.write_config()
if has_pulp and self.has_pulp_sources:
_setup_pulp(self.setup)
self._helper = None
示例6: __init__
# 需要导入模块: from Bcfg2.Server.Plugins.Packages.Collection import Collection [as 别名]
# 或者: from Bcfg2.Server.Plugins.Packages.Collection.Collection import __init__ [as 别名]
def __init__(self, metadata, sources, basepath):
Collection.__init__(self, metadata, sources, basepath)
self.keypath = os.path.join(self.basepath, "keys")
if len(sources):
config = sources[0].config
self.use_yum = has_yum
try:
self.use_yum &= config.getboolean("yum", "use_yum_libraries")
except (ConfigParser.NoOptionError, ConfigParser.NoSectionError):
self.use_yum = False
else:
self.use_yum = False
if self.use_yum:
self._yb = None
self.cachefile = os.path.join(self.cachepath,
"cache-%s" % self.cachekey)
if not os.path.exists(self.cachefile):
os.mkdir(self.cachefile)
self.configdir = os.path.join(self.basepath, "yum")
if not os.path.exists(self.configdir):
os.mkdir(self.configdir)
self.cfgfile = os.path.join(self.configdir,
"%s-yum.conf" % self.cachekey)
if self.config.has_option("yum", "metadata_expire"):
cache_expire = self.config.getint("yum", "metadata_expire")
else:
cache_expire = 21600
self.pkgs_cache = Cache(expiration=cache_expire)
self.deps_cache = Cache(expiration=cache_expire)
self.vpkgs_cache = Cache(expiration=cache_expire)
self.group_cache = Cache(expiration=cache_expire)
self.pkgset_cache = Cache(expiration=cache_expire)
if has_pulp:
_setup_pulp(self.config)
示例7: __init__
# 需要导入模块: from Bcfg2.Server.Plugins.Packages.Collection import Collection [as 别名]
# 或者: from Bcfg2.Server.Plugins.Packages.Collection.Collection import __init__ [as 别名]
def __init__(self, metadata, sources, basepath, debug=False):
Collection.__init__(self, metadata, sources, basepath, debug=debug)
self.keypath = os.path.join(self.basepath, "keys")
if len(sources):
self.config = sources[0].config
else:
self.config = PackageConfig('Packages')
if self.use_yum:
self.cachefile = os.path.join(self.cachepath,
"cache-%s" % self.cachekey)
if not os.path.exists(self.cachefile):
os.mkdir(self.cachefile)
self.configdir = os.path.join(self.basepath, "yum")
if not os.path.exists(self.configdir):
os.mkdir(self.configdir)
self.cfgfile = os.path.join(self.configdir,
"%s-yum.conf" % self.cachekey)
self.write_config()
if has_pulp and self.has_pulp_sources:
_setup_pulp(self.config)