diff --git a/buildrpm/openstack-kollacli.spec b/buildrpm/openstack-kollacli.spec
index 8de4871..d6aeda7 100644
--- a/buildrpm/openstack-kollacli.spec
+++ b/buildrpm/openstack-kollacli.spec
@@ -16,7 +16,7 @@
%{expand: %%define pyver %(python -c 'import sys;print(sys.version[0:3])')}
# Package version
-%global package_version 3.0.1
+%global package_version 4.0.0
# Kolla user name and group name (DO NOT CHANGE THESE!)
%global kolla_user kolla
diff --git a/doc/build/html/_modules/index.html b/doc/build/html/_modules/index.html
index 84f99a9..63321dc 100644
--- a/doc/build/html/_modules/index.html
+++ b/doc/build/html/_modules/index.html
@@ -6,7 +6,7 @@
- Overview: module code — kollacli 3.0.1.dev463 documentation
+ Overview: module code — kollacli 4.0.0.dev483 documentation
@@ -14,7 +14,7 @@
-
+
@@ -113,7 +113,7 @@
modules |
- kollacli 3.0.1.dev463 documentation »
+ kollacli 4.0.0.dev483 documentation »
@@ -73,8 +73,8 @@
[docs] class AsyncApi ( object ):
[docs] def async_deploy ( self , hostnames = [],
-
serial_flag = False , verbose_level = 1 ):
-
# type: (List[str], bool, int) -> Job
+
serial_flag = False , verbose_level = 1 , servicenames = []):
+
# type: (List[str], bool, int, List[str]) -> Job
"""Deploy.
Deploy containers to hosts.
@@ -85,6 +85,8 @@
:type serial_flag: boolean
:param verbose_level: the higher the number, the more verbose
:type verbose_level: integer
+
:param servicenames: services to deploy. If empty, then deploy all.
+
:type servicenames: list of strings
:return: Job object
:rtype: Job
"""
@@ -92,18 +94,23 @@
empty_ok = True , none_ok = True )
check_arg ( serial_flag , u . _ ( 'Serial flag' ), bool )
check_arg ( verbose_level , u . _ ( 'Verbose level' ), int )
+
check_arg ( servicenames , u . _ ( 'Service names' ), list ,
+
empty_ok = True , none_ok = True )
hostnames = safe_decode ( hostnames )
+
servicenames = safe_decode ( servicenames )
ansible_job = actions . deploy ( hostnames ,
-
serial_flag , verbose_level )
+
serial_flag , verbose_level , servicenames )
return Job ( ansible_job )
-
[docs] def async_upgrade ( self , verbose_level = 1 ):
-
# type: (int) -> Job
+
[docs] def async_upgrade ( self , verbose_level = 1 , servicenames = []):
+
# type: (int, List[str]) -> Job
"""Upgrade.
:param verbose_level: the higher the number, the more verbose
:type verbose_level: integer
+
:param servicenames: services to upgrade. If empty, then upgrade all.
+
:type servicenames: list of strings
:return: Job object
:rtype: Job
@@ -111,12 +118,16 @@
"openstack_release."
"""
check_arg ( verbose_level , u . _ ( 'Verbose level' ), int )
-
ansible_job = actions . upgrade ( verbose_level )
+
check_arg ( servicenames , u . _ ( 'Service names' ), list ,
+
empty_ok = True , none_ok = True )
+
servicenames = safe_decode ( servicenames )
+
+
ansible_job = actions . upgrade ( verbose_level , servicenames )
return Job ( ansible_job )
[docs] def async_host_destroy ( self , hostnames , destroy_type , verbose_level = 1 ,
-
include_data = False ):
-
# type: (List[str], str, int, bool) -> Job
+
include_data = False , remove_images = False ):
+
# type: (List[str], str, int, bool, bool) -> Job
"""Destroy Hosts.
Stops and removes all kolla related docker containers on the
@@ -130,14 +141,16 @@
:type verbose_level: integer
:param include_data: if true, destroy data containers too.
:type include_data: boolean
+
:param remove_images: if true, destroy will remove the docker images
+
:type remove_images: boolean
:return: Job object
:rtype: Job
-
"""
check_arg ( hostnames , u . _ ( 'Host names' ), list )
check_arg ( destroy_type , u . _ ( 'Destroy type' ), str )
check_arg ( verbose_level , u . _ ( 'Verbose level' ), int )
check_arg ( include_data , u . _ ( 'Include data' ), bool )
+
check_arg ( remove_images , u . _ ( 'Remove images' ), bool )
if destroy_type not in [ 'stop' , 'kill' ]:
raise InvalidArgument (
u . _ ( 'Invalid destroy type ({type}). Must be either '
@@ -148,7 +161,8 @@
inventory . validate_hostnames ( hostnames )
ansible_job = actions . destroy_hosts ( hostnames , destroy_type ,
-
verbose_level , include_data )
+
verbose_level , include_data ,
+
remove_images )
return Job ( ansible_job )
[docs] def async_host_precheck ( self , hostnames , verbose_level = 1 ):
@@ -172,6 +186,45 @@
inventory . validate_hostnames ( hostnames )
ansible_job = actions . precheck ( hostnames , verbose_level )
+
return Job ( ansible_job )
+
+
[docs] def async_host_stop ( self , hostnames , verbose_level = 1 ):
+
# type: (List[str], int) -> Job
+
"""Stop Hosts.
+
+
Stops all kolla related docker containers on the specified hosts.
+
+
:param hostnames: host names
+
:type hostnames: list
+
:param verbose_level: the higher the number, the more verbose
+
:type verbose_level: integer
+
:return: Job object
+
:rtype: Job
+
"""
+
check_arg ( hostnames , u . _ ( 'Host names' ), list )
+
check_arg ( verbose_level , u . _ ( 'Verbose level' ), int )
+
+
hostnames = safe_decode ( hostnames )
+
inventory = Inventory . load ()
+
inventory . validate_hostnames ( hostnames )
+
+
ansible_job = actions . stop_hosts ( hostnames , verbose_level )
+
return Job ( ansible_job )
+
+
@@ -206,7 +259,7 @@
modules |
- kollacli 3.0.1.dev463 documentation »
+ kollacli 4.0.0.dev483 documentation »
Module code »
diff --git a/doc/build/html/_modules/kollacli/api/client.html b/doc/build/html/_modules/kollacli/api/client.html
index 8e1b349..464f95c 100644
--- a/doc/build/html/_modules/kollacli/api/client.html
+++ b/doc/build/html/_modules/kollacli/api/client.html
@@ -6,7 +6,7 @@
- kollacli.api.client — kollacli 3.0.1.dev463 documentation
+ kollacli.api.client — kollacli 4.0.0.dev483 documentation
@@ -14,7 +14,7 @@
-
+
@@ -36,7 +36,7 @@
modules |
- kollacli 3.0.1.dev463 documentation »
+ kollacli 4.0.0.dev483 documentation »
Module code »
@@ -106,7 +106,7 @@
the updates.
"""
- def __init__ ( self ):
+ def __init__ ( self ):
self . _configure_logging ()
diff --git a/doc/build/html/_modules/kollacli/api/deploy.html b/doc/build/html/_modules/kollacli/api/deploy.html
index 06b11e1..14f9611 100644
--- a/doc/build/html/_modules/kollacli/api/deploy.html
+++ b/doc/build/html/_modules/kollacli/api/deploy.html
@@ -6,7 +6,7 @@
- kollacli.api.deploy — kollacli 3.0.1.dev463 documentation
+ kollacli.api.deploy — kollacli 4.0.0.dev483 documentation
@@ -14,7 +14,7 @@
-
+
@@ -36,7 +36,7 @@
modules |
- kollacli 3.0.1.dev463 documentation »
+ kollacli 4.0.0.dev483 documentation »
Module code »
@@ -67,7 +67,7 @@
from kollacli.common.inventory import Inventory
from kollacli.common.utils import check_arg
-LOG = logging . getLogger ( __name__ )
+LOG = logging . getLogger ( __name__ )
diff --git a/doc/build/html/_modules/kollacli/api/exceptions.html b/doc/build/html/_modules/kollacli/api/exceptions.html
index 5ad9fed..80d2e4b 100644
--- a/doc/build/html/_modules/kollacli/api/exceptions.html
+++ b/doc/build/html/_modules/kollacli/api/exceptions.html
@@ -6,7 +6,7 @@
- kollacli.api.exceptions — kollacli 3.0.1.dev463 documentation
+ kollacli.api.exceptions — kollacli 4.0.0.dev483 documentation
@@ -14,7 +14,7 @@
-
+
@@ -36,7 +36,7 @@
modules |
- kollacli 3.0.1.dev463 documentation »
+ kollacli 4.0.0.dev483 documentation »
Module code »
@@ -66,15 +66,15 @@
[docs] class ClientException ( Exception ):
"""KollaClient Base Class Exception"""
-
def __init__ ( self , message , * args ):
+
def __init__ ( self , message , * args ):
if not message :
message = u . _ ( 'An unknown exception occurred.' )
-
super ( ClientException , self ) . __init__ ( message , * args )
+
super ( ClientException , self ) . __init__ ( message , * args )
[docs] class NotInInventory ( ClientException ):
"""Not in inventory exception"""
-
def __init__ ( self , obj_type , obj_names , * args ):
+
def __init__ ( self , obj_type , obj_names , * args ):
if isinstance ( obj_names , list ):
# list of names
invalid_objs = ''
@@ -87,7 +87,7 @@
invalid_objs = obj_names
message = ( u . _ ( '{type} ({objs}) does not exist.' )
. format ( type = obj_type , objs = invalid_objs ))
-
super ( NotInInventory , self ) . __init__ ( message , * args )
+
super ( NotInInventory , self ) . __init__ ( message , * args )
[docs] class HostError ( ClientException ):
@@ -96,7 +96,7 @@
[docs] class HostsSshCheckError ( ClientException ):
"""Host failed its ssh check"""
-
def __init__ ( self , hostnames , * args ):
+
def __init__ ( self , hostnames , * args ):
failed_hosts = ''
comma = ''
for hostname in hostnames :
@@ -104,7 +104,7 @@
comma = ','
message = ( u . _ ( 'Host(s) ssh check failed: {hosts}' )
. format ( hosts = failed_hosts ))
-
super ( HostsSshCheckError , self ) . __init__ ( message , * args )
+
super ( HostsSshCheckError , self ) . __init__ ( message , * args )
[docs] class InvalidArgument ( ClientException ):
@@ -123,10 +123,10 @@
[docs] class MissingArgument ( ClientException ):
"""Missing argument"""
-
def __init__ ( self , argname , * args ):
+
def __init__ ( self , argname , * args ):
message = ( u . _ ( 'Argument is missing: {name}' )
. format ( name = argname ))
-
super ( MissingArgument , self ) . __init__ ( message , * args )
+ super ( MissingArgument , self ) . __init__ ( message , * args )
@@ -160,7 +160,7 @@
modules |
- kollacli 3.0.1.dev463 documentation »
+ kollacli 4.0.0.dev483 documentation »
Module code »
diff --git a/doc/build/html/_modules/kollacli/api/group.html b/doc/build/html/_modules/kollacli/api/group.html
index 289601d..d37101d 100644
--- a/doc/build/html/_modules/kollacli/api/group.html
+++ b/doc/build/html/_modules/kollacli/api/group.html
@@ -6,7 +6,7 @@
- kollacli.api.group — kollacli 3.0.1.dev463 documentation
+ kollacli.api.group — kollacli 4.0.0.dev483 documentation
@@ -14,7 +14,7 @@
-
+
@@ -36,7 +36,7 @@
modules |
- kollacli 3.0.1.dev463 documentation »
+ kollacli 4.0.0.dev483 documentation »
Module code »
@@ -143,7 +143,7 @@
[docs] class Group ( object ):
-
def __init__ ( self , groupname , servicenames , hostnames ):
+
def __init__ ( self , groupname , servicenames , hostnames ):
# type: (str, List[str], List[str]) -> None
self . name = groupname
self . _servicenames = servicenames
@@ -291,7 +291,7 @@
modules |
-
kollacli 3.0.1.dev463 documentation »
+
kollacli 4.0.0.dev483 documentation »
Module code »
diff --git a/doc/build/html/_modules/kollacli/api/host.html b/doc/build/html/_modules/kollacli/api/host.html
index 35ddf61..690f29a 100644
--- a/doc/build/html/_modules/kollacli/api/host.html
+++ b/doc/build/html/_modules/kollacli/api/host.html
@@ -6,7 +6,7 @@
- kollacli.api.host — kollacli 3.0.1.dev463 documentation
+ kollacli.api.host — kollacli 4.0.0.dev483 documentation
@@ -14,7 +14,7 @@
-
+
@@ -36,7 +36,7 @@
modules |
- kollacli 3.0.1.dev463 documentation »
+ kollacli 4.0.0.dev483 documentation »
Module code »
@@ -185,7 +185,7 @@
diff --git a/doc/build/html/_modules/kollacli/api/job.html b/doc/build/html/_modules/kollacli/api/job.html
index c88ff05..8d772e7 100644
--- a/doc/build/html/_modules/kollacli/api/job.html
+++ b/doc/build/html/_modules/kollacli/api/job.html
@@ -6,7 +6,7 @@
- kollacli.api.job — kollacli 3.0.1.dev463 documentation
+ kollacli.api.job — kollacli 4.0.0.dev483 documentation
@@ -14,7 +14,7 @@
-
+
@@ -36,7 +36,7 @@
modules |
- kollacli 3.0.1.dev463 documentation »
+ kollacli 4.0.0.dev483 documentation »
Module code »
@@ -64,7 +64,7 @@
[docs] class Job ( object ):
"""Job"""
-
def __init__ ( self , ansible_job ):
+
def __init__ ( self , ansible_job ):
self . _ansible_job = ansible_job
diff --git a/doc/build/html/_modules/kollacli/api/password.html b/doc/build/html/_modules/kollacli/api/password.html
index 8294a04..dff15f3 100644
--- a/doc/build/html/_modules/kollacli/api/password.html
+++ b/doc/build/html/_modules/kollacli/api/password.html
@@ -6,7 +6,7 @@
-
kollacli.api.password — kollacli 3.0.1.dev463 documentation
+
kollacli.api.password — kollacli 4.0.0.dev483 documentation
@@ -14,7 +14,7 @@
-
+
@@ -36,7 +36,7 @@
modules |
-
kollacli 3.0.1.dev463 documentation »
+
kollacli 4.0.0.dev483 documentation »
Module code »
@@ -82,7 +82,8 @@
:type value: string
"""
check_arg ( name , u . _ ( 'Password name' ), str )
- check_arg ( value , u . _ ( 'Password value' ), str , display_param = False )
+ check_arg ( value , u . _ ( 'Password value' ), str , display_param = False ,
+ empty_ok = True , none_ok = True )
set_password ( name , value )
diff --git a/doc/build/html/_modules/kollacli/api/properties.html b/doc/build/html/_modules/kollacli/api/properties.html
index ae3b3e0..a018284 100644
--- a/doc/build/html/_modules/kollacli/api/properties.html
+++ b/doc/build/html/_modules/kollacli/api/properties.html
@@ -6,7 +6,7 @@
- kollacli.api.properties — kollacli 3.0.1.dev463 documentation
+ kollacli.api.properties — kollacli 4.0.0.dev483 documentation
@@ -14,7 +14,7 @@
-
+
@@ -36,7 +36,7 @@
modules |
- kollacli 3.0.1.dev463 documentation »
+ kollacli 4.0.0.dev483 documentation »
Module code »
@@ -69,7 +69,7 @@
from kollacli.common.utils import check_arg
from kollacli.common.utils import safe_decode
-LOG = logging . getLogger ( __name__ )
+LOG = logging . getLogger ( __name__ )
GLOBAL_TYPE = 'global'
GROUP_TYPE = 'group'
@@ -202,7 +202,7 @@
- ovr_host (bool): true if property is overridden at host level
"""
- def __init__ ( self , ansible_property , override_flags ):
+ def __init__ ( self , ansible_property , override_flags ):
self . name = ansible_property . name
self . value = ansible_property . value
self . file_name = ansible_property . file_name
@@ -252,7 +252,7 @@
modules |
- kollacli 3.0.1.dev463 documentation »
+ kollacli 4.0.0.dev483 documentation »
Module code »
diff --git a/doc/build/html/_modules/kollacli/api/service.html b/doc/build/html/_modules/kollacli/api/service.html
index ba4d4fd..1dd8be7 100644
--- a/doc/build/html/_modules/kollacli/api/service.html
+++ b/doc/build/html/_modules/kollacli/api/service.html
@@ -6,7 +6,7 @@
- kollacli.api.service — kollacli 3.0.1.dev463 documentation
+ kollacli.api.service — kollacli 4.0.0.dev483 documentation
@@ -14,7 +14,7 @@
-
+
@@ -36,7 +36,7 @@
modules |
- kollacli 3.0.1.dev463 documentation »
+ kollacli 4.0.0.dev483 documentation »
Module code »
@@ -142,7 +142,7 @@
- childnames: []
"""
- def __init__ ( self , servicename , parentname = None ,
+ def __init__ ( self , servicename , parentname = None ,
childnames = [], groupnames = []):
# type: (str, str, List[str], List[str]) -> None
self . name = servicename
@@ -222,7 +222,7 @@
modules |
- kollacli 3.0.1.dev463 documentation »
+ kollacli 4.0.0.dev483 documentation »
Module code »
diff --git a/doc/build/html/_modules/kollacli/api/support.html b/doc/build/html/_modules/kollacli/api/support.html
index 2f5ecd0..09b1cb7 100644
--- a/doc/build/html/_modules/kollacli/api/support.html
+++ b/doc/build/html/_modules/kollacli/api/support.html
@@ -6,7 +6,7 @@
- kollacli.api.support — kollacli 3.0.1.dev463 documentation
+ kollacli.api.support — kollacli 4.0.0.dev483 documentation
@@ -14,7 +14,7 @@
-
+
@@ -36,7 +36,7 @@
modules |
- kollacli 3.0.1.dev463 documentation »
+ kollacli 4.0.0.dev483 documentation »
Module code »
@@ -155,7 +155,7 @@
modules |
- kollacli 3.0.1.dev463 documentation »
+ kollacli 4.0.0.dev483 documentation »
Module code »
diff --git a/doc/build/html/_modules/kollacli/commands/deploy.html b/doc/build/html/_modules/kollacli/commands/deploy.html
index a87a92d..926c5c3 100644
--- a/doc/build/html/_modules/kollacli/commands/deploy.html
+++ b/doc/build/html/_modules/kollacli/commands/deploy.html
@@ -6,7 +6,7 @@
- kollacli.commands.deploy — kollacli 3.0.1.dev463 documentation
+ kollacli.commands.deploy — kollacli 4.0.0.dev483 documentation
@@ -14,7 +14,7 @@
-
+
@@ -36,7 +36,7 @@
modules |
- kollacli 3.0.1.dev463 documentation »
+ kollacli 4.0.0.dev483 documentation »
Module code »
@@ -71,7 +71,7 @@
from cliff.command import Command
-LOG = logging . getLogger ( __name__ )
+LOG = logging . getLogger ( __name__ )
CLIENT = ClientApi ()
@@ -107,6 +107,22 @@
raise CommandError ( u . _ ( 'Timeout value is not a number.' ))
timeout_target = time . time () + ( 60 * timeout )
+ # if we are doing a targeted host deploy make sure we are doing it
+ # to only compute nodes
+ if hosts :
+ invalid_host_list = []
+ compute_group = CLIENT . group_get ([ 'compute' ])[ 0 ]
+ compute_hosts = compute_group . get_hosts ()
+ for host in hosts :
+ if host not in compute_hosts :
+ invalid_host_list . append ( host )
+ if len ( invalid_host_list ) > 0 :
+ raise CommandError (
+ u . _ ( 'Invalid hosts for host targeted deploy. '
+ 'Hosts must be in the compute group only.'
+ 'Invalid hosts: {hosts}' )
+ . format ( hosts = invalid_host_list ))
+
job = CLIENT . async_deploy ( hosts , serial_flag ,
verbose_level )
@@ -203,7 +219,7 @@
modules |
- kollacli 3.0.1.dev463 documentation »
+ kollacli 4.0.0.dev483 documentation »
Module code »
diff --git a/doc/build/html/_modules/kollacli/commands/exceptions.html b/doc/build/html/_modules/kollacli/commands/exceptions.html
index 97bbf84..1a5454f 100644
--- a/doc/build/html/_modules/kollacli/commands/exceptions.html
+++ b/doc/build/html/_modules/kollacli/commands/exceptions.html
@@ -6,7 +6,7 @@
- kollacli.commands.exceptions — kollacli 3.0.1.dev463 documentation
+ kollacli.commands.exceptions — kollacli 4.0.0.dev483 documentation
@@ -14,7 +14,7 @@
-
+
@@ -36,7 +36,7 @@
modules |
- kollacli 3.0.1.dev463 documentation »
+ kollacli 4.0.0.dev483 documentation »
Module code »
@@ -66,11 +66,11 @@
[docs] class CommandError ( Exception ):
"""CLI command error"""
-
def __init__ ( self , message , * args ):
+
def __init__ ( self , message , * args ):
prefix = u . _ ( 'ERROR: ' )
if not message . startswith ( prefix ):
message = prefix + message
-
super ( CommandError , self ) . __init__ ( message , * args )
+ super ( CommandError , self ) . __init__ ( message , * args )
@@ -104,7 +104,7 @@
modules |
- kollacli 3.0.1.dev463 documentation »
+ kollacli 4.0.0.dev483 documentation »
Module code »
diff --git a/doc/build/html/_modules/kollacli/commands/group.html b/doc/build/html/_modules/kollacli/commands/group.html
index d2902b5..9e337ad 100644
--- a/doc/build/html/_modules/kollacli/commands/group.html
+++ b/doc/build/html/_modules/kollacli/commands/group.html
@@ -6,7 +6,7 @@
- kollacli.commands.group — kollacli 3.0.1.dev463 documentation
+ kollacli.commands.group — kollacli 4.0.0.dev483 documentation
@@ -14,7 +14,7 @@
-
+
@@ -36,7 +36,7 @@
modules |
- kollacli 3.0.1.dev463 documentation »
+ kollacli 4.0.0.dev483 documentation »
Module code »
@@ -284,7 +284,7 @@
modules |
- kollacli 3.0.1.dev463 documentation »
+ kollacli 4.0.0.dev483 documentation »
Module code »
diff --git a/doc/build/html/_modules/kollacli/commands/host.html b/doc/build/html/_modules/kollacli/commands/host.html
index 1d41739..174a1b5 100644
--- a/doc/build/html/_modules/kollacli/commands/host.html
+++ b/doc/build/html/_modules/kollacli/commands/host.html
@@ -6,7 +6,7 @@
- kollacli.commands.host — kollacli 3.0.1.dev463 documentation
+ kollacli.commands.host — kollacli 4.0.0.dev483 documentation
@@ -14,7 +14,7 @@
-
+
@@ -36,7 +36,7 @@
modules |
- kollacli 3.0.1.dev463 documentation »
+ kollacli 4.0.0.dev483 documentation »
Module code »
@@ -78,7 +78,7 @@
from cliff.command import Command
from cliff.lister import Lister
-LOG = logging . getLogger ( __name__ )
+LOG = logging . getLogger ( __name__ )
CLIENT = ClientApi ()
@@ -106,7 +106,7 @@
"""Destroy.
Stops and removes all kolla related docker containers on either the
- specified host or if no host is specified, on all hosts.
+ specified host or all hosts if the hostname all is used.
"""
[docs] def get_parser ( self , prog_name ):
@@ -117,6 +117,8 @@
help = u . _ ( 'Stop rather than kill' ))
parser . add_argument ( '--includedata' , action = 'store_true' ,
help = u . _ ( 'Destroy data containers' ))
+
parser . add_argument ( '--removeimages' , action = 'store_true' ,
+
help = u . _ ( 'Remove docker images' ))
return parser
[docs] def take_action ( self , parsed_args ):
@@ -133,11 +135,24 @@
include_data = False
if parsed_args . includedata :
include_data = True
+
remove_images = False
+
if parsed_args . removeimages :
+
remove_images = True
+
if not include_data :
+
question = ( 'This will delete all containers and data'
+
', are you sure? (y/n)' )
+
answer = raw_input ( question )
+
while answer != 'y' and answer != 'n' :
+
answer = raw_input ( question )
+
if answer is 'n' :
+
LOG . info ( 'Aborting destroy' )
+
return
verbose_level = self . app . options . verbose_level
job = CLIENT . async_host_destroy ( hostnames , destroy_type ,
-
verbose_level , include_data )
+
verbose_level , include_data ,
+
remove_images )
status = job . wait ()
if verbose_level > 2 :
LOG . info ( ' \n\n ' + 80 * '=' )
@@ -343,6 +358,50 @@
return hosts_info
+[docs] class HostStop ( Command ):
+
"""Stop.
+
+
Stops all kolla related docker containers on either the
+
specified host or all hosts if the hostname all is used.
+
"""
+
+
[docs] def get_parser ( self , prog_name ):
+
parser = super ( HostStop , self ) . get_parser ( prog_name )
+
parser . add_argument ( 'hostname' , metavar = '<hostname | all>' ,
+
help = u . _ ( 'Host name or ip address or "all"' ))
+
return parser
+
+
[docs] def take_action ( self , parsed_args ):
+
try :
+
hostname = parsed_args . hostname . strip ()
+
+
hostnames = [ hostname ]
+
if hostname == 'all' :
+
hostnames = _get_all_hostnames ()
+
+
verbose_level = self . app . options . verbose_level
+
+
job = CLIENT . async_host_stop ( hostnames , verbose_level )
+
status = job . wait ()
+
if verbose_level > 2 :
+
LOG . info ( ' \n\n ' + 80 * '=' )
+
LOG . info ( u . _ ( 'DEBUG command output: \n {out}' )
+
. format ( out = job . get_console_output ()))
+
if status != 0 :
+
raise CommandError ( u . _ ( 'Job failed: \n {msg}' )
+
. format ( msg = job . get_error_message ()))
+
elif verbose_level > 1 :
+
# log any ansible warnings
+
msg = job . get_error_message ()
+
if msg :
+
LOG . warn ( msg )
+
+
except ClientException as e :
+
raise CommandError ( str ( e ))
+
except Exception as e :
+
raise Exception ( traceback . format_exc ())
+
+
def _get_all_hostnames ():
hostnames = []
hosts = CLIENT . host_get_all ()
@@ -382,7 +441,7 @@
modules |
- kollacli 3.0.1.dev463 documentation »
+ kollacli 4.0.0.dev483 documentation »
Module code »
diff --git a/doc/build/html/_modules/kollacli/commands/password.html b/doc/build/html/_modules/kollacli/commands/password.html
index 2cffdf2..49d81bb 100644
--- a/doc/build/html/_modules/kollacli/commands/password.html
+++ b/doc/build/html/_modules/kollacli/commands/password.html
@@ -6,7 +6,7 @@
- kollacli.commands.password — kollacli 3.0.1.dev463 documentation
+ kollacli.commands.password — kollacli 4.0.0.dev483 documentation
@@ -14,7 +14,7 @@
-
+
@@ -36,7 +36,7 @@
modules |
- kollacli 3.0.1.dev463 documentation »
+ kollacli 4.0.0.dev483 documentation »
Module code »
@@ -83,14 +83,18 @@
parser = super ( PasswordSet , self ) . get_parser ( prog_name )
parser . add_argument ( 'passwordname' , metavar = '<passwordname>' ,
help = u . _ ( 'Password name' ))
- parser . add_argument ( '--insecure' , nargs = '?' , help = argparse . SUPPRESS )
+ parser . add_argument ( '--insecure' , nargs = '?' , default = False ,
+ help = argparse . SUPPRESS )
return parser
[docs] def take_action ( self , parsed_args ):
try :
password_name = parsed_args . passwordname . strip ()
-
if parsed_args . insecure :
-
password = parsed_args . insecure . strip ()
+
if parsed_args . insecure is not False :
+
# --insecure flag is present
+
password = '' # nosec
+
if parsed_args . insecure :
+
password = parsed_args . insecure . strip ()
else :
password = getpass . getpass ( u . _ ( 'Password: ' )) . strip ()
passtwo = getpass . getpass ( u . _ ( 'Retype Password: ' )) . strip ()
@@ -218,7 +222,7 @@
modules |
-
kollacli 3.0.1.dev463 documentation »
+
kollacli 4.0.0.dev483 documentation »
Module code »
diff --git a/doc/build/html/_modules/kollacli/commands/property.html b/doc/build/html/_modules/kollacli/commands/property.html
index ddac1ea..fbdb530 100644
--- a/doc/build/html/_modules/kollacli/commands/property.html
+++ b/doc/build/html/_modules/kollacli/commands/property.html
@@ -6,7 +6,7 @@
- kollacli.commands.property — kollacli 3.0.1.dev463 documentation
+ kollacli.commands.property — kollacli 4.0.0.dev483 documentation
@@ -14,7 +14,7 @@
-
+
@@ -36,7 +36,7 @@
modules |
- kollacli 3.0.1.dev463 documentation »
+ kollacli 4.0.0.dev483 documentation »
Module code »
@@ -176,8 +176,8 @@
[docs] class PropertyList ( Lister ):
"""List all properties."""
-
def __init__ ( self , app , app_args , cmd_name = None ):
-
super ( Lister , self ) . __init__ ( app , app_args ,
+
def __init__ ( self , app , app_args , cmd_name = None ):
+
super ( Lister , self ) . __init__ ( app , app_args ,
cmd_name = cmd_name )
self . is_global = True
@@ -346,7 +346,7 @@
modules |
-
kollacli 3.0.1.dev463 documentation »
+
kollacli 4.0.0.dev483 documentation »
Module code »
diff --git a/doc/build/html/_modules/kollacli/commands/service.html b/doc/build/html/_modules/kollacli/commands/service.html
index f927bab..eea7a86 100644
--- a/doc/build/html/_modules/kollacli/commands/service.html
+++ b/doc/build/html/_modules/kollacli/commands/service.html
@@ -6,7 +6,7 @@
- kollacli.commands.service — kollacli 3.0.1.dev463 documentation
+ kollacli.commands.service — kollacli 4.0.0.dev483 documentation
@@ -14,7 +14,7 @@
-
+
@@ -36,7 +36,7 @@
modules |
- kollacli 3.0.1.dev463 documentation »
+ kollacli 4.0.0.dev483 documentation »
Module code »
@@ -212,7 +212,7 @@
modules |
- kollacli 3.0.1.dev463 documentation »
+ kollacli 4.0.0.dev483 documentation »
Module code »
diff --git a/doc/build/html/_modules/kollacli/commands/support.html b/doc/build/html/_modules/kollacli/commands/support.html
index 7b4087b..361d2de 100644
--- a/doc/build/html/_modules/kollacli/commands/support.html
+++ b/doc/build/html/_modules/kollacli/commands/support.html
@@ -6,7 +6,7 @@
- kollacli.commands.support — kollacli 3.0.1.dev463 documentation
+ kollacli.commands.support — kollacli 4.0.0.dev483 documentation
@@ -14,7 +14,7 @@
-
+
@@ -36,7 +36,7 @@
modules |
- kollacli 3.0.1.dev463 documentation »
+ kollacli 4.0.0.dev483 documentation »
Module code »
@@ -67,7 +67,7 @@
import tempfile
import traceback
-LOG = logging . getLogger ( __name__ )
+LOG = logging . getLogger ( __name__ )
CLIENT = ClientApi ()
@@ -119,7 +119,7 @@
modules |
- kollacli 3.0.1.dev463 documentation »
+ kollacli 4.0.0.dev483 documentation »
Module code »
diff --git a/doc/build/html/_modules/kollacli/commands/upgrade.html b/doc/build/html/_modules/kollacli/commands/upgrade.html
index 4599502..242bfcf 100644
--- a/doc/build/html/_modules/kollacli/commands/upgrade.html
+++ b/doc/build/html/_modules/kollacli/commands/upgrade.html
@@ -6,7 +6,7 @@
- kollacli.commands.upgrade — kollacli 3.0.1.dev463 documentation
+ kollacli.commands.upgrade — kollacli 4.0.0.dev483 documentation
@@ -14,7 +14,7 @@
-
+
@@ -36,7 +36,7 @@
modules |
- kollacli 3.0.1.dev463 documentation »
+ kollacli 4.0.0.dev483 documentation »
Module code »
@@ -73,19 +73,26 @@
CLIENT = ClientApi ()
-LOG = logging . getLogger ( __name__ )
+LOG = logging . getLogger ( __name__ )
[docs] class Upgrade ( Command ):
"""Upgrade."""
[docs] def get_parser ( self , prog_name ):
parser = super ( Upgrade , self ) . get_parser ( prog_name )
+
parser . add_argument ( '--services' , nargs = '?' ,
+
metavar = '<service_list>' ,
+
help = u . _ ( 'Upgrade service list' ))
return parser
[docs] def take_action ( self , parsed_args ):
+
services = None
try :
+
if parsed_args . services :
+
service_list = parsed_args . services . strip ()
+
services = service_list . split ( ',' )
verbose_level = self . app . options . verbose_level
-
job = CLIENT . async_upgrade ( verbose_level )
+
job = CLIENT . async_upgrade ( verbose_level , services )
status = job . wait ()
if verbose_level > 2 :
LOG . info ( ' \n\n ' + 80 * '=' )
@@ -132,7 +139,7 @@
modules |
-
kollacli 3.0.1.dev463 documentation »
+
kollacli 4.0.0.dev483 documentation »
Module code »
diff --git a/doc/build/html/_modules/kollacli/common/ansible/actions.html b/doc/build/html/_modules/kollacli/common/ansible/actions.html
index df21fcd..85f143f 100644
--- a/doc/build/html/_modules/kollacli/common/ansible/actions.html
+++ b/doc/build/html/_modules/kollacli/common/ansible/actions.html
@@ -6,7 +6,7 @@
-
kollacli.common.ansible.actions — kollacli 3.0.1.dev463 documentation
+
kollacli.common.ansible.actions — kollacli 4.0.0.dev483 documentation
@@ -14,7 +14,7 @@
-
+
@@ -36,7 +36,7 @@
modules |
-
kollacli 3.0.1.dev463 documentation »
+
kollacli 4.0.0.dev483 documentation »
Module code »
@@ -71,45 +71,35 @@
from kollacli.common.ansible.playbook import AnsiblePlaybook
from kollacli.common.inventory import Inventory
from kollacli.common.passwords import get_empty_password_values
-from kollacli.common import properties
from kollacli.common.properties import AnsibleProperties
from kollacli.common.utils import get_kolla_etc
from kollacli.common.utils import get_kolla_home
-from kollacli.common.utils import get_kollacli_home
from kollacli.common.utils import is_string_true
-LOG = logging . getLogger ( __name__ )
+LOG = logging . getLogger ( __name__ )
[docs] def destroy_hosts ( hostnames , destroy_type ,
-
verbose_level = 1 , include_data = False ):
+
verbose_level = 1 , include_data = False ,
+
remove_images = False ):
'''destroy containers on a set of hosts.
The containers on the specified hosts will be stopped
-
or killed. That will be determined by the destroy_type,
-
which can either be 'stop' or 'kill'.
+
or killed.
'''
-
playbook_name = 'host_destroy_no_data.yml'
-
if include_data :
-
playbook_name = 'host_destroy.yml'
+
playbook = AnsiblePlaybook ()
+
playbook_name = 'destroy.yml'
LOG . info ( u . _LI ( 'Please be patient as this may take a while.' ))
-
ansible_properties = properties . AnsibleProperties ()
-
base_distro = \
-
ansible_properties . get_property ( 'kolla_base_distro' )
-
install_type = \
-
ansible_properties . get_property ( 'kolla_install_type' )
-
container_prefix = base_distro + '-' + install_type
-
kollacli_home = get_kollacli_home ()
-
playbook = AnsiblePlaybook ()
-
playbook . playbook_path = os . path . join ( kollacli_home ,
+
kolla_home = get_kolla_home ()
+
playbook . playbook_path = os . path . join ( kolla_home ,
'ansible/' + playbook_name )
# 'hosts' is defined as 'all' in the playbook yml code, but inventory
# filtering will subset that down to the hosts in playbook.hosts.
-
playbook . extra_vars = 'prefix=' + container_prefix + \
-
' destroy_type=' + destroy_type
playbook . hosts = hostnames
+
if remove_images :
+
playbook . extra_vars = 'destroy_include_images=yes'
if verbose_level <= 1 :
playbook . print_output = False
playbook . verbose_level = verbose_level
@@ -118,7 +108,7 @@
[docs] def deploy ( hostnames = [],
-
serial_flag = False , verbose_level = 1 ):
+
serial_flag = False , verbose_level = 1 , servicenames = []):
playbook = AnsiblePlaybook ()
kolla_home = get_kolla_home ()
playbook . playbook_path = os . path . join ( kolla_home ,
@@ -126,8 +116,8 @@
playbook . extra_vars = 'action=deploy'
playbook . hosts = hostnames
playbook . serial = serial_flag
-
playbook . verbose_level = verbose_level
+
playbook . services = servicenames
_run_deploy_rules ( playbook )
@@ -149,11 +139,49 @@
playbook . hosts = hostnames
playbook . print_output = True
playbook . verbose_level = verbose_level
+
job = playbook . run ()
return job
-[docs] def upgrade ( verbose_level = 1 ):
+
[docs] def stop_hosts ( hostnames = [], verbose_level = 1 ):
+
'''stop containers on a set of hosts.
+
+
The containers on the specified hosts will be stopped
+
or killed if the stop takes over 20 seconds.
+
'''
+
playbook = AnsiblePlaybook ()
+
playbook_name = 'stop.yml'
+
LOG . info ( u . _LI ( 'Please be patient as this may take a while.' ))
+
kolla_home = get_kolla_home ()
+
playbook . playbook_path = os . path . join ( kolla_home ,
+
'ansible/' + playbook_name )
+
+
# 'hosts' is defined as 'all' in the playbook yml code, but inventory
+
# filtering will subset that down to the hosts in playbook.hosts.
+
playbook . hosts = hostnames
+
if verbose_level <= 1 :
+
playbook . print_output = False
+
playbook . verbose_level = verbose_level
+
job = playbook . run ()
+
return job
+
+
+
+
[docs] def upgrade ( verbose_level = 1 , servicenames = []):
playbook = AnsiblePlaybook ()
kolla_home = get_kolla_home ()
playbook . playbook_path = os . path . join ( kolla_home ,
@@ -161,6 +189,8 @@
playbook . extra_vars = 'action=upgrade'
playbook . print_output = True
playbook . verbose_level = verbose_level
+
playbook . services = servicenames
+
job = playbook . run ()
return job
@@ -180,23 +210,6 @@
' \n Empty passwords: '
'{keys}' ) . format ( etc = get_kolla_etc (), keys = empty_keys ))
-
# if we are doing a targeted host deploy make sure we are doing it
-
# to only compute nodes
-
if playbook . hosts :
-
inventory . validate_hostnames ( playbook . hosts )
-
host_groups = inventory . get_host_groups ()
-
invalid_host_list = []
-
for host in playbook . hosts :
-
groups = host_groups . get ( host , None )
-
if not groups or len ( groups ) != 1 or 'compute' not in groups :
-
invalid_host_list . append ( host )
-
if len ( invalid_host_list ) > 0 :
-
raise InvalidArgument (
-
u . _ ( 'Invalid hosts for host targeted deploy. '
-
'Hosts must be in the compute group only.'
-
'Invalid hosts: {hosts}' )
-
. format ( hosts = invalid_host_list ))
-
# cannot have both groups and hosts
if playbook . hosts and playbook . groups :
raise InvalidArgument (
@@ -328,7 +341,7 @@
modules |
-
kollacli 3.0.1.dev463 documentation »
+
kollacli 4.0.0.dev483 documentation »
Module code »
diff --git a/doc/build/html/_modules/kollacli/common/ansible/job.html b/doc/build/html/_modules/kollacli/common/ansible/job.html
index 4df4419..4265abb 100644
--- a/doc/build/html/_modules/kollacli/common/ansible/job.html
+++ b/doc/build/html/_modules/kollacli/common/ansible/job.html
@@ -6,7 +6,7 @@
-
kollacli.common.ansible.job — kollacli 3.0.1.dev463 documentation
+
kollacli.common.ansible.job — kollacli 4.0.0.dev483 documentation
@@ -14,7 +14,7 @@
-
+
@@ -36,7 +36,7 @@
modules |
-
kollacli 3.0.1.dev463 documentation »
+
kollacli 4.0.0.dev483 documentation »
Module code »
@@ -82,7 +82,7 @@
from kollacli.common.utils import run_cmd
from kollacli.common.utils import safe_decode
-LOG = logging . getLogger ( __name__ )
+LOG = logging . getLogger ( __name__ )
LINE_LENGTH = 80
@@ -101,7 +101,7 @@
[docs] class AnsibleJob ( object ):
"""class for running ansible commands"""
-
def __init__ ( self , cmd , deploy_id , print_output , inventory_path ):
+
def __init__ ( self , cmd , deploy_id , print_output , inventory_path ):
self . _command = cmd
self . _deploy_id = deploy_id
self . _print_output = print_output
@@ -117,9 +117,13 @@
self . _process = None
self . _process_std_err = None
self . _errors = []
+
self . _error_total = 0
+
self . _ignore_total = 0
self . _cmd_output = ''
self . _kill_uname = None
self . _ansible_lock = Lock ( get_ansible_lock_path (), 'ansible_job' )
+
self . _ignore_error_strings = None
+
self . _host_ignored_error_count = {}
[docs] def run ( self ):
try :
@@ -130,6 +134,7 @@
'ansible job: {cmd} ' )
. format ( lock = get_ansible_lock_path (), cmd = self . _command ))
+
LOG . debug ( 'playbook command: %s ' % self . _command )
# create and open named pipe, must be owned by kolla group
os . mkfifo ( self . _fifo_path )
_ , grp_id = get_admin_uids ()
@@ -187,7 +192,15 @@
else :
status = self . _process . returncode
if status != 0 :
-
status = 1
+
# if the process ran and returned a non zero return
+
# code we want to see if we got some ansible errors
+
# and if so if we ignored all the errors. if all
+
# errors are ignored we consider the job a success
+
if ( self . _error_total > 0 and
+
self . _error_total == self . _ignore_total ):
+
status = 0
+
else :
+
status = 1
if not self . _process_std_err :
# read stderr from process
std_err = self . _read_stream ( self . _process . stderr )
@@ -199,7 +212,8 @@
""""get error message"""
msg = ''
for error in self . _errors :
-
msg = '' . join ([ msg , error , ' \n ' ])
+
if error :
+
msg = '' . join ([ msg , error , ' \n ' ])
# if no error from the callback, check the process error
if ANSIBLE_1_OR_MORE in msg :
@@ -386,7 +400,17 @@
% self . _add_filler ( ' %s ' % changed [ host ], 5 , ' ' ))
hostline += ( 'unreachable= %s '
% self . _add_filler ( ' %s ' % unreachable [ host ], 5 , ' ' ))
-
hostline += 'failed= %s ' % failures [ host ]
+
failure_count = failures [ host ]
+
ignores = self . _host_ignored_error_count . get ( host , 0 )
+
+
# track the total numbers of failures and ignored failures to help
+
# determine job success
+
self . _error_total += failure_count
+
self . _ignore_total += ignores
+
failure_count -= ignores
+
hostline += ( 'failed= %s ' %
+
self . _add_filler ( ' %s ' % failure_count , 5 , ' ' ))
+
hostline += 'ignored= %s ' % ignores
msg += hostline
return msg
@@ -398,12 +422,21 @@
results_dict = packet [ 'results' ]
taskname = packet [ 'task' ][ 'name' ]
-
# update saved error messages
-
self . _errors . append ( self . _format_error ( taskname , host ,
-
status , results_dict ))
-
# format log message
-
results = json . dumps ( results_dict )
-
msg = 'fatal: [ %s ]: %s ! => %s ' % ( host , status . upper (), results )
+
# update saved error messages. if the error message should be
+
# hidden then do not add it to _errors and add to the ignored
+
# error count for the host
+
formatted_error = self . _format_error ( taskname , host ,
+
status , results_dict )
+
if self . _hide_ignored_errors ( formatted_error ):
+
LOG . debug ( 'Ignored Error: ' + formatted_error )
+
self . _host_ignored_error_count [ host ] = \
+
self . _host_ignored_error_count . get ( host , 0 ) + 1
+
else :
+
self . _errors . append ( formatted_error )
+
# format log message
+
results = json . dumps ( results_dict )
+
msg = 'fatal: [ %s ]: %s ! => %s ' % \
+
( host , status . upper (), results )
return msg
def _format_task_start ( self , packet ):
@@ -511,7 +544,17 @@
LOG . error ( 'invalid string for json encoding: %s ' % string_var )
if raise_on_err :
raise e
-
return retval
+ return retval
+
+ def _hide_ignored_errors ( self , error_string ):
+ if self . _ignore_error_strings is not None :
+ for ignore_string in self . _ignore_error_strings :
+ pattern = re . compile ( ignore_string )
+ match = pattern . findall ( error_string )
+ if match :
+ return True
+
+ return False
@@ -545,7 +588,7 @@
modules |
- kollacli 3.0.1.dev463 documentation »
+ kollacli 4.0.0.dev483 documentation »
Module code »
diff --git a/doc/build/html/_modules/kollacli/common/ansible/playbook.html b/doc/build/html/_modules/kollacli/common/ansible/playbook.html
index c29b9a0..e8681b4 100644
--- a/doc/build/html/_modules/kollacli/common/ansible/playbook.html
+++ b/doc/build/html/_modules/kollacli/common/ansible/playbook.html
@@ -6,7 +6,7 @@
- kollacli.common.ansible.playbook — kollacli 3.0.1.dev463 documentation
+ kollacli.common.ansible.playbook — kollacli 4.0.0.dev483 documentation
@@ -14,7 +14,7 @@
-
+
@@ -36,7 +36,7 @@
modules |
- kollacli 3.0.1.dev463 documentation »
+ kollacli 4.0.0.dev483 documentation »
Module code »
@@ -66,7 +66,6 @@
import kollacli.i18n as u
-from kollacli.api.exceptions import NotInInventory
from kollacli.common.ansible.job import AnsibleJob
from kollacli.common.utils import get_admin_user
from kollacli.common.utils import get_ansible_command
@@ -76,7 +75,7 @@
from kollacli.common.inventory import Inventory
-LOG = logging . getLogger ( __name__ )
+LOG = logging . getLogger ( __name__ )
[docs] class AnsiblePlaybook ( object ):
@@ -89,6 +88,7 @@
hosts = None # type: List[str]
groups = None # type: List[str]
services = None # type: List[str]
+
ignore_error_strings = None # type: List[str]
serial = False
deploy_id = None # type: str
inventory = None # type: Inventory
@@ -104,6 +104,7 @@
# create and run the job
job = AnsibleJob ( cmd , self . deploy_id ,
self . print_output , inventory_path )
+
job . _ignore_error_strings = self . ignore_error_strings
job . run ()
return job
@@ -136,7 +137,9 @@
flag = ''
# verbose levels: 1=not verbose, 2=more verbose
if self . verbose_level > 1 :
-
flag = '-vvv'
+
flag = '-'
+
for x in range ( 1 , self . verbose_level ):
+
flag += 'v'
ansible_cmd = get_ansible_command ( playbook = True )
admin_user = get_admin_user ()
@@ -165,12 +168,23 @@
first = True
for service in self . services :
if not first :
-
service_string = service_string + ','
+
service_string += ','
else :
first = False
service_string = service_string + service
cmd += ' --tags %s ' % service_string
+
if self . hosts :
+
host_string = ''
+
first = True
+
for host in self . hosts :
+
if not first :
+
host_string += ','
+
else :
+
first = False
+
host_string = host_string + host
+
cmd += ' --limit %s ' % host_string
+
if self . flush_cache :
cmd += ' --flush-cache'
return cmd
@@ -184,18 +198,6 @@
and status from deployments back to the kolla code.
"""
inventory_filter = {}
-
if self . hosts :
-
for hostname in self . hosts :
-
host = self . inventory . get_host ( hostname )
-
if not host :
-
raise NotInInventory ( u . _ ( 'Host' ), hostname )
-
inventory_filter [ 'deploy_hosts' ] = self . hosts
-
elif self . groups :
-
for groupname in self . groups :
-
group = self . inventory . get_group ( groupname )
-
if not group :
-
raise NotInInventory ( u . _ ( 'Group' ), groupname )
-
inventory_filter [ 'deploy_groups' ] = self . groups
inventory_path = \
self . inventory . create_json_gen_file ( inventory_filter )
@@ -252,7 +254,7 @@
modules |
-
kollacli 3.0.1.dev463 documentation »
+
kollacli 4.0.0.dev483 documentation »
Module code »
diff --git a/doc/build/html/_modules/kollacli/common/inventory.html b/doc/build/html/_modules/kollacli/common/inventory.html
index cbdb3fd..9dc6f58 100644
--- a/doc/build/html/_modules/kollacli/common/inventory.html
+++ b/doc/build/html/_modules/kollacli/common/inventory.html
@@ -6,7 +6,7 @@
- kollacli.common.inventory — kollacli 3.0.1.dev463 documentation
+ kollacli.common.inventory — kollacli 4.0.0.dev483 documentation
@@ -14,7 +14,7 @@
-
+
@@ -36,7 +36,7 @@
modules |
- kollacli 3.0.1.dev463 documentation »
+ kollacli 4.0.0.dev483 documentation »
Module code »
@@ -104,7 +104,7 @@
# these groups cannot be deleted, they are required by kolla
PROTECTED_GROUPS = [ COMPUTE_GRP_NAME ]
-LOG = logging . getLogger ( __name__ )
+LOG = logging . getLogger ( __name__ )
[docs] def remove_temp_inventory ( path ):
@@ -128,13 +128,13 @@
2: (v2.1.1) added ceilometer
1: (v2.0.1) initial release
"""
-
def __init__ ( self ):
+
def __init__ ( self ):
self . _groups = {} # kv = name:object
self . _hosts = {} # kv = name:object
self . _services = {} # kv = name:object
self . _sub_services = {} # kv = name:object
self . vars = {}
-
self . version = self . __class__ . class_version
+
self . version = self . __class__ . class_version
self . remote_mode = True
# initialize the inventory to its defaults
@@ -166,7 +166,7 @@
sub_svc . set_parent_servicename ( svc . name )
# update the version and save upgraded inventory file
-
self . version = self . __class__ . class_version
+
self . version = self . __class__ . class_version
Inventory . save ( self )
def _upgrade_services ( self ):
@@ -336,7 +336,6 @@
"""setup multiple hosts
hosts_info is a dict of format:
-
{'hostname1': {
'password': password
'uname': user_name
@@ -832,7 +831,7 @@
modules |
- kollacli 3.0.1.dev463 documentation »
+ kollacli 4.0.0.dev483 documentation »
Module code »
diff --git a/doc/build/html/_modules/kollacli/common/passwords.html b/doc/build/html/_modules/kollacli/common/passwords.html
index 8b83cdf..2566890 100644
--- a/doc/build/html/_modules/kollacli/common/passwords.html
+++ b/doc/build/html/_modules/kollacli/common/passwords.html
@@ -6,7 +6,7 @@
- kollacli.common.passwords — kollacli 3.0.1.dev463 documentation
+ kollacli.common.passwords — kollacli 4.0.0.dev483 documentation
@@ -14,7 +14,7 @@
-
+
@@ -36,7 +36,7 @@
modules |
- kollacli 3.0.1.dev463 documentation »
+ kollacli 4.0.0.dev483 documentation »
Module code »
@@ -76,7 +76,12 @@
If the password name exists, it will be changed.
If it doesn't exist, a new password will be added.
"""
- cmd = ' %s -k %s -v %s ' % ( _get_cmd_prefix (), pwd_key , pwd_value )
+ value_switch = '-v'
+ if not pwd_value :
+ pwd_value = ''
+ value_switch = ''
+ cmd = ' %s -k %s %s %s ' % ( _get_cmd_prefix (), pwd_key , value_switch ,
+ pwd_value )
err_msg , output = utils . run_cmd ( cmd , print_output = False )
if err_msg :
raise FailedOperation (
@@ -182,7 +187,7 @@
modules |
- kollacli 3.0.1.dev463 documentation »
+ kollacli 4.0.0.dev483 documentation »
Module code »
diff --git a/doc/build/html/_modules/kollacli/common/properties.html b/doc/build/html/_modules/kollacli/common/properties.html
index ea3c81b..04da97a 100644
--- a/doc/build/html/_modules/kollacli/common/properties.html
+++ b/doc/build/html/_modules/kollacli/common/properties.html
@@ -6,7 +6,7 @@
- kollacli.common.properties — kollacli 3.0.1.dev463 documentation
+ kollacli.common.properties — kollacli 4.0.0.dev483 documentation
@@ -14,7 +14,7 @@
-
+
@@ -36,7 +36,7 @@
modules |
- kollacli 3.0.1.dev463 documentation »
+ kollacli 4.0.0.dev483 documentation »
Module code »
@@ -76,7 +76,7 @@
from kollacli.common.utils import get_kolla_home
from kollacli.common.utils import sync_read_file
-LOG = logging . getLogger ( __name__ )
+LOG = logging . getLogger ( __name__ )
ALLVARS_PATH = 'ansible/group_vars/all.yml'
GLOBALS_PATH = 'ansible/group_vars/__GLOBAL__'
@@ -86,7 +86,7 @@
[docs] class AnsibleProperties ( object ):
-
def __init__ ( self ):
+
def __init__ ( self ):
"""initialize ansible property information
property information is pulled from the following files
@@ -405,7 +405,7 @@
[docs] class AnsibleProperty ( object ):
-
def __init__ ( self , name , value , file_name , overrides = False ,
+
def __init__ ( self , name , value , file_name , overrides = False ,
orig_value = None , prop_type = 'global' , target = None ):
self . name = name
self . value = value
@@ -418,7 +418,7 @@
[docs] class OverrideFlags ( object ):
-
def __init__ ( self ):
+
def __init__ ( self ):
self . ovr_global = False
self . ovr_group = False
self . ovr_host = False
@@ -455,7 +455,7 @@
modules |
- kollacli 3.0.1.dev463 documentation »
+ kollacli 4.0.0.dev483 documentation »
Module code »
diff --git a/doc/build/html/_modules/kollacli/common/sshutils.html b/doc/build/html/_modules/kollacli/common/sshutils.html
index 2f00b8c..3aaa5f2 100644
--- a/doc/build/html/_modules/kollacli/common/sshutils.html
+++ b/doc/build/html/_modules/kollacli/common/sshutils.html
@@ -6,7 +6,7 @@
- kollacli.common.sshutils — kollacli 3.0.1.dev463 documentation
+ kollacli.common.sshutils — kollacli 4.0.0.dev483 documentation
@@ -14,7 +14,7 @@
-
+
@@ -36,7 +36,7 @@
modules |
- kollacli 3.0.1.dev463 documentation »
+ kollacli 4.0.0.dev483 documentation »
Module code »
@@ -74,7 +74,7 @@
MIN_DOCKER_VERSION = '1.8.1'
-LOG = logging . getLogger ( __name__ )
+LOG = logging . getLogger ( __name__ )
diff --git a/doc/build/html/_modules/kollacli/common/support.html b/doc/build/html/_modules/kollacli/common/support.html
index 7a7fe66..d3d6288 100644
--- a/doc/build/html/_modules/kollacli/common/support.html
+++ b/doc/build/html/_modules/kollacli/common/support.html
@@ -6,7 +6,7 @@
- kollacli.common.support — kollacli 3.0.1.dev463 documentation
+ kollacli.common.support — kollacli 4.0.0.dev483 documentation
@@ -14,7 +14,7 @@
-
+
@@ -36,7 +36,7 @@
modules |
- kollacli 3.0.1.dev463 documentation »
+ kollacli 4.0.0.dev483 documentation »
Module code »
@@ -73,12 +73,12 @@
from kollacli.common.utils import get_kollacli_etc
from kollacli.common.utils import run_cmd
-LOG = logging . getLogger ( __name__ )
+LOG = logging . getLogger ( __name__ )
diff --git a/doc/build/html/_modules/kollacli/common/utils.html b/doc/build/html/_modules/kollacli/common/utils.html
index ba38133..ce64b05 100644
--- a/doc/build/html/_modules/kollacli/common/utils.html
+++ b/doc/build/html/_modules/kollacli/common/utils.html
@@ -6,7 +6,7 @@
- kollacli.common.utils — kollacli 3.0.1.dev463 documentation
+ kollacli.common.utils — kollacli 4.0.0.dev483 documentation
@@ -14,7 +14,7 @@
-
+
@@ -36,7 +36,7 @@
modules |
- kollacli 3.0.1.dev463 documentation »
+ kollacli 4.0.0.dev483 documentation »
Module code »
@@ -77,7 +77,7 @@
from kollacli.api.exceptions import InvalidArgument
from kollacli.api.exceptions import MissingArgument
-LOG = logging . getLogger ( __name__ )
+LOG = logging . getLogger ( __name__ )
[docs] def get_log_level ():
@@ -176,6 +176,14 @@
[docs] def get_setup_user ():
return os . environ . get ( "KOLLA_CLI_SETUP_USER" , "root" )
+
+
[docs] def get_lock_enabled ():
+
evar = os . environ . get ( 'KOLLA_CLI_LOCK' , 'true' )
+
if evar . lower () == 'false' :
+
return False
+
else :
+
return True
+
[docs] def get_ansible_command ( playbook = False ):
"""get a python2 ansible command
@@ -222,10 +230,9 @@
"""run a system command
return:
-
- err_msg: empty string=command succeeded
-
not None=command failed
-
- output: string: all the output of the run command
-
+
- err_msg: empty string=command succeeded
+
not None=command failed
+
- output: string: all the output of the run command
"""
err = None
output = None
@@ -274,11 +281,13 @@
del file_pwds [ pname ]
else :
# edit
-
if pvalue :
-
file_pwds [ pname ] = pvalue
-
elif private_key :
+
if private_key :
file_pwds [ pname ] = { 'private_key' : private_key ,
'public_key' : public_key }
+
else :
+
if not pvalue :
+
pvalue = None
+
file_pwds [ pname ] = pvalue
write_data = yaml . safe_dump ( file_pwds , default_flow_style = False )
sync_write_file ( file_path , write_data )
@@ -348,13 +357,14 @@
"""
lock = None
try :
-
lock = Lock ( path , 'sync_read' )
-
locked = lock . wait_acquire ()
-
if not locked :
-
raise Exception (
-
u . _ ( 'unable to read file {path} '
-
'as it was locked.' )
-
. format ( path = path ))
+
if get_lock_enabled ():
+
lock = Lock ( path , 'sync_read' )
+
locked = lock . wait_acquire ()
+
if not locked :
+
raise Exception (
+
u . _ ( 'unable to read file {path} '
+
'as it was locked.' )
+
. format ( path = path ))
with open ( path , mode ) as data_file :
data = data_file . read ()
finally :
@@ -368,21 +378,22 @@
ansible_lock = None
lock = None
try :
-
ansible_lock = Lock ( get_ansible_lock_path (), 'sync_write' )
-
locked = ansible_lock . wait_acquire ()
-
if not locked :
-
raise Exception (
-
u . _ ( 'unable to get ansible lock while writing to {path} '
-
'as it was locked.' )
-
. format ( path = path ))
+
if get_lock_enabled ():
+
ansible_lock = Lock ( get_ansible_lock_path (), 'sync_write' )
+
locked = ansible_lock . wait_acquire ()
+
if not locked :
+
raise Exception (
+
u . _ ( 'unable to get ansible lock while writing to {path} '
+
'as it was locked.' )
+
. format ( path = path ))
-
lock = Lock ( path , 'sync_write' )
-
locked = lock . wait_acquire ()
-
if not locked :
-
raise Exception (
-
u . _ ( 'unable to write file {path} '
-
'as it was locked.' )
-
. format ( path = path ))
+
lock = Lock ( path , 'sync_write' )
+
locked = lock . wait_acquire ()
+
if not locked :
+
raise Exception (
+
u . _ ( 'unable to write file {path} '
+
'as it was locked.' )
+
. format ( path = path ))
with open ( path , mode ) as data_file :
data_file . write ( data )
finally :
@@ -502,7 +513,7 @@
works then it seems better / less complicated for our needs.
"""
-
def __init__ ( self , lockpath , owner = 'unknown owner' , use_flock = True ):
+
def __init__ ( self , lockpath , owner = 'unknown owner' , use_flock = True ):
self . lockpath = lockpath
self . pid = str ( os . getpid ())
self . fd = None
@@ -665,7 +676,7 @@
modules |
-
kollacli 3.0.1.dev463 documentation »
+
kollacli 4.0.0.dev483 documentation »
Module code »
diff --git a/doc/build/html/_modules/kollacli/shell.html b/doc/build/html/_modules/kollacli/shell.html
index 5593a81..1140ff5 100644
--- a/doc/build/html/_modules/kollacli/shell.html
+++ b/doc/build/html/_modules/kollacli/shell.html
@@ -6,7 +6,7 @@
-
kollacli.shell — kollacli 3.0.1.dev463 documentation
+
kollacli.shell — kollacli 4.0.0.dev483 documentation
@@ -14,7 +14,7 @@
-
+
@@ -36,7 +36,7 @@
modules |
-
kollacli 3.0.1.dev463 documentation »
+
kollacli 4.0.0.dev483 documentation »
Module code »
@@ -75,14 +75,14 @@
from kollacli.common.inventory import INVENTORY_PATH
from kollacli.common.utils import get_kollacli_etc
-LOG = logging . getLogger ( __name__ )
+LOG = logging . getLogger ( __name__ )
VERSION = '0.3'
[docs] class KollaCli ( App ):
-
def __init__ ( self ):
-
super ( KollaCli , self ) . __init__ (
+
def __init__ ( self ):
+
super ( KollaCli , self ) . __init__ (
description = u . _ ( 'Command-Line Client for OpenStack Kolla' ),
version = VERSION ,
command_manager = CommandManager ( 'kolla.cli' ),
@@ -111,7 +111,7 @@
shell = KollaCli ()
return shell . run ( argv )
-if __name__ == "__main__" :
+if __name__ == "__main__" :
sys . exit ( main ( sys . argv [ 1 :]))
@@ -146,7 +146,7 @@
modules |
- kollacli 3.0.1.dev463 documentation »
+ kollacli 4.0.0.dev483 documentation »
Module code »
diff --git a/doc/build/html/_static/pygments.css b/doc/build/html/_static/pygments.css
index 8213e90..20c4814 100644
--- a/doc/build/html/_static/pygments.css
+++ b/doc/build/html/_static/pygments.css
@@ -47,8 +47,10 @@
.highlight .mh { color: #208050 } /* Literal.Number.Hex */
.highlight .mi { color: #208050 } /* Literal.Number.Integer */
.highlight .mo { color: #208050 } /* Literal.Number.Oct */
+.highlight .sa { color: #4070a0 } /* Literal.String.Affix */
.highlight .sb { color: #4070a0 } /* Literal.String.Backtick */
.highlight .sc { color: #4070a0 } /* Literal.String.Char */
+.highlight .dl { color: #4070a0 } /* Literal.String.Delimiter */
.highlight .sd { color: #4070a0; font-style: italic } /* Literal.String.Doc */
.highlight .s2 { color: #4070a0 } /* Literal.String.Double */
.highlight .se { color: #4070a0; font-weight: bold } /* Literal.String.Escape */
@@ -59,7 +61,9 @@
.highlight .s1 { color: #4070a0 } /* Literal.String.Single */
.highlight .ss { color: #517918 } /* Literal.String.Symbol */
.highlight .bp { color: #007020 } /* Name.Builtin.Pseudo */
+.highlight .fm { color: #06287e } /* Name.Function.Magic */
.highlight .vc { color: #bb60d5 } /* Name.Variable.Class */
.highlight .vg { color: #bb60d5 } /* Name.Variable.Global */
.highlight .vi { color: #bb60d5 } /* Name.Variable.Instance */
+.highlight .vm { color: #bb60d5 } /* Name.Variable.Magic */
.highlight .il { color: #208050 } /* Literal.Number.Integer.Long */
\ No newline at end of file
diff --git a/doc/build/html/genindex.html b/doc/build/html/genindex.html
index 1a067f3..e1b6f04 100644
--- a/doc/build/html/genindex.html
+++ b/doc/build/html/genindex.html
@@ -7,7 +7,7 @@
- Index — kollacli 3.0.1.dev463 documentation
+ Index — kollacli 4.0.0.dev483 documentation
@@ -15,7 +15,7 @@
-
+
@@ -140,12 +140,12 @@
AllInOne (class in kollacli.common.allinone)
-
-
AnsibleJob (class in kollacli.common.ansible.job)
+
+
AnsiblePlaybook (class in kollacli.common.ansible.playbook)
@@ -171,6 +171,14 @@
+ async_host_stop() (kollacli.api.async.AsyncApi method)
+
+
+
+ async_reconfigure() (kollacli.api.async.AsyncApi method)
+
+
+
async_upgrade() (kollacli.api.async.AsyncApi method)
@@ -558,6 +566,10 @@
get_kollacli_home() (in module kollacli.common.utils)
+
+ get_lock_enabled() (in module kollacli.common.utils)
+
+
@@ -652,6 +664,10 @@
+ (kollacli.commands.host.HostStop method)
+
+
+
(kollacli.commands.password.PasswordClear method)
@@ -916,6 +932,10 @@
HostsSshCheckError
+
+ HostStop (class in kollacli.commands.host)
+
+
@@ -923,6 +943,10 @@