summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael DeHaan <mdehaan@redhat.com>2009-03-09 10:53:17 -0400
committerMichael DeHaan <mdehaan@redhat.com>2009-03-09 10:53:17 -0400
commitbbb4a71b6fc7ceb4f7e6c394a0f4d7e4cfa0f4d1 (patch)
treee761561d62ae83fe31af5d491267f6e259e28b47
parent5eebbb227606bf3234f47567c9346356a548234e (diff)
parent6561e80020167fb84b4761cf805fdcd94ce93723 (diff)
downloadcobbler-bbb4a71b6fc7ceb4f7e6c394a0f4d7e4cfa0f4d1.tar.gz
cobbler-bbb4a71b6fc7ceb4f7e6c394a0f4d7e4cfa0f4d1.tar.xz
cobbler-bbb4a71b6fc7ceb4f7e6c394a0f4d7e4cfa0f4d1.zip
Merge commit 'jamesc/ris-devel' into devel
-rw-r--r--cobbler/action_check.py41
-rw-r--r--cobbler/utils.py45
2 files changed, 86 insertions, 0 deletions
diff --git a/cobbler/action_check.py b/cobbler/action_check.py
index a2885a28..01bb42ec 100644
--- a/cobbler/action_check.py
+++ b/cobbler/action_check.py
@@ -84,6 +84,13 @@ class BootCheck:
self.check_for_cman(status)
+ if self.check_for_rislinux(status):
+ self.check_for_cabextract(status)
+ self.check_service(status,"smb")
+ self.check_smb_shares(status)
+ self.check_service(status,"ris-linuxd")
+ self.check_tftpd_rules(status)
+
return status
def check_for_cman(self, status):
@@ -305,11 +312,17 @@ class BootCheck:
Check that tftpd is enabled to autostart
"""
if os.path.exists(self.settings.tftpd_conf):
+ using_rules = False
f = open(self.settings.tftpd_conf)
re_disable = re.compile(r'disable.*=.*yes')
+ re_rules = re.compile(r'.*-m /etc/tftpd.rules.*')
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 })
+ if re_rules.search(line):
+ using_rules = True
+ if not using_rules:
+ status.append(_("tftpd not configured to use rules. Add '-m /etc/tftpd.rules' to the server_args line"))
else:
status.append(_("file %(file)s does not exist") % { "file" : self.settings.tftpd_conf })
@@ -318,6 +331,10 @@ class BootCheck:
status.append(_("directory needs to be created: %s" % bootloc))
+ def check_tftpd_rules(self,status):
+ if not os.path.exists("/etc/tftpd.rules"):
+ status.append(_("tftpd rules are missing. Microsoft Windows remote installations will not work correctly"))
+
def check_dhcpd_conf(self,status):
"""
NOTE: this code only applies if cobbler is *NOT* set to generate
@@ -347,3 +364,27 @@ class BootCheck:
else:
status.append(_("missing file: %(file)s") % { "file" : self.settings.dhcpd_conf })
+
+ def check_for_rislinux(self,status):
+ if os.path.exists("/etc/init.d/ris-linuxd"):
+ return True
+ else:
+ status.append(_("ris-linux is not installed, Microsoft Windows remote installations will not function correctly"))
+ return False
+
+
+ def check_for_cabextract(self,status):
+ if not os.path.exists("/usr/bin/cabextract"):
+ status.append(_("cabextract was not found, Microsoft Windows imports will not work correctly"))
+
+
+ def check_smb_shares(self,status):
+ share_found = False
+ f = open("/etc/samba/smb.conf", "rt")
+ for line in f.readlines():
+ if line.find("[REMINST]") != -1 and not line.strip().startswith("#"):
+ share_found = True
+ break
+
+ if not share_found:
+ status.append(_("no REMINST share found in the Samba configuration. Microsoft Windows remote installations will not function correctly"))
diff --git a/cobbler/utils.py b/cobbler/utils.py
index 72b438fc..18535638 100644
--- a/cobbler/utils.py
+++ b/cobbler/utils.py
@@ -958,6 +958,8 @@ def bindmount(src,dst):
except:
if not os.access(src,os.R_OK):
raise CX(_("Cannot read: %s") % src)
+ if not os.access(dst,os.R_OK):
+ raise CX(_("Cannot read: %s") % dst)
if not os.path.samefile(src,dst):
# accomodate for the possibility that we already copied
# the file as a symlink/hardlink
@@ -965,6 +967,49 @@ def bindmount(src,dst):
# traceback.print_exc()
# raise CX(_("Error bind-mounting %(src)s to %(dst)s") % { "src" : src, "dst" : dst})
+def check_openfiles(src):
+ """
+ Used to check for open files on a mounted partition.
+ """
+ try:
+ if not os.path.isdir(src):
+ raise CX(_("Error in check_openfiles: the source (%s) must be a directory") % src)
+ cmd = [ "/usr/sbin/lsof", "+D", src, "-Fn", "|", "wc", "-l" ]
+ handle = sub_process.Popen(cmd, shell=True, stdout=sub_process.PIPE, close_fds=True)
+ out = handle.stdout
+ results = out.read()
+ return int(results)
+ except:
+ if not os.access(src,os.R_OK):
+ raise CX(_("Cannot read: %s") % src)
+ if not os.path.samefile(src,dst):
+ # accomodate for the possibility that we already copied
+ # the file as a symlink/hardlink
+ raise
+ # traceback.print_exc()
+ # raise CX(_("Error bind-mounting %(src)s to %(dst)s") % { "src" : src, "dst" : dst})
+
+def umount(src):
+ """
+ Used for unmounting things created by bindmount
+ """
+ try:
+ if not os.path.isdir(src):
+ raise CX(_("Error in umount: the source (%s) must be a directory") % src)
+ cmd = [ "/bin/umount", "--force", src ]
+ rc = sub_process.call(cmd, shell=False, close_fds=True)
+ return rc
+ except:
+ if not os.access(src,os.R_OK):
+ raise CX(_("Cannot read: %s") % src)
+ if not os.path.samefile(src,dst):
+ # accomodate for the possibility that we already copied
+ # the file as a symlink/hardlink
+ raise
+ # traceback.print_exc()
+ # raise CX(_("Error bind-mounting %(src)s to %(dst)s") % { "src" : src, "dst" : dst})
+
+
def copyfile_pattern(pattern,dst,require_match=True,symlink_ok=False,api=None, verbose=False):
files = glob.glob(pattern)
if require_match and not len(files) > 0: