def install(self, reinstall=False): if common.check_dir(self.install_path): if not reinstall: raise AlreadyInstalledException() else: common.remove_dir(self.install_path) if not common.mkdir_p(self.install_path): LOG.error("Could not create installation path, %s" % self.install_path) self.abort() if not common.install_system_package("curl git python-dev python-pip"): LOG.error("Could not install basic packages") self.abort() if not common.install_python_package("virtualenv", with_sudo=True): LOG.error("Could not install virtualenv") self.abort() venv_path = "%s/%s" % (self.install_path, ".venv") if not common.install_virtual_env("(_@/)", venv_path): LOG.error("Could not create virtualenv") self.abort() if not common.enter_virtualenv(venv_path): LOG.error("Could not enter virtualenv") self.abort() packages = ["pip", "distribute", "eventlet", "pexpect", "rackspace-novaclient"] if not common.install_python_package(packages): LOG.error("Could not install %s" % packages) self.abort() pkg = "github.com/openstack/python-novaclient.git" if not common.install_git_package(pkg, "python-novaclient"): LOG.error("Could not install %s" % pkg) self.abort() pkg = "github.com/emonty/rackspace-auth-openstack.git" if not common.install_git_package(pkg, "rackspace-auth-openstack"): LOG.error("Could not install %s" % pkg) self.abort() pkg = "github.com/major/supernova.git" if not common.install_git_package(pkg, "supernova"): LOG.error("Could not install %s" % pkg) self.abort() pkg = self.inova_repo if not common.install_git_package(pkg, "inova-login"): LOG.error("Could not install %s" % pkg) self.abort()
def configure_keyring(self): LOG.info("Configuring keyring") sn_conf = "%s/.supernova" % common.get_home() if not common.check_file(sn_conf): LOG.error("No supernova conf found. Cannot configure") return False sn = ConfigParser.ConfigParser() sn.readfp(open(sn_conf)) if not sn.has_section("snail"): LOG.error("Supernova conf isn't a snail conf: " + "can't safely continue") return False venv_path = "%s/%s" % (self.install_path, ".venv") if not common.check_venv() and not common.enter_virtualenv(venv_path): LOG.error("Could not enter virtualenv") self.abort() snail_conf = "%s/snail.conf" % common.get_home() if not common.check_file(snail_conf): LOG.error("Could not locate snail.conf") self.abort() snail_config = ConfigParser.ConfigParser() snail_config.readfp(open(snail_conf)) sso = common.get_confirmed_password("Enter your SSO") for section in sn.sections(): if not sn.has_option(section, "type"): continue pw_type = "prompt" if snail_config.has_section(section) and snail_config.has_option(section, "pw_type"): pw_type = snail_config.get(section, "pw_type") do_prompt = pw_type == "prompt" prompt_msg = "Please enter your password" for k, v in sn.items(section): if v == "USE_KEYRING": pw = pw_type if pw_type == "sso": pw = sso if do_prompt: try: pw = common.get_confirmed_password(prompt_msg) except EOFError: LOG.error("Caught CTRL+D. Aborting") if DEBUG: exit(1) self.abort() scommon.pexpect_supernova(section, k.upper(), pw, verbose=self.verbose, noop=self.noop) scommon.pexpect_inovalogin(sso, verbose=self.verbose, noop=self.noop) LOG.info("If you did not like what you saw, rerun with --refresh") return True