X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=bin%2Fdb-config;fp=bin%2Fdb-config;h=af08a1308929345d05a331471a7043b29c4f8c55;hb=44e5503e7c13391778c11ebd2f3086fa985b1a2f;hp=e94eda3ab53fc16db1bbe04b3473682ebfb04449;hpb=0a44b2253322be666bf1355b50228ef31175b841;p=myplc.git diff --git a/bin/db-config b/bin/db-config index e94eda3..af08a13 100755 --- a/bin/db-config +++ b/bin/db-config @@ -20,9 +20,9 @@ def GetSnippets(directory): if os.path.exists(directory): try: filenames = os.listdir(directory) - except OSError, e: - raise Exception, "Error when opening %s (%s)" % \ - (os.path.join(dir, file), e) + except OSError as e: + raise Exception("Error when opening %s (%s)" % \ + (os.path.join(dir, file), e)) # ignore files that contain either ~ or . ignore_tokens = ("~",".") @@ -49,10 +49,10 @@ def GetSnippets(directory): ignore = True if ignore: - print "db-config: ignored %s snippet" % filename + print("db-config: ignored %s snippet" % filename) filenames = [] - keys = numberedfiles.keys() + keys = list(numberedfiles.keys()) keys.sort() for k in keys: for filename in numberedfiles[k]: @@ -74,9 +74,9 @@ def main(): (options,steps) = parser.parse_args() # Load variables into dictionaries - for category_id, (category, variablelist) in variables.iteritems(): - globals()[category_id] = dict(zip(variablelist.keys(), - [variable['value'] for variable in variablelist.values()])) + for category_id, (category, variablelist) in variables.items(): + globals()[category_id] = dict(list(zip(list(variablelist.keys()), + [variable['value'] for variable in list(variablelist.values())]))) directory="/etc/planetlab/db-config.d" snippets = GetSnippets(directory) @@ -95,16 +95,16 @@ def main(): if options.list_steps: if not options.verbose: - print snippet + print(snippet) else: - print "Found step %s/%s"%(directory,snippet) + print("Found step %s/%s"%(directory,snippet)) os.system("rpm -qf %s/%s"%(directory,snippet)) continue fullpath = os.path.join(directory, snippet) if options.verbose: - print "Running step %s"%fullpath - execfile(fullpath) + print("Running step %s"%fullpath) + exec(compile(open(fullpath).read(), fullpath, 'exec')) if __name__ == '__main__': main()