summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael DeHaan <mdehaan@redhat.com>2006-04-21 17:17:09 -0400
committerJim Meyering <jim@meyering.net>2006-04-21 17:17:09 -0400
commite42e37868c1d207ff1b2da1a14b4dd60e6364af5 (patch)
tree1698799eda38c2bfd47c561c05401cb05f0c27a6
parent2915377b9adb05e5ac327e27097c0cfb5705be8f (diff)
downloadthird_party-cobbler-e42e37868c1d207ff1b2da1a14b4dd60e6364af5.tar.gz
third_party-cobbler-e42e37868c1d207ff1b2da1a14b4dd60e6364af5.tar.xz
third_party-cobbler-e42e37868c1d207ff1b2da1a14b4dd60e6364af5.zip
Mirror tftp directories over http
-rw-r--r--check.py6
-rw-r--r--config.py3
-rw-r--r--sync.py30
3 files changed, 33 insertions, 6 deletions
diff --git a/check.py b/check.py
index d52386a..248e321 100644
--- a/check.py
+++ b/check.py
@@ -2,7 +2,6 @@
#
# Michael DeHaan <mdehaan@redhat.com>
-# FUTURE: Apache checking
# FUTURE: Check to see what's running
import os
@@ -30,8 +29,13 @@ class BootCheck:
self.check_tftpd_dir(status)
self.check_tftpd_conf(status)
self.check_dhcpd_conf(status)
+ self.check_httpd(status)
return status
+ def check_httpd(self,status):
+ if not os.path.exists(self.config.httpd_bin):
+ status.append(m("no_httpd"))
+
def check_dhcpd_bin(self,status):
"""
diff --git a/config.py b/config.py
index 28bc221..ae5d44b 100644
--- a/config.py
+++ b/config.py
@@ -50,6 +50,7 @@ class BootConfig:
self.pxelinux = "/usr/lib/syslinux/pxelinux.0"
self.tftpd_bin = "/usr/sbin/in.tftpd"
self.dhcpd_bin = "/usr/sbin/dhcpd"
+ self.httpd_bin = "/usr/sbin/httpd"
self.kernel_options = "append devfs=nomount ramdisk_size=16438 lang= vga=788 ksdevice=eth0 console=ttyS0,38400n8" #initrd and ks added programmatically
"""
@@ -81,6 +82,7 @@ class BootConfig:
data['pxelinux'] = self.pxelinux
data['tftpd_bin'] = self.tftpd_bin
data['dhcpd_bin'] = self.dhcpd_bin
+ data['httpd_bin'] = self.httpd_bin
return data
"""
@@ -94,6 +96,7 @@ class BootConfig:
self.pxelinux = hash['pxelinux']
self.tftpd_bin = hash['tftpd_bin']
self.dhcpd_bin = hash['dhcpd_bin']
+ self.httpd_bin = hash['httpd_bin']
except:
print "WARNING: config file error: %s" % (self.settings_file)
self.set_defaults()
diff --git a/sync.py b/sync.py
index ac1187d..e84073f 100644
--- a/sync.py
+++ b/sync.py
@@ -32,15 +32,12 @@ class BootSync:
Using the Check().run_ functions previously is recommended
"""
self.dry_run = dry_run
- #results = self.api.check()
- #if results != []:
- # self.api.last_error = m("run_check")
- # return False
try:
self.copy_pxelinux()
self.clean_trees()
self.copy_distros()
self.validate_kickstarts()
+ self.configure_httpd()
self.build_trees()
except:
traceback.print_exc()
@@ -54,7 +51,30 @@ class BootSync:
"""
self.copy(self.api.config.pxelinux, os.path.join(self.api.config.tftpboot, "pxelinux.0"))
-
+ def configure_httpd(self):
+ """
+ Create a config file to Apache that will allow access to the
+ cobbler infrastructure available over TFTP over HTTP also.
+ """
+ if not os.path.exists("/etc/httpd/conf.d"):
+ self.sync_log(m("no_httpd"))
+ return
+ f = self.open_file("/etc/httpd/conf.d/cobbler.conf","w+")
+ config = """
+ #
+ # This configuration file allows 'cobbler' boot info
+ # to be accessed over HTTP in addition to PXE.
+ AliasMatch ^/cobbler(/.*)?$ "/tftpboot$1"
+ <Directory "/tftpboot">
+ Options Indexes
+ AllowOverride None
+ Order allow,deny
+ Allow from all
+ </Directory>
+ """
+ config.replace("/tftpboot",self.api.config.tftpboot)
+ self.tee(f, config)
+ self.close_file(f)
def clean_trees(self):
"""