本文整理汇总了Python中utils.tftpboot_location函数的典型用法代码示例。如果您正苦于以下问题:Python tftpboot_location函数的具体用法?Python tftpboot_location怎么用?Python tftpboot_location使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了tftpboot_location函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: check_tftpd_dir
def check_tftpd_dir(self,status):
"""
Check if cobbler.conf's tftpboot directory exists
"""
bootloc = utils.tftpboot_location()
if not os.path.exists(bootloc):
status.append(_("please create directory: %(dirname)s") % { "dirname" : bootloc })
开发者ID:pwright,项目名称:cobbler,代码行数:7,代码来源:action_check.py
示例2: remove_single_system
def remove_single_system(self, name):
bootloc = utils.tftpboot_location()
system_record = self.systems.find(name=name)
# delete contents of kickstarts_sys/$name in webdir
system_record = self.systems.find(name=name)
if self.settings.manage_dhcp:
if self.settings.omapi_enabled:
for (name,interface) in system_record.interfaces.iteritems():
self.sync.dhcp.remove_dhcp_lease(
self.settings.omapi_port,
interface["dns_name"]
)
itanic = False
profile = self.profiles.find(name=system_record.profile)
if profile is not None:
distro = self.distros.find(name=profile.distro)
if distro is not None and distro in [ "ia64", "IA64"]:
itanic = True
for (name,interface) in system_record.interfaces.iteritems():
filename = utils.get_config_filename(system_record,interface=name)
if not itanic:
utils.rmfile(os.path.join(bootloc, "pxelinux.cfg", filename))
else:
utils.rmfile(os.path.join(bootloc, filename))
开发者ID:pwright,项目名称:cobbler,代码行数:28,代码来源:action_litesync.py
示例3: __init__
def __init__(self, config, verbose=True, dhcp=None, dns=None, logger=None, tftpd=None):
"""
Constructor
"""
self.logger = logger
if logger is None:
self.logger = clogger.Logger()
self.verbose = verbose
self.config = config
self.api = config.api
self.distros = config.distros()
self.profiles = config.profiles()
self.systems = config.systems()
self.settings = config.settings()
self.repos = config.repos()
self.templar = templar.Templar(config, self.logger)
self.pxegen = pxegen.PXEGen(config, self.logger)
self.dns = dns
self.dhcp = dhcp
self.tftpd = tftpd
self.bootloc = utils.tftpboot_location()
self.pxegen.verbose = verbose
self.dns.verbose = verbose
self.dhcp.verbose = verbose
self.pxelinux_dir = os.path.join(self.bootloc, "pxelinux.cfg")
self.grub_dir = os.path.join(self.bootloc, "grub")
self.images_dir = os.path.join(self.bootloc, "images")
self.yaboot_bin_dir = os.path.join(self.bootloc, "ppc")
self.yaboot_cfg_dir = os.path.join(self.bootloc, "etc")
self.rendered_dir = os.path.join(self.settings.webdir, "rendered")
开发者ID:Acidburn0zzz,项目名称:cobbler,代码行数:32,代码来源:action_sync.py
示例4: write_boot_files_distro
def write_boot_files_distro(self,distro):
# collapse the object down to a rendered datastructure
# the second argument set to false means we don't collapse
# hashes/arrays into a flat string
target = utils.blender(self.config.api, False, distro)
# Create metadata for the templar function
# Right now, just using img_path, but adding more
# cobbler variables here would probably be good
metadata = {}
metadata["img_path"] = os.path.join(
utils.tftpboot_location(),
"images",distro.name)
# Create the templar instance. Used to template the target directory
templater = templar.Templar()
# Loop through the hash of boot files,
# executing a cp for each one
for file in target["boot_files"].keys():
file_dst = templater.render(file,metadata,None)
try:
shutil.copyfile(target["boot_files"][file], file_dst)
self.config.api.log("copied file %s to %s for %s" % (
target["boot_files"][file],
file_dst,
distro.name))
except:
self.logger.error("failed to copy file %s to %s for %s" % (
target["boot_files"][file],
file_dst,
distro.name))
# Continue on to sync what you can
return 0
开发者ID:SEJeff,项目名称:cobbler,代码行数:34,代码来源:manage_in_tftpd.py
示例5: __init__
def __init__(self,config,verbose=True,dhcp=None,dns=None,logger=None):
"""
Constructor
"""
self.logger = logger
if logger is None:
self.logger = clogger.Logger()
self.verbose = verbose
self.config = config
self.api = config.api
self.distros = config.distros()
self.profiles = config.profiles()
self.systems = config.systems()
self.settings = config.settings()
self.repos = config.repos()
self.templar = templar.Templar(config, self.logger)
self.pxegen = pxegen.PXEGen(config, self.logger)
self.dns = dns
self.dhcp = dhcp
self.bootloc = utils.tftpboot_location()
self.pxegen.verbose = verbose
self.dns.verbose = verbose
self.dhcp.verbose = verbose
开发者ID:imeyer,项目名称:cobbler,代码行数:25,代码来源:action_sync.py
示例6: remove_single_distro
def remove_single_distro(self, name):
bootloc = utils.tftpboot_location()
# delete contents of images/$name directory in webdir
utils.rmtree(os.path.join(self.settings.webdir, "images", name))
# delete contents of images/$name in tftpboot
utils.rmtree(os.path.join(bootloc, "images", name))
# delete potential symlink to tree in webdir/links
utils.rmfile(os.path.join(self.settings.webdir, "links", name))
开发者ID:ArcRaven,项目名称:cobbler,代码行数:8,代码来源:action_litesync.py
示例7: remove_single_system
def remove_single_system(self, name):
bootloc = utils.tftpboot_location()
system_record = self.systems.find(name=name)
# delete contents of kickstarts_sys/$name in webdir
system_record = self.systems.find(name=name)
for (name, interface) in system_record.interfaces.iteritems():
filename = utils.get_config_filename(system_record, interface=name)
utils.rmfile(os.path.join(bootloc, "pxelinux.cfg", filename))
utils.rmfile(os.path.join(bootloc, "grub", filename.upper()))
开发者ID:Acidburn0zzz,项目名称:cobbler,代码行数:10,代码来源:action_litesync.py
示例8: check_ctftpd_dir
def check_ctftpd_dir(self,status):
"""
Check if cobbler.conf's tftpboot directory exists
"""
if self.checked_dist in ["debian", "ubuntu"]:
return
bootloc = utils.tftpboot_location()
if not os.path.exists(bootloc):
status.append(_("please create directory: %(dirname)s") % { "dirname" : bootloc })
开发者ID:77720616,项目名称:cobbler,代码行数:10,代码来源:action_check.py
示例9: __init__
def __init__(self,config,logger):
"""
Constructor
"""
self.logger = logger
self.config = config
self.templar = templar.Templar(config)
self.settings_file = "/etc/xinetd.d/tftp"
self.pxegen = pxegen.PXEGen(config, self.logger)
self.systems = config.systems()
self.bootloc = utils.tftpboot_location()
开发者ID:akesling,项目名称:cobbler,代码行数:11,代码来源:manage_in_tftpd.py
示例10: __init__
def __init__(self, collection_mgr, logger):
"""
Constructor
"""
self.logger = logger
if self.logger is None:
self.logger = clogger.Logger()
self.collection_mgr = collection_mgr
self.templar = templar.Templar(collection_mgr)
self.settings_file = "/etc/xinetd.d/tftp"
self.tftpgen = tftpgen.TFTPGen(collection_mgr, self.logger)
self.systems = collection_mgr.systems()
self.bootloc = utils.tftpboot_location()
开发者ID:inthecloud247,项目名称:cobbler,代码行数:14,代码来源:manage_in_tftpd.py
示例11: __init__
def __init__(self, collection_mgr, logger):
"""
Constructor
"""
self.collection_mgr = collection_mgr
self.logger = logger
self.api = collection_mgr.api
self.distros = collection_mgr.distros()
self.profiles = collection_mgr.profiles()
self.systems = collection_mgr.systems()
self.settings = collection_mgr.settings()
self.repos = collection_mgr.repos()
self.images = collection_mgr.images()
self.templar = templar.Templar(collection_mgr)
self.bootloc = utils.tftpboot_location()
开发者ID:arnobroekhof,项目名称:cobbler,代码行数:15,代码来源:tftpgen.py
示例12: __init__
def __init__(self,config):
"""
Constructor
"""
self.config = config
self.api = config.api
self.distros = config.distros()
self.profiles = config.profiles()
self.systems = config.systems()
self.settings = config.settings()
self.repos = config.repos()
self.images = config.images()
self.templar = templar.Templar(config)
self.bootloc = utils.tftpboot_location()
self.verbose = False
开发者ID:icontender,项目名称:cobbler,代码行数:15,代码来源:pxegen.py
示例13: __init__
def __init__(self, config, logger):
"""
Constructor
"""
self.config = config
self.logger = logger
self.api = config.api
self.distros = config.distros()
self.profiles = config.profiles()
self.systems = config.systems()
self.settings = config.settings()
self.repos = config.repos()
self.images = config.images()
self.templar = templar.Templar(config)
self.bootloc = utils.tftpboot_location()
# FIXME: not used anymore, can remove?
self.verbose = False
开发者ID:chu888chu888,项目名称:Python-Linux-cobbler,代码行数:17,代码来源:pxegen.py
示例14: check_tftpd_conf
def check_tftpd_conf(self,status):
"""
Check that configured tftpd boot directory matches with actual
Check that tftpd is enabled to autostart
"""
if os.path.exists(self.settings.tftpd_conf):
f = open(self.settings.tftpd_conf)
re_disable = re.compile(r'disable.*=.*yes')
for line in f.readlines():
if re_disable.search(line) and not line.strip().startswith("#"):
status.append(_("change 'disable' to 'no' in %(file)s") % { "file" : self.settings.tftpd_conf })
else:
status.append(_("file %(file)s does not exist") % { "file" : self.settings.tftpd_conf })
bootloc = utils.tftpboot_location()
if not os.path.exists(bootloc):
status.append(_("directory needs to be created: %s" % bootloc))
开发者ID:pwright,项目名称:cobbler,代码行数:17,代码来源:action_check.py
示例15: modacl
def modacl(self,isadd,isuser,who):
webdir = self.settings.webdir
snipdir = self.settings.snippetsdir
tftpboot = utils.tftpboot_location()
PROCESS_DIRS = {
webdir : "rwx",
"/var/log/cobbler" : "rwx",
"/var/lib/cobbler" : "rwx",
"/etc/cobbler" : "rwx",
tftpboot : "rwx",
"/var/lib/cobbler/triggers" : "rwx"
}
if not snipdir.startswith("/var/lib/cobbler/"):
PROCESS_DIRS[snipdir] = "r"
cmd = "-R"
if isadd:
cmd = "%s -m" % cmd
else:
cmd = "%s -x" % cmd
if isuser:
cmd = "%s u:%s" % (cmd,who)
else:
cmd = "%s g:%s" % (cmd,who)
for d in PROCESS_DIRS:
how = PROCESS_DIRS[d]
if isadd:
cmd2 = "%s:%s" % (cmd,how)
else:
cmd2 = cmd
cmd2 = "%s %s" % (cmd2,d)
print "- setfacl -d %s" % cmd2
rc = sub_process.call("setfacl -d %s" % cmd2,shell=True,close_fds=True)
if not rc == 0:
raise CX(_("command failed"))
print "- setfacl %s" % cmd2
rc = sub_process.call("setfacl %s" % cmd2,shell=True,close_fds=True)
if not rc == 0:
raise CX(_("command failed"))
开发者ID:icontender,项目名称:cobbler,代码行数:44,代码来源:action_acl.py
示例16: modacl
def modacl(self, isadd, isuser, who):
snipdir = self.settings.autoinstall_snippets_dir
tftpboot = utils.tftpboot_location()
PROCESS_DIRS = {
"/var/log/cobbler": "rwx",
"/var/log/cobbler/tasks": "rwx",
"/var/lib/cobbler": "rwx",
"/etc/cobbler": "rwx",
tftpboot: "rwx",
"/var/lib/cobbler/triggers": "rwx"
}
if not snipdir.startswith("/var/lib/cobbler/"):
PROCESS_DIRS[snipdir] = "r"
cmd = "-R"
if isadd:
cmd = "%s -m" % cmd
else:
cmd = "%s -x" % cmd
if isuser:
cmd = "%s u:%s" % (cmd, who)
else:
cmd = "%s g:%s" % (cmd, who)
for d in PROCESS_DIRS:
how = PROCESS_DIRS[d]
if isadd:
cmd2 = "%s:%s" % (cmd, how)
else:
cmd2 = cmd
cmd2 = "%s %s" % (cmd2, d)
rc = utils.subprocess_call(self.logger, "setfacl -d %s" % cmd2, shell=True)
if not rc == 0:
utils.die(self.logger, "command failed")
rc = utils.subprocess_call(self.logger, "setfacl %s" % cmd2, shell=True)
if not rc == 0:
utils.die(self.logger, "command failed")
开发者ID:ASyriy,项目名称:cobbler,代码行数:42,代码来源:action_acl.py
示例17: remove_single_system
def remove_single_system(self, name):
bootloc = utils.tftpboot_location()
system_record = self.systems.find(name=name)
# delete contents of kickstarts_sys/$name in webdir
system_record = self.systems.find(name=name)
itanic = False
profile = self.profiles.find(name=system_record.profile)
if profile is not None:
distro = self.distros.find(name=profile.get_conceptual_parent().name)
if distro is not None and distro in [ "ia64", "IA64"]:
itanic = True
for (name,interface) in system_record.interfaces.iteritems():
filename = utils.get_config_filename(system_record,interface=name)
if not itanic:
utils.rmfile(os.path.join(bootloc, "pxelinux.cfg", filename))
else:
utils.rmfile(os.path.join(bootloc, filename))
开发者ID:mafalb,项目名称:cobbler,代码行数:20,代码来源:action_litesync.py
示例18: write_boot_files_distro
def write_boot_files_distro(self,distro):
# collapse the object down to a rendered datastructure
# the second argument set to false means we don't collapse
# hashes/arrays into a flat string
target = utils.blender(self.config.api, False, distro)
# Create metadata for the templar function
# Right now, just using img_path, but adding more
# cobbler variables here would probably be good
metadata = {}
metadata["img_path"] = os.path.join(
utils.tftpboot_location(),
"images",distro.name)
# Create the templar instance. Used to template the target directory
templater = templar.Templar(self.config)
# Loop through the hash of boot files,
# executing a cp for each one
for file in target["boot_files"].keys():
rendered_file = templater.render(file,metadata,None)
try:
for f in glob.glob(target["boot_files"][file]):
if f == target["boot_files"][file]:
# this wasn't really a glob, so just copy it as is
filedst = rendered_file
else:
# this was a glob, so figure out what the destination
# file path/name should be
tgt_path,tgt_file=os.path.split(f)
rnd_path,rnd_file=os.path.split(rendered_file)
filedst = os.path.join(rnd_path,tgt_file)
if not os.path.isfile(filedst):
shutil.copyfile(f, filedst)
self.config.api.log("copied file %s to %s for %s" % (f,filedst,distro.name))
except:
self.logger.error("failed to copy file %s to %s for %s" % (f,filedst,distro.name))
return 0
开发者ID:glensc,项目名称:cobbler,代码行数:38,代码来源:manage_in_tftpd.py
示例19: check_vsftpd_bin
def check_vsftpd_bin(self,status):
"""
Check if vsftpd is installed
"""
if not os.path.exists(self.settings.vsftpd_bin):
status.append(_("vsftpd is not installed (NOTE: needed for s390x support only)"))
else:
self.check_service(status,"vsftpd","needed for 390x support only")
bootloc = utils.tftpboot_location()
if not os.path.exists("/etc/vsftpd/vsftpd.conf"):
status.append("missing /etc/vsftpd/vsftpd.conf")
conf = open("/etc/vsftpd/vsftpd.conf")
data = conf.read()
lines = data.split("\n")
ok = False
for line in lines:
if line.find("anon_root") != -1 and line.find(bootloc) != -1:
ok = True
break
conf.close()
if not ok:
status.append("in /etc/vsftpd/vsftpd.conf the line 'anon_root=%s' should be added (needed for s390x support only)" % bootloc)
开发者ID:pwright,项目名称:cobbler,代码行数:23,代码来源:action_check.py
示例20: remove_single_image
def remove_single_image(self, name):
bootloc = utils.tftpboot_location()
utils.rmfile(os.path.join(bootloc, "images2", name))
开发者ID:ArcRaven,项目名称:cobbler,代码行数:3,代码来源:action_litesync.py
注:本文中的utils.tftpboot_location函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论