From ea06c4fe72f4af11308692c85fd6d54bf06bfb40 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Tue, 8 Sep 2009 20:55:15 -0400 Subject: Get important details from the config file --- rpmbuild-remote.py | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/rpmbuild-remote.py b/rpmbuild-remote.py index 6142861..49afeb3 100644 --- a/rpmbuild-remote.py +++ b/rpmbuild-remote.py @@ -88,7 +88,22 @@ def read_preferences(options): ('host', 'str'), ('port', 'int'), ) - system = {} + config = ConfigParser.SafeConfigParser() + config.read(options.config) + system = read_section(config, options.system, values) + if system == {}: + system = read_section(config, 'default', values) + if 'user' not in system: + system['user'] = options.user + if 'ssh_key' not in system: + system['ssh_key'] = options.ssh_key + if 'host' not in system: + if options.host is None: + LOG.error("Host not set") + sys.exit(1) + system['host'] = options.host + if 'port' not in system: + system['port'] = options.port return system def main(): -- cgit