If we're doing this for preseed files, we might as well do kernel files, initrd files, and vm xml files. There's a block in utah/provisioning/provisioning.py like this:
for item in ['preseed', 'xml', 'kernel', 'initrd', 'image']:
if locals()[item] is None: self.__dict__[item] = None
else:
if '~' in locals()[item]: path = os.path.expanduser(locals()[item]) self.logger.debug('Rewriting ~-based path: ' + locals()[item] + ' to: ' + path) else: path = locals()[item] self.percent = 0 self.logger.info('Preparing ' + item + ': ' + path) self.__dict__[item] = urllib.urlretrieve(path, reporthook=self.dldisplay)[0] self.logger.debug(path + ' is locally available as ' + self.__dict__[item])
I think maybe that block, in the base Machine class, would be a good place to insert checking for all of those, since one change there will cover all of those file types. We'd probably want to raise an exception that gets caught by the script provisioning the machine.
If we're doing this for preseed files, we might as well do kernel files, initrd files, and vm xml files. There's a block in utah/provisioni ng/provisioning .py like this:
for item in ['preseed', 'xml', 'kernel', 'initrd', 'image']:
self. __dict_ _[item] = None
path = os.path. expanduser( locals( )[item] )
self. logger. debug(' Rewriting ~-based path: ' + locals()[item] + ' to: ' + path)
else:
path = locals()[item]
self. percent = 0
self. logger. info('Preparing ' + item + ': ' + path)
self. __dict_ _[item] = urllib. urlretrieve( path, reporthook= self.dldisplay) [0]
self. logger. debug(path + ' is locally available as ' + self.__ dict__[ item])
if locals()[item] is None:
else:
if '~' in locals()[item]:
I think maybe that block, in the base Machine class, would be a good place to insert checking for all of those, since one change there will cover all of those file types. We'd probably want to raise an exception that gets caught by the script provisioning the machine.