diff options
author | Sol Jerome <sol.jerome@gmail.com> | 2011-01-31 09:40:56 -0600 |
---|---|---|
committer | Sol Jerome <sol.jerome@gmail.com> | 2011-01-31 09:40:56 -0600 |
commit | 8dae884cba115d4013d3038d8b97d6e840d48d88 (patch) | |
tree | 5764cb094752f2c237dba02cfbecb640e127aee8 | |
parent | 27a4fb9b2ffcd635aa5c7cf9ce454e1a943c1a96 (diff) | |
download | bcfg2-8dae884cba115d4013d3038d8b97d6e840d48d88.tar.gz bcfg2-8dae884cba115d4013d3038d8b97d6e840d48d88.tar.bz2 bcfg2-8dae884cba115d4013d3038d8b97d6e840d48d88.zip |
SSHbase: Fix hang when file not present on client
Signed-off-by: Sol Jerome <sol.jerome@gmail.com>
-rw-r--r-- | doc/appendix/guides/import-existing-ssh-keys.txt | 2 | ||||
-rw-r--r-- | src/lib/Server/Plugins/SSHbase.py | 10 |
2 files changed, 8 insertions, 4 deletions
diff --git a/doc/appendix/guides/import-existing-ssh-keys.txt b/doc/appendix/guides/import-existing-ssh-keys.txt index d3befec26..e606ba908 100644 --- a/doc/appendix/guides/import-existing-ssh-keys.txt +++ b/doc/appendix/guides/import-existing-ssh-keys.txt @@ -88,7 +88,7 @@ stats and insert it as host-specific copies of these files in for key in ssh_host_rsa_key ssh_host_dsa_key ssh_host_key; do sudo bcfg2-admin pull <clientname> Path /etc/ssh/$key - sudo bcfg2-admin pull <clientname> Path /etc/ssh/${key}.pub + sudo bcfg2-admin pull <clientname> Path /etc/ssh/$key.pub done This for loop pulls data that was collected by the bcfg2 client out of diff --git a/src/lib/Server/Plugins/SSHbase.py b/src/lib/Server/Plugins/SSHbase.py index 6d68ecb0a..96a444875 100644 --- a/src/lib/Server/Plugins/SSHbase.py +++ b/src/lib/Server/Plugins/SSHbase.py @@ -274,6 +274,10 @@ class SSHbase(Bcfg2.Server.Plugin.Plugin, # specific will always be host specific filename = "%s/%s.H_%s" % (self.data, entry['name'].split('/')[-1], specific.hostname) - open(filename, 'w').write(entry['text']) - if log: - print "Wrote file %s" % filename + try: + open(filename, 'w').write(entry['text']) + if log: + print "Wrote file %s" % filename + except KeyError: + self.logger.error("Failed to pull %s. This file does not currently " + "exist on the client" % entry.get('name')) |