Created
October 8, 2014 21:14
-
-
Save adam-stokes/e9227d9ceb782c9a6228 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def run(self): | |
if os.path.exists(self.container_abspath): | |
log.error("Container exists, exiting.") | |
# Container exists, handle return code in installer | |
sys.exit(1) | |
self.ui.info_message( | |
"* Please wait while we generate your isolated environment ...") | |
utils.ssh_genkey() | |
self.prep_userdata() | |
utils.container_create(self.container_name, self.userdata) | |
utils.container_start(self.container_name) | |
utils.container_wait(self.container_name) | |
tries = 1 | |
while not self.cloud_init_finished(): | |
self.ui.info_message("[{0}] * Waiting for container to finalize, " | |
"please wait ... ".format(tries)) | |
time.sleep(1) | |
tries = tries + 1 | |
def save_password_and_finish(self, password): | |
self.config.save_password(password) | |
single_env = utils.load_template('juju-env/single.yaml') | |
single_env_modified = single_env.render( | |
openstack_password=self.config.openstack_password) | |
utils.spew('/tmp/single.yaml', single_env_modified) | |
utils.container_run(self.container_name, | |
'mkdir -p .juju') | |
utils.container_cp(self.container_name, | |
'/tmp/single.yaml', | |
'.juju/environments.yaml') | |
utils.container_run(self.container_name, "juju bootstrap") | |
utils.container_run(self.container_name, "cloud-status") | |
self.ui.show_password_input( | |
'Openstack Password', 'Password', self.save_password_and_finish) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment