diff options
author | Michael DeHaan <mdehaan@redhat.com> | 2006-07-13 12:50:43 -0400 |
---|---|---|
committer | Jim Meyering <jim@meyering.net> | 2006-07-13 12:50:43 -0400 |
commit | c83c4e3820fbb716c5e7dd7560a148052a8eaa0a (patch) | |
tree | e6fcaed4ccad3803c90337bef63cefc0b363f0b7 /cobbler | |
parent | bea30de4beb585b5c79d10c6164e65713f1611bc (diff) | |
download | cobbler-c83c4e3820fbb716c5e7dd7560a148052a8eaa0a.tar.gz cobbler-c83c4e3820fbb716c5e7dd7560a148052a8eaa0a.tar.xz cobbler-c83c4e3820fbb716c5e7dd7560a148052a8eaa0a.zip |
action_sync now outputs kickstart_sys files in PXE-encoded format for consistancy
Fixed setup.py version
trailing spaces
Diffstat (limited to 'cobbler')
-rw-r--r-- | cobbler/action_sync.py | 28 | ||||
-rw-r--r-- | cobbler/yaml/ordered_dict.py | 32 | ||||
-rw-r--r-- | cobbler/yaml/redump.py | 2 | ||||
-rw-r--r-- | cobbler/yaml/timestamp.py | 16 |
4 files changed, 40 insertions, 38 deletions
diff --git a/cobbler/action_sync.py b/cobbler/action_sync.py index 92f84913..678bbc1f 100644 --- a/cobbler/action_sync.py +++ b/cobbler/action_sync.py @@ -15,13 +15,13 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. import os import shutil -import yaml +import yaml from Cheetah.Template import Template import utils import cobbler_msg import cexceptions - + class BootSync: """ Handles conversion of internal state to the tftpboot tree layout @@ -129,7 +129,7 @@ class BootSync: (http or ftp), can stay as is. kickstarts referenced by absolute path (i.e. are files path) will be mirrored over http. """ - + self.validate_kickstarts_per_profile() self.validate_kickstarts_per_system() return True @@ -142,7 +142,7 @@ class BootSync: get generated via magic URLs, those are *not* substituted. NFS kickstarts are also not substituted when referenced by NFS URL's as we don't copy those files over to the cobbler - directories. They are supposed to be live such that an + directories. They are supposed to be live such that an admin can update those without needing to run 'sync' again. """ @@ -153,7 +153,7 @@ class BootSync: if kickstart_path and os.path.exists(kickstart_path): # the input is an *actual* file, hence we have to copy it copy_path = os.path.join( - self.settings.tftpboot, + self.settings.tftpboot, "kickstarts", # profile kickstarts go here g.name ) @@ -176,7 +176,7 @@ class BootSync: Profiles would normally be sufficient, but not in cases such as static IP, where we want to be able to do templating on a system basis. - + FIXME: be sure PXE configs reference the new kickstarts_sys path instead. """ @@ -186,13 +186,14 @@ class BootSync: distro = self.distros.find(profile.distro) kickstart_path = utils.find_kickstart(profile.kickstart) if kickstart_path and os.path.exists(kickstart_path): - copy_path = os.path.join(self.settings.tftpboot, + pxe_fn = self.get_pxelinux_filename(s.name) + copy_path = os.path.join(self.settings.tftpboot, "kickstarts_sys", # system kickstarts go here - s.name + pxe_fn ) self.mkdir(copy_path) dest = os.path.join(copy_path, "ks.cfg") - try: + try: meta = self.blend_options(False,( distro.ks_meta, profile.ks_meta, @@ -213,14 +214,14 @@ class BootSync: fd.close() print metadata # FIXME: temporary t = Template( - "#errorCatcher Echo\n%s" % data, + "#errorCatcher Echo\n%s" % data, searchList=[metadata], ) computed = str(t) fd = open(out_path, "w+") fd.write(computed) fd.close() - + def build_trees(self): """ Now that kernels and initrds are copied and kickstarts are all valid, @@ -316,7 +317,8 @@ class BootSync: # if kickstart path is on disk, we've already copied it into # the HTTP mirror, so make it something anaconda can get at if kickstart_path.startswith("/"): - kickstart_path = "http://%s/cobbler/kickstarts_sys/%s/ks.cfg" % (self.settings.server, system.name) + pxe_fn = self.get_pxelinux_filename(system.name) + kickstart_path = "http://%s/cobbler/kickstarts_sys/%s/ks.cfg" % (self.settings.server, pxe_fn) nextline = nextline + " ks=%s" % kickstart_path self.tee(fd, nextline) self.close_file(fd) @@ -452,7 +454,7 @@ class BootSync: in /etc and then distro, profile, and system options with various levels of configurability overriding them. This also works for template metadata (--ksopts) - + The output when is_for_kernel is true is a space delimited list. When is_for_kernel is false, it's just a hash (which Cheetah requires). """ diff --git a/cobbler/yaml/ordered_dict.py b/cobbler/yaml/ordered_dict.py index 32dc9b47..b3788b7d 100644 --- a/cobbler/yaml/ordered_dict.py +++ b/cobbler/yaml/ordered_dict.py @@ -1,29 +1,29 @@ # This is extremely crude implementation of an OrderedDict. # If you know of a better implementation, please send it to -# the author Steve Howell. You can find my email via +# the author Steve Howell. You can find my email via # the YAML mailing list or wiki. -class OrderedDict(dict): - def __init__(self): - self._keys = [] - - def __setitem__(self, key, val): - self._keys.append(key) - dict.__setitem__(self, key, val) - - def keys(self): - return self._keys - +class OrderedDict(dict): + def __init__(self): + self._keys = [] + + def __setitem__(self, key, val): + self._keys.append(key) + dict.__setitem__(self, key, val) + + def keys(self): + return self._keys + def items(self): return [(key, self[key]) for key in self._keys] - -if __name__ == '__main__': + +if __name__ == '__main__': data = OrderedDict() data['z'] = 26 data['m'] = 13 data['a'] = 1 - for key in data.keys(): - print "The value for %s is %s" % (key, data[key]) + for key in data.keys(): + print "The value for %s is %s" % (key, data[key]) print data diff --git a/cobbler/yaml/redump.py b/cobbler/yaml/redump.py index dab8b7f3..418e5d3e 100644 --- a/cobbler/yaml/redump.py +++ b/cobbler/yaml/redump.py @@ -11,4 +11,4 @@ def redump(stream): dumper = Dumper() dumper.alphaSort = 0 return dumper.dump(*docs) - + diff --git a/cobbler/yaml/timestamp.py b/cobbler/yaml/timestamp.py index e8e5c729..abcb2e65 100644 --- a/cobbler/yaml/timestamp.py +++ b/cobbler/yaml/timestamp.py @@ -7,7 +7,7 @@ PRIVATE_NOTICE = """ objects and methods exported to the top level yaml package. """ -# +# # Time specific operations # @@ -77,13 +77,13 @@ class _timestamp: def strftime(self,format): return time.strftime(format,self.__tval) def mktime(self): return time.mktime(self.__tval) def asctime(self): return time.asctime(self.__tval) - def isotime(self): + def isotime(self): return "%04d-%02d-%02dT%02d:%02d:%02d.00Z" % self.__tval[:6] - def __repr__(self): return "yaml.timestamp('%s')" % self.isotime() + def __repr__(self): return "yaml.timestamp('%s')" % self.isotime() def __str__(self): return self.isotime() def to_yaml_implicit(self): return self.isotime() - def __hash__(self): return hash(self.__tval[:6]) - def __cmp__(self,other): + def __hash__(self): return hash(self.__tval[:6]) + def __cmp__(self,other): try: return cmp(self.__tval[:6],other.__tval[:6]) except AttributeError: @@ -99,18 +99,18 @@ try: # inherit from mx.DateTime functionality if available return getattr(self.__mxdt, name) except: class timestamp(_timestamp): pass - + def unquote(expr): """ summary: > Simply returns the unquoted string, and the - length of the quoted string token at the + length of the quoted string token at the beginning of the expression. """ tok = expr[0] - if "'" == tok: + if "'" == tok: idx = 1 odd = 0 ret = "" |