Example #1
0
 def _resolve_special(self, section, option, value_gotten, auto_pw):
     if value_gotten and len(value_gotten):
         if section == 'passwords':
             #ensure we store it as a password
             key = self._makekey(section, option)
             self.pws[key] = value_gotten
         return value_gotten
     if section == 'host' and option == 'ip':
         LOG.debug("Host ip from configuration/environment was empty, programatically attempting to determine it.")
         netifc = self.get("default", "net_interface") or "eth0"
         netifcs = netifc.split(",")
         usefulnetifcs = list()
         for ifc in netifcs:
             ifc = ifc.strip()
             if ifc:
                 usefulnetifcs.append(ifc)
         (host_ip, netifc) = utils.get_host_ip(usefulnetifcs, settings.IPV4)
         LOG.debug("Determined host ip to be: \"%s\" from network interface: %s" % (host_ip, netifc))
         return host_ip
     elif section == 'passwords':
         if auto_pw:
             key = self._makekey(section, option)
             LOG.debug("Being forced to ask for password for \"%s\" since the configuration value is empty.", key)
             prompt = PW_PROMPTS.get(option)
             if not prompt:
                 prompt = PW_TMPL % (key)
             pw = sh.password(prompt)
             self.pws[key] = pw
             return pw
         else:
             return value_gotten
     else:
         return value_gotten
Example #2
0
 def _resolve_value(self, section, option, value_gotten):
     if section == 'host' and option == 'ip':
         LOG.debug(
             "Host ip from configuration/environment was empty, programatically attempting to determine it."
         )
         value_gotten = utils.get_host_ip()
         LOG.debug("Determined your host ip to be: %r" % (value_gotten))
     return value_gotten
Example #3
0
 def _resolve_value(self, section, option, value_gotten, auto_pw):
     key = make_id(section, option)
     if section in PW_SECTIONS and key not in self.pws and value_gotten:
         self.pws[key] = value_gotten
     if section == 'host' and option == 'ip':
         LOG.debug("Host ip from configuration/environment was empty, programatically attempting to determine it.")
         value_gotten = utils.get_host_ip()
         LOG.debug("Determined your host ip to be: [%s]" % (value_gotten))
     if section in PW_SECTIONS and auto_pw and not value_gotten:
         LOG.debug("Being forced to ask for password for [%s] since the configuration value is empty.", key)
         value_gotten = sh.password(PW_PROMPTS.get(option, PW_TMPL % (key)))
         self.pws[key] = value_gotten
     return value_gotten
Example #4
0
 def _resolve_special(self, section, option, value_gotten, auto_pw):
     key = self._makekey(section, option)
     if value_gotten and len(value_gotten):
         if section == 'passwords':
             self.pws[key] = value_gotten
     elif section == 'host' and option == 'ip':
         LOG.debug("Host ip from configuration/environment was empty, programatically attempting to determine it.")
         value_gotten = utils.get_host_ip()
         LOG.debug("Determined your host ip to be: \"%s\"" % (value_gotten))
     elif section == 'passwords' and auto_pw:
         LOG.debug("Being forced to ask for password for \"%s\" since the configuration value is empty.", key)
         prompt = PW_PROMPTS.get(option, PW_TMPL % (key))
         value_gotten = sh.password(prompt)
         self.pws[key] = value_gotten
     return value_gotten
Example #5
0
 def _resolve_special(self, section, option, value_gotten):
     if value_gotten and len(value_gotten):
         if section == 'passwords':
             #ensure we store it as a password
             key = self._makekey(section, option)
             self.pws[key] = value_gotten
         return value_gotten
     if section == 'host' and option == 'ip':
         LOG.debug("Host ip from configuration/environment was empty, programatically attempting to determine it.")
         netifc = self.get("default", "net_interface") or "eth0"
         netifc = netifc.strip()
         host_ip = utils.get_host_ip(netifc, settings.IPV4)
         LOG.debug("Determined host ip to be: \"%s\" from network interface: %s" % (host_ip, netifc))
         return host_ip
     elif section == 'passwords':
         key = self._makekey(section, option)
         LOG.debug("Being forced to ask for password for \"%s\" since the configuration/environment value is empty.", key)
         pw = sh.password(PW_TMPL % (key))
         self.pws[key] = pw
         return pw
     else:
         return value_gotten
Example #6
0
 def _resolve_value(self, section, option, value_gotten):
     if section == 'host' and option == 'ip':
         LOG.debug("Host ip from configuration/environment was empty, programatically attempting to determine it.")
         value_gotten = utils.get_host_ip()
         LOG.debug("Determined your host ip to be: [%s]" % (value_gotten))
     return value_gotten