X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=conf_files.py;h=c5d5924741f7aa6146b1d4f5c7b0cb5e0e607fc4;hb=60395dfb9481a673f89cab677a7ed764042152e2;hp=d584c2afa322497939ff02178c3a3f48c3663e27;hpb=355187f3cecaac06024d5819ac3bcbb304b09a37;p=nodemanager.git diff --git a/conf_files.py b/conf_files.py index d584c2a..c5d5924 100644 --- a/conf_files.py +++ b/conf_files.py @@ -29,7 +29,7 @@ class conf_files: def system(self, cmd): if not self.noscripts and cmd: logger.log('conf_files: running command %s' % cmd) - return os.system(cmd) + return tools.fork_as(None, os.system, cmd) else: return 0 def update_conf_file(self, cf_rec): @@ -39,8 +39,16 @@ class conf_files: if dest == '/etc/proper/propd.conf': return err_cmd = cf_rec['error_cmd'] mode = string.atoi(cf_rec['file_permissions'], base=8) - uid = pwd.getpwnam(cf_rec['file_owner'])[2] - gid = grp.getgrnam(cf_rec['file_group'])[2] + try: + uid = pwd.getpwnam(cf_rec['file_owner'])[2] + except: + logger.log('conf_files: cannot find user %s -- %s not updated'%(cf_rec['file_owner'],dest)) + return + try: + gid = grp.getgrnam(cf_rec['file_group'])[2] + except: + logger.log('conf_files: cannot find group %s -- %s not updated'%(cf_rec['file_group'],dest)) + return url = 'https://%s/%s' % (self.config.PLC_BOOT_HOST, cf_rec['source']) try: contents = curlwrapper.retrieve(url, self.config.cacert) @@ -96,7 +104,7 @@ if __name__ == '__main__': parser = optparse.OptionParser() parser.add_option('-f', '--config', action='store', dest='config', default='/etc/planetlab/plc_config', help='PLC configuration file') parser.add_option('-k', '--session', action='store', dest='session', default='/etc/planetlab/session', help='API session key (or file)') - parser.add_option('--noscripts', action='store', dest='noscripts', default=False, help='Do not run pre- or post-install scripts') + parser.add_option('--noscripts', action='store_true', dest='noscripts', default=False, help='Do not run pre- or post-install scripts') (options, args) = parser.parse_args() # Load /etc/planetlab/plc_config