Skip to content
This repository has been archived by the owner on Apr 12, 2021. It is now read-only.

Commit

Permalink
Fixes #595
Browse files Browse the repository at this point in the history
Signed-off-by: Adam Stokes <battlemidget@users.noreply.github.com>
  • Loading branch information
Adam Stokes committed Jan 23, 2017
1 parent fd4ccd2 commit b449578
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 13 deletions.
7 changes: 3 additions & 4 deletions conjureup/controllers/controllerpicker/gui.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import petname

from conjureup import async, controllers, juju
from conjureup import async, controllers, juju, utils
from conjureup.app_config import app
from conjureup.telemetry import track_exception, track_screen
from conjureup.ui.views.ControllerListView import ControllerListView
Expand All @@ -23,7 +21,8 @@ def finish(self, controller):
return controllers.use('clouds').render()

app.current_controller = controller
app.current_model = petname.Name()
app.current_model = "{}-{}".format(app.env['CONJURE_UP_SPELL'],
utils.gen_hash())
async.submit(self.__add_model,
self.__handle_exception,
queue_name=juju.JUJU_ASYNC_QUEUE)
Expand Down
7 changes: 3 additions & 4 deletions conjureup/controllers/newcloud/gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
from functools import partial
from subprocess import check_output

import petname

from conjureup import async, controllers, juju, utils
from conjureup.api.models import model_info
from conjureup.app_config import app
Expand Down Expand Up @@ -136,10 +134,11 @@ def render(self):
track_screen("Cloud Creation")

if app.current_controller is None:
app.current_controller = petname.Name()
app.current_controller = "conjure-up-{}".format(utils.gen_hash())

if app.current_model is None:
app.current_model = 'conjure-up'
app.current_model = "{}-{}".format(app.env['CONJURE_UP_SPELL'],
utils.gen_hash())

# LXD is a special case as we want to make sure a bridge
# is configured. If not we'll bring up a new view to allow
Expand Down
8 changes: 3 additions & 5 deletions conjureup/controllers/newcloud/tui.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
import sys
from subprocess import PIPE

import petname

from conjureup import controllers, juju, utils
from conjureup.api.models import model_info
from conjureup.app_config import app
Expand Down Expand Up @@ -45,12 +43,12 @@ def finish(self):
return controllers.use('deploy').render()

def render(self):

if app.current_controller is None:
app.current_controller = petname.Name()
app.current_controller = "conjure-up-{}".format(utils.gen_hash())

if app.current_model is None:
app.current_model = 'conjure-up'
app.current_model = "{}-{}".format(app.env['CONJURE_UP_SPELL'],
utils.gen_hash())

if app.current_cloud != 'localhost':
if not common.try_get_creds(app.current_cloud):
Expand Down
7 changes: 7 additions & 0 deletions conjureup/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import os
import pty
import shutil
import uuid
from subprocess import (
DEVNULL,
PIPE,
Expand Down Expand Up @@ -355,3 +356,9 @@ def get_options_whitelist(service_name):
svc_opts_whitelist = options_whitelist.get(service_name, [])

return svc_opts_whitelist


def gen_hash():
""" generates a UUID
"""
return str(uuid.uuid4()).split('-')[0]

0 comments on commit b449578

Please sign in to comment.