diff options
author | Ben Boeckel <MathStuf@gmail.com> | 2009-09-08 20:55:15 -0400 |
---|---|---|
committer | Ben Boeckel <MathStuf@gmail.com> | 2009-09-08 20:55:15 -0400 |
commit | ea06c4fe72f4af11308692c85fd6d54bf06bfb40 (patch) | |
tree | ec75d4f3f084c387cfb11ebeba08e04b7df7b41e /rpmbuild-remote.py | |
parent | 9485b1b08edbcd61d0a77fe2c8d85ada57b646ef (diff) | |
download | rpmbuild-remote-ea06c4fe72f4af11308692c85fd6d54bf06bfb40.tar.gz rpmbuild-remote-ea06c4fe72f4af11308692c85fd6d54bf06bfb40.tar.xz rpmbuild-remote-ea06c4fe72f4af11308692c85fd6d54bf06bfb40.zip |
Get important details from the config file
Diffstat (limited to 'rpmbuild-remote.py')
-rw-r--r-- | rpmbuild-remote.py | 17 |
1 files changed, 16 insertions, 1 deletions
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(): |