Add get deploy mode action
Change-Id: I53af08a97c2ba2b4d07cc0778814985834fb4a27
This commit is contained in:
parent
f467c033e7
commit
6b03977fd7
|
@ -208,3 +208,19 @@ class ControlPlaneApi(object):
|
|||
inventory = Inventory.load()
|
||||
inventory.set_deploy_mode(remote_mode)
|
||||
Inventory.save(inventory)
|
||||
|
||||
@staticmethod
|
||||
def get_deploy_mode():
|
||||
"""Get deploy mode from either local or remote.
|
||||
|
||||
Local indicates that the openstack deployment will be
|
||||
to the local host. Remote means that the deployment is
|
||||
executed via ssh.
|
||||
|
||||
NOTE: local mode is not supported and should never be used
|
||||
in production environments.
|
||||
"""
|
||||
inventory = Inventory.load()
|
||||
remote_mode = inventory.remote_mode
|
||||
deploy_mode = 'remote' if remote_mode else 'local'
|
||||
return deploy_mode
|
||||
|
|
|
@ -56,3 +56,21 @@ class Setdeploy(Command):
|
|||
raise e
|
||||
except Exception:
|
||||
raise Exception(traceback.format_exc())
|
||||
|
||||
|
||||
class Getdeploy(Command):
|
||||
"""get deploy mode from either local or remote.
|
||||
|
||||
Local indicates that the openstack deployment will be
|
||||
to the local host. Remote means that the deployment is
|
||||
on remote hosts.
|
||||
"""
|
||||
|
||||
def take_action(self, parsed_args):
|
||||
try:
|
||||
mode = CLIENT.get_deploy_mode()
|
||||
return mode
|
||||
except CommandError as e:
|
||||
raise e
|
||||
except Exception:
|
||||
raise Exception(traceback.format_exc())
|
||||
|
|
|
@ -35,6 +35,7 @@ kolla.cli =
|
|||
deploy = kolla_cli.commands.kolla_action:Deploy
|
||||
dump = kolla_cli.commands.support:Dump
|
||||
genconfig = kolla_cli.commands.kolla_action:Genconfig
|
||||
getdeploy = kolla_cli.commands.mode:Getdeploy
|
||||
group_add = kolla_cli.commands.group:GroupAdd
|
||||
group_addhost = kolla_cli.commands.group:GroupAddhost
|
||||
group_listhosts = kolla_cli.commands.group:GroupListhosts
|
||||
|
|
Loading…
Reference in New Issue