Some pep8 changes

This commit is contained in:
Derek Higgins
2012-12-19 12:07:35 -05:00
parent e13d229a38
commit 1e49623682
2 changed files with 36 additions and 26 deletions

View File

@@ -10,7 +10,7 @@ PUPPET_DIR = os.path.join(basedefs.DIR_PROJECT_DIR, "puppet")
PUPPET_TEMPLATE_DIR = os.path.join(PUPPET_DIR, "templates")
class NovaConfig(object):
"""
"""
Helper class to create puppet manifest entries for nova_config
"""
def __init__(self):
@@ -25,19 +25,20 @@ class NovaConfig(object):
return entry
entry += "nova_config{\n"
for k,v in self.options.items():
entry += ' "%s": value => "%s";\n'%(k,v)
for k, v in self.options.items():
entry += ' "%s": value => "%s";\n' % (k, v)
entry += "}"
return entry
class ManifestFiles(object):
def __init__(self):
self.filelist = []
# continuous manifest file that have the same marker can be
# continuous manifest file that have the same marker can be
# installed in parallel, if on different servers
def addFile(self, filename, marker):
for f,p in self.filelist:
for f, p in self.filelist:
if f == filename:
return
self.filelist.append((filename, marker,))
@@ -46,9 +47,11 @@ class ManifestFiles(object):
return [f for f in self.filelist]
manifestfiles = ManifestFiles()
def getManifestTemplate(template_name):
with open(os.path.join(PUPPET_TEMPLATE_DIR, template_name)) as fp:
return fp.read()%controller.CONF
return fp.read() % controller.CONF
def appendManifestFile(manifest_name, data, marker=''):
if not os.path.exists(basedefs.PUPPET_MANIFEST_DIR):
@@ -58,10 +61,11 @@ def appendManifestFile(manifest_name, data, marker=''):
with open(manifestfile, 'a') as fp:
fp.write("\n")
fp.write(data)
def gethostlist(CONF):
hosts = []
for key,value in CONF.items():
for key, value in CONF.items():
if key.endswith("_HOST"):
value = value.split('/')[0]
if value not in hosts: