Ejemplo n.º 1
0
def create_context(context_name, cloud_name, use_later=False):
    try:
        ctx.create_context(context_name, cloud_name)
    except ctx.ContextExistsException as e:
        raise CLIError(e)
    except CloudNotRegisteredException as e:
        raise CLIError(e)
    if not use_later:
        ctx.set_active_context(context_name)
Ejemplo n.º 2
0
def create_context(context_name, cloud_name, use_later=False):
    try:
        ctx.create_context(context_name, cloud_name)
    except ctx.ContextExistsException as e:
        raise CLIError(e)
    except CloudNotRegisteredException as e:
        raise CLIError(e)
    if not use_later:
        ctx.set_active_context(context_name)
Ejemplo n.º 3
0
def activate_context(context_name):
    try:
        ctx.set_active_context(context_name)
    except ctx.ContextNotFoundException as e:
        raise CLIError(e)
Ejemplo n.º 4
0
 def test_set_active_context_not_exists(self):
     context_name = 'mynewcontext'
     # We haven't created the context yet so it doesn't exist
     with self.assertRaises(ContextNotFoundException):
         set_active_context(context_name, skip_set_active_subsciption=True)
Ejemplo n.º 5
0
 def test_set_active_context_not_exists(self):
     context_name = 'mynewcontext'
     # We haven't created the context yet so it doesn't exist
     with self.assertRaises(ContextNotFoundException):
         set_active_context(context_name, skip_set_active_subsciption=True)
Ejemplo n.º 6
0
def activate_context(context_name):
    try:
        ctx.set_active_context(context_name)
    except ctx.ContextNotFoundException as e:
        raise CLIError(e)