Add postdeploy action
add postdeploy action to post deploy on deploy node Change-Id: I7bc8e8a76304c2d86de8805195cfac3876cf6983 Co-Authored-By: caoyuan <cao.yuan@99cloud.net>
This commit is contained in:
parent
dba696be89
commit
4ec395490c
|
@ -100,6 +100,22 @@ class ControlPlaneApi(object):
|
|||
ansible_job = actions.upgrade(verbose_level, servicenames)
|
||||
return Job(ansible_job)
|
||||
|
||||
@staticmethod
|
||||
def postdeploy(verbose_level=1):
|
||||
"""Post-Deploy.
|
||||
|
||||
Do post deploy on deploy node.
|
||||
|
||||
:param verbose_level: the higher the number, the more verbose
|
||||
:type verbose_level: integer
|
||||
:return: Job object
|
||||
:rtype: Job
|
||||
"""
|
||||
check_arg(verbose_level, u._('Verbose level'), int)
|
||||
|
||||
ansible_job = actions.postdeploy(verbose_level)
|
||||
return Job(ansible_job)
|
||||
|
||||
@staticmethod
|
||||
def reconfigure(verbose_level=1):
|
||||
# type: (int) -> Job
|
||||
|
|
|
@ -150,12 +150,24 @@ class Upgrade(Command):
|
|||
raise Exception(traceback.format_exc())
|
||||
|
||||
|
||||
class PostDeploy(Command):
|
||||
"""Do post deploy on deploy node."""
|
||||
|
||||
def take_action(self, parsed_args):
|
||||
verbose_level = self.app.options.verbose_level
|
||||
try:
|
||||
job = CLIENT.postdeploy(verbose_level)
|
||||
status = job.wait()
|
||||
handers_action_result(job, status, verbose_level)
|
||||
except Exception:
|
||||
raise Exception(traceback.format_exc())
|
||||
|
||||
|
||||
class CertificateInit(Command):
|
||||
"""Generates self-signed certificate"""
|
||||
|
||||
def take_action(self, parsed_args):
|
||||
verbose_level = self.app.options.verbose_level
|
||||
|
||||
try:
|
||||
job = CLIENT.certificate_init(verbose_level)
|
||||
|
||||
|
|
|
@ -11,11 +11,10 @@
|
|||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import logging
|
||||
import os
|
||||
|
||||
import kolla_cli.i18n as u
|
||||
|
||||
from kolla_cli.api.exceptions import InvalidArgument
|
||||
from kolla_cli.api.exceptions import InvalidConfiguration
|
||||
from kolla_cli.api.exceptions import NotInInventory
|
||||
|
@ -27,6 +26,7 @@ from kolla_cli.common.utils import get_admin_user
|
|||
from kolla_cli.common.utils import get_kolla_ansible_home
|
||||
from kolla_cli.common.utils import get_kolla_etc
|
||||
from kolla_cli.common.utils import is_string_true
|
||||
import kolla_cli.i18n as u
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
|
@ -175,6 +175,20 @@ def upgrade(verbose_level=1, servicenames=[]):
|
|||
return job
|
||||
|
||||
|
||||
def postdeploy(verbose_level=1):
|
||||
playbook = AnsiblePlaybook()
|
||||
playbook_name = 'post-deploy.yml'
|
||||
kolla_home = get_kolla_ansible_home()
|
||||
playbook.playbook_path = os.path.join(kolla_home,
|
||||
'ansible/' + playbook_name)
|
||||
playbook.verbose_level = verbose_level
|
||||
playbook.local_only = True
|
||||
playbook.become_user = get_admin_user()
|
||||
|
||||
job = playbook.run()
|
||||
return job
|
||||
|
||||
|
||||
def _run_deploy_rules(playbook):
|
||||
properties = AnsibleProperties()
|
||||
inventory = Inventory.load()
|
||||
|
|
|
@ -17,11 +17,10 @@ import os
|
|||
import traceback
|
||||
|
||||
from kolla_cli.common.ansible.job import AnsibleJob
|
||||
from kolla_cli.common.inventory import Inventory
|
||||
from kolla_cli.common.utils import get_ansible_command
|
||||
from kolla_cli.common.utils import get_kolla_etc
|
||||
|
||||
from kolla_cli.common.inventory import Inventory
|
||||
|
||||
MYPY = False
|
||||
if MYPY:
|
||||
from typing import List # noqa
|
||||
|
|
|
@ -52,6 +52,7 @@ kolla.cli =
|
|||
password_list = kolla_cli.commands.password:PasswordList
|
||||
password_set = kolla_cli.commands.password:PasswordSet
|
||||
password_setkey = kolla_cli.commands.password:PasswordSetKey
|
||||
postdeploy = kolla_cli.commands.kolla_action:PostDeploy
|
||||
property_clear = kolla_cli.commands.property:PropertyClear
|
||||
property_list = kolla_cli.commands.property:PropertyList
|
||||
property_set = kolla_cli.commands.property:PropertySet
|
||||
|
|
Loading…
Reference in New Issue