summaryrefslogtreecommitdiffstats
path: root/cobbler/action_enchant.py
diff options
context:
space:
mode:
authormdehaan@mdehaan.rdu.redhat.com <>2006-12-20 16:14:33 -0500
committerJim Meyering <jim@meyering.net>2006-12-20 16:14:33 -0500
commit0d066d73282e0168fe0406f5ad7493941d8f1d73 (patch)
tree07e9274c2bb69ffc1c7879ab57845123a544edba /cobbler/action_enchant.py
parentfca6b79cb38ce5670eb29ee40fe1e52e66b5ce18 (diff)
downloadthird_party-cobbler-0d066d73282e0168fe0406f5ad7493941d8f1d73.tar.gz
third_party-cobbler-0d066d73282e0168fe0406f5ad7493941d8f1d73.tar.xz
third_party-cobbler-0d066d73282e0168fe0406f5ad7493941d8f1d73.zip
Hack to deal with not caching SSH known hosts values.
Diffstat (limited to 'cobbler/action_enchant.py')
-rw-r--r--cobbler/action_enchant.py16
1 files changed, 15 insertions, 1 deletions
diff --git a/cobbler/action_enchant.py b/cobbler/action_enchant.py
index ff6fc06..b77eabf 100644
--- a/cobbler/action_enchant.py
+++ b/cobbler/action_enchant.py
@@ -42,11 +42,13 @@ class Enchant:
if profile is not None and self.config.profiles().find(profile) is None:
raise cexceptions.CobblerException("enchant_failed","profile name not found")
+
def ssh_exec(self,cmd,catch_fail=True):
"""
Invoke an SSH command.
+ -o 'HostKeyAlias NoHostKeyStorage'
"""
- cmd2 = "ssh -o 'StrictHostKeyChecking=no' root@%s %s" % (self.address,cmd)
+ cmd2 = "ssh -o 'StrictHostKeyChecking=no' -o 'HostKeyAlias nocobblerhostkey' root@%s %s" % (self.address,cmd)
print "running: %s" % cmd2
rc = sub_process.call(cmd2,shell=True)
print "returns: %d" % rc
@@ -57,6 +59,18 @@ class Enchant:
"""
Replace the OS of a remote system.
"""
+
+ # clean out known hosts file to eliminate conflicts
+ known_hosts = open("/root/.ssh/known_hosts","r")
+ data = known_hosts.read()
+ known_hosts.close()
+ known_hosts = open("/root/.ssh/known_hosts","w+")
+ for line in data.split("\n"):
+ if not line.startswith("nocobblerhostkey"):
+ known_hosts.write(line)
+ known_hosts.write("\n")
+ known_hosts.close()
+
koan = os.path.basename(self.settings.koan_path)
where_is_koan = os.path.join(self.settings.webdir,os.path.basename(koan))
if not os.path.exists(where_is_koan) or os.path.isdir(where_is_koan):