From e88008fef62328953b60b7670a69f517eae2ea6f Mon Sep 17 00:00:00 2001 From: "Chris St. Pierre" Date: Mon, 21 May 2012 11:21:40 -0400 Subject: made SSLCA respect info.xml --- src/sbin/bcfg2-info | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'src/sbin/bcfg2-info') diff --git a/src/sbin/bcfg2-info b/src/sbin/bcfg2-info index e09b7ed87..70e327ef3 100755 --- a/src/sbin/bcfg2-info +++ b/src/sbin/bcfg2-info @@ -108,11 +108,13 @@ def displayTrace(trace, num=80, sort=('time', 'calls')): class infoCore(cmd.Cmd, Bcfg2.Server.Core.Core): """Main class for bcfg2-info.""" - def __init__(self, repo, plgs, passwd, encoding, event_debug, filemonitor='default'): + def __init__(self, repo, plgs, passwd, encoding, event_debug, + cfile='/etc/bcfg2.conf', filemonitor='default'): cmd.Cmd.__init__(self) try: Bcfg2.Server.Core.Core.__init__(self, repo, plgs, passwd, - encoding, filemonitor=filemonitor) + encoding, cfile=cfile, + filemonitor=filemonitor) if event_debug: self.fam.debug = True except Bcfg2.Server.Core.CoreInitError: @@ -590,12 +592,15 @@ if __name__ == '__main__': prof = profile.Profile() loop = prof.runcall(infoCore, setup['repo'], setup['plugins'], setup['password'], setup['encoding'], - setup['event debug'], setup['filemonitor']) + setup['event debug'], cfile=setup['configfile'], + filemonitor=setup['filemonitor']) displayTrace(prof) else: if setup['profile']: print("Profiling functionality not available.") loop = infoCore(setup['repo'], setup['plugins'], setup['password'], - setup['encoding'], setup['event debug'], setup['filemonitor']) + setup['encoding'], setup['event debug'], + cfile=setup['configfile'], + filemonitor=setup['filemonitor']) loop.Run(setup['args']) -- cgit v1.2.3-1-g7c22 From b147ac47c4820737d112ad7ce7047e31ef68f732 Mon Sep 17 00:00:00 2001 From: "Chris St. Pierre" Date: Tue, 22 May 2012 10:51:58 -0400 Subject: added -f flag to bcfg2-info buildall --- src/sbin/bcfg2-info | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) (limited to 'src/sbin/bcfg2-info') diff --git a/src/sbin/bcfg2-info b/src/sbin/bcfg2-info index 70e327ef3..1f41ba6b8 100755 --- a/src/sbin/bcfg2-info +++ b/src/sbin/bcfg2-info @@ -259,15 +259,23 @@ class infoCore(cmd.Cmd, Bcfg2.Server.Core.Core): self.help_builddir() def do_buildall(self, args): - if len(args.split()) != 1: - print("Usage: buildall ") + alist = args.split() + for arg in alist: + if arg == '-f': + alist.remove('-f') + flags = [arg] + if len(alist) != 1: + print("Usage: buildall [-f] ") return - try: - os.mkdir(args) - except: - pass + if not os.path.exists(alist[0]): + try: + os.mkdir(alist[0]) + except OSError: + err = sys.exc_info()[1] + logger.error("Could not create %s: %s" % (alist[0], err)) for client in self.metadata.clients: - self.do_build("%s %s/%s.xml" % (client, args, client)) + self.do_build("%s %s %s/%s.xml" % (" ".join(flags), + client, args, client)) def do_buildfile(self, args): """Build a config file for client.""" -- cgit v1.2.3-1-g7c22 From cc5328915f2faa96a24ec8dab343e6cf7e9bdefd Mon Sep 17 00:00:00 2001 From: "Chris St. Pierre" Date: Tue, 22 May 2012 10:55:50 -0400 Subject: bcfg2-info builddir requires "interactive" flag --- src/sbin/bcfg2-info | 41 ++++++++++++++++++++--------------------- 1 file changed, 20 insertions(+), 21 deletions(-) (limited to 'src/sbin/bcfg2-info') diff --git a/src/sbin/bcfg2-info b/src/sbin/bcfg2-info index 1f41ba6b8..4dc6349a0 100755 --- a/src/sbin/bcfg2-info +++ b/src/sbin/bcfg2-info @@ -567,27 +567,26 @@ if __name__ == '__main__': optinfo = { 'configfile': Bcfg2.Options.CFILE, 'help': Bcfg2.Options.HELP, - } - optinfo.update({ - 'event debug': Bcfg2.Options.DEBUG, - 'profile': Bcfg2.Options.CORE_PROFILE, - 'encoding': Bcfg2.Options.ENCODING, - # Server options - 'repo': Bcfg2.Options.SERVER_REPOSITORY, - 'plugins': Bcfg2.Options.SERVER_PLUGINS, - 'password': Bcfg2.Options.SERVER_PASSWORD, - 'mconnect': Bcfg2.Options.SERVER_MCONNECT, - 'filemonitor': Bcfg2.Options.SERVER_FILEMONITOR, - 'location': Bcfg2.Options.SERVER_LOCATION, - 'static': Bcfg2.Options.SERVER_STATIC, - 'key': Bcfg2.Options.SERVER_KEY, - 'cert': Bcfg2.Options.SERVER_CERT, - 'ca': Bcfg2.Options.SERVER_CA, - 'password': Bcfg2.Options.SERVER_PASSWORD, - 'protocol': Bcfg2.Options.SERVER_PROTOCOL, - # More options - 'logging': Bcfg2.Options.LOGGING_FILE_PATH - }) + 'event debug': Bcfg2.Options.DEBUG, + 'profile': Bcfg2.Options.CORE_PROFILE, + 'encoding': Bcfg2.Options.ENCODING, + # Server options + 'repo': Bcfg2.Options.SERVER_REPOSITORY, + 'plugins': Bcfg2.Options.SERVER_PLUGINS, + 'password': Bcfg2.Options.SERVER_PASSWORD, + 'mconnect': Bcfg2.Options.SERVER_MCONNECT, + 'filemonitor': Bcfg2.Options.SERVER_FILEMONITOR, + 'location': Bcfg2.Options.SERVER_LOCATION, + 'static': Bcfg2.Options.SERVER_STATIC, + 'key': Bcfg2.Options.SERVER_KEY, + 'cert': Bcfg2.Options.SERVER_CERT, + 'ca': Bcfg2.Options.SERVER_CA, + 'password': Bcfg2.Options.SERVER_PASSWORD, + 'protocol': Bcfg2.Options.SERVER_PROTOCOL, + # More options + 'logging': Bcfg2.Options.LOGGING_FILE_PATH, + 'interactive': Bcfg2.Options.INTERACTIVE, + } setup = Bcfg2.Options.OptionParser(optinfo) setup.hm = "Usage:\n %s\n%s" % (setup.buildHelpMessage(), USAGE) -- cgit v1.2.3-1-g7c22 From 503ea9de36d74ac6d7ad564d04a923a016592ccd Mon Sep 17 00:00:00 2001 From: "Chris St. Pierre" Date: Mon, 4 Jun 2012 17:36:27 -0400 Subject: fixed bcfg2-info buildall without -f --- src/sbin/bcfg2-info | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/sbin/bcfg2-info') diff --git a/src/sbin/bcfg2-info b/src/sbin/bcfg2-info index 4dc6349a0..e0fb0b475 100755 --- a/src/sbin/bcfg2-info +++ b/src/sbin/bcfg2-info @@ -260,10 +260,11 @@ class infoCore(cmd.Cmd, Bcfg2.Server.Core.Core): def do_buildall(self, args): alist = args.split() + flags = [] for arg in alist: if arg == '-f': alist.remove('-f') - flags = [arg] + flags.append(arg) if len(alist) != 1: print("Usage: buildall [-f] ") return -- cgit v1.2.3-1-g7c22 From 33e36dd2ac03c71c47e8c1841c50ca35c7ef94d4 Mon Sep 17 00:00:00 2001 From: "Chris St. Pierre" Date: Thu, 14 Jun 2012 17:03:07 -0400 Subject: better error message from bcfg2-info packagesources without a hostname --- src/sbin/bcfg2-info | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/sbin/bcfg2-info') diff --git a/src/sbin/bcfg2-info b/src/sbin/bcfg2-info index e0fb0b475..656532155 100755 --- a/src/sbin/bcfg2-info +++ b/src/sbin/bcfg2-info @@ -514,6 +514,9 @@ class infoCore(cmd.Cmd, Bcfg2.Server.Core.Core): print(" %s" % "\n ".join(unknown)) def do_packagesources(self, args): + if not args: + print("Usage: packagesources ") + return try: metadata = self.build_metadata(args) except Bcfg2.Server.Plugins.Metadata.MetadataConsistencyError: -- cgit v1.2.3-1-g7c22