def update_ssh_conf(self):
     if not Utilities.file_exists(self.SSH_CONF_FILEPATH):
         print "ssh conf file does not exist at " + self.SSH_CONF_FILEPATH
         return
         
     # TODO: Check whether the entries exist before appending (for each host)
     conf_file = open(self.SSH_CONF_FILEPATH, 'a')
     conf_file.write("    UserKnownHostsFile /dev/null\n")
     conf_file.write("    StrictHostKeyChecking no\n")
     conf_file.close()
 def update_vcld_conf(self):
     if not Utilities.file_exists(self.VCLD_CONF_FILEPATH):
         print "vcld conf file does not exist at " + self.VCLD_CONF_FILEPATH
         return        
         
     file_handler, abs_path = mkstemp()
 
     old_file = open(self.VCLD_CONF_FILEPATH)
     temp_file = open(abs_path, 'w')
 
     for line in old_file:
         words = line.split('=')
         if len(words) <= 1:
             temp_file.write(line)
             continue
         
         key, value = line.split('=')
         if key.strip() not in self.parameters:
             temp_file.write(line)
             continue
 
         value = self.parameters[key.strip()]
         temp_file.write("%s=%s\n" % (key.strip(), value))
     
     old_file.close()
     temp_file.close()
     close(file_handler)
     
     # Copy from the temp file to secrets.php (so as not to loose the 
     # file permissions on secrets.php
     conf_file = open(self.VCLD_CONF_FILEPATH, 'w')
     temp_file = open(abs_path)
 
     for line in temp_file:
         conf_file.write(line)
 
     conf_file.close()