Added support to execute upgrade from cli.

Jira-Issue: OPENSTACK-589
This commit is contained in:
Borne Mace 2016-02-10 09:20:20 -08:00
parent 223c1e2471
commit 04e47b66d6
3 changed files with 51 additions and 1 deletions

View File

@ -0,0 +1,38 @@
# Copyright(c) 2016, Oracle and/or its affiliates. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# 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 traceback
import kollacli.i18n as u
from kollacli.common.ansible.actions import upgrade
from cliff.command import Command
LOG = logging.getLogger(__name__)
class Upgrade(Command):
"""Upgrade"""
def get_parser(self, prog_name):
parser = super(Upgrade, self).get_parser(prog_name)
return parser
def take_action(self, parsed_args):
verbose_level = self.app.options.verbose_level
try:
upgrade(verbose_level)
except Exception:
raise Exception(traceback.format_exc())

View File

@ -103,6 +103,17 @@ def precheck(hostname, verbose_level=1):
playbook.run()
def upgrade(verbose_level=1):
playbook = AnsiblePlaybook()
kolla_home = get_kolla_home()
playbook.playbook_path = os.path.join(kolla_home,
'ansible/site.yml')
playbook.extra_vars = 'action=upgrade'
playbook.print_output = True
playbook.verbose_level = verbose_level
playbook.run()
def _run_deploy_rules():
# check that ring files are in /etc/kolla/config/swift if
# swift is enabled

View File

@ -1,6 +1,6 @@
[metadata]
name = kollacli
version = 0.1
version = 0.2
description-file =
README.rst
@ -56,6 +56,7 @@ kolla.cli =
service_listgroups = kollacli.commands.service:ServiceListGroups
service_removegroup = kollacli.commands.service:ServiceRemoveGroup
setdeploy = kollacli.commands.deploy:Setdeploy
upgrade = kollacli.commands.upgrade:Upgrade
[extract_messages]
keywords = _ gettext ngettext l_ lazy_gettext