update kollacli with latest kottos changes

- remove all references to blaze

Jira-Issue: OSTACKDEV-89
This commit is contained in:
Steve Noyes 2016-05-09 17:55:12 -04:00
parent 5e29f905aa
commit 0b69fa5eba
23 changed files with 92 additions and 94 deletions

View File

@ -4,7 +4,7 @@ KollaCLI
The following steps can be used to build / run the kollacli
* install blaze
* install kottos
* virtualenv .venv
* . .venv/bin/activate
* pip install -r requirements.txt

View File

@ -16,7 +16,7 @@
%{expand: %%define pyver %(python -c 'import sys;print(sys.version[0:3])')}
# Package version
%global package_version 4.0
%global package_version 4.0.1
# Kolla user name and group name (DO NOT CHANGE THESE!)
%global kolla_user kolla
@ -124,7 +124,7 @@ esac
%changelog
* Tue Apr 26 2016 - Steve Noyes <steve.noyes@oracle.com>
- remove blaze components
- remove non-cli components
* Wed Apr 13 2016 - Steve Noyes <steve.noyes@oracle.com>
- add kolla-ansible-plugin subpackage

View File

@ -11,7 +11,7 @@
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
from blaze.api.async import AsyncApi as BlazeAsyncApi
from kottos.api.async import AsyncApi as KottosAsyncApi
from kollacli.api.job import Job
from kollacli.common.utils import reraise
@ -35,10 +35,10 @@ class AsyncApi(object):
:rtype: Job
"""
try:
mesos_job = BlazeAsyncApi().async_deploy(hostnames,
serial_flag,
verbose_level)
return Job(mesos_job)
kottos_job = KottosAsyncApi().async_deploy(hostnames,
serial_flag,
verbose_level)
return Job(kottos_job)
except Exception as e:
reraise(e)
@ -54,8 +54,8 @@ class AsyncApi(object):
"openstack_release."
"""
try:
mesos_job = BlazeAsyncApi().async_upgrade(verbose_level)
return Job(mesos_job)
kottos_job = KottosAsyncApi().async_upgrade(verbose_level)
return Job(kottos_job)
except Exception as e:
reraise(e)
@ -79,11 +79,11 @@ class AsyncApi(object):
"""
try:
mesos_job = BlazeAsyncApi().async_host_destroy(hostnames,
destroy_type,
verbose_level,
include_data)
return Job(mesos_job)
kottos_job = KottosAsyncApi().async_host_destroy(hostnames,
destroy_type,
verbose_level,
include_data)
return Job(kottos_job)
except Exception as e:
reraise(e)
@ -101,8 +101,8 @@ class AsyncApi(object):
:rtype: Job
"""
try:
mesos_job = BlazeAsyncApi().async_host_precheck(hostnames,
verbose_level)
return Job(mesos_job)
kottos_job = KottosAsyncApi().async_host_precheck(hostnames,
verbose_level)
return Job(kottos_job)
except Exception as e:
reraise(e)

View File

@ -11,8 +11,8 @@
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
from blaze.api.deploy import DeployApi as BlazeDeployApi
from kollacli.common.utils import reraise
from kottos.api.deploy import DeployApi as KottosDeployApi
class DeployApi(object):
@ -28,6 +28,6 @@ class DeployApi(object):
:type remote_mode: bool
"""
try:
BlazeDeployApi().deploy_set_mode(remote_mode)
KottosDeployApi().deploy_set_mode(remote_mode)
except Exception as e:
reraise(e)

View File

@ -11,16 +11,16 @@
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
from blaze.api.group import GroupApi as BlazeGroupApi
from kollacli.common.utils import reraise
from kottos.api.group import GroupApi as KottosGroupApi
class GroupApi(object):
class Group(object):
def __init__(self, groupname, servicenames, hostnames):
self.group = BlazeGroupApi.Group(groupname, servicenames,
hostnames)
self.group = KottosGroupApi.Group(groupname, servicenames,
hostnames)
self.name = groupname
def get_name(self):
@ -109,7 +109,7 @@ class GroupApi(object):
"""
try:
BlazeGroupApi().group_add(groupnames)
KottosGroupApi().group_add(groupnames)
except Exception as e:
reraise(e)
@ -121,7 +121,7 @@ class GroupApi(object):
"""
try:
BlazeGroupApi().group_remove(groupnames)
KottosGroupApi().group_remove(groupnames)
except Exception as e:
reraise(e)
@ -132,7 +132,7 @@ class GroupApi(object):
:rtype: list of Group objects
"""
try:
groups = BlazeGroupApi().group_get_all()
groups = KottosGroupApi().group_get_all()
new_groups = []
for group in groups:
new_group = self.Group(group.name, group.get_services(),
@ -151,7 +151,7 @@ class GroupApi(object):
:rtype: list of Group objects
"""
try:
groups = BlazeGroupApi().group_get(groupnames)
groups = KottosGroupApi().group_get(groupnames)
new_groups = []
for group in groups:
new_group = self.Group(group.name, group.get_services(),

View File

@ -11,8 +11,8 @@
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
from blaze.api.host import HostApi as BlazeHostApi
from kollacli.common.utils import reraise
from kottos.api.host import HostApi as KottosHostApi
class HostApi(object):
@ -20,7 +20,7 @@ class HostApi(object):
class Host(object):
"""Host"""
def __init__(self, hostname, groupnames):
self.host = BlazeHostApi.Host(hostname, groupnames)
self.host = KottosHostApi.Host(hostname, groupnames)
self.name = hostname
def get_name(self):
@ -45,7 +45,7 @@ class HostApi(object):
:param hostnames: list of strings
"""
try:
BlazeHostApi().host_add(hostnames)
KottosHostApi().host_add(hostnames)
except Exception as e:
reraise(e)
@ -55,7 +55,7 @@ class HostApi(object):
:param hostnames: list of strings
"""
try:
BlazeHostApi().host_remove(hostnames)
KottosHostApi().host_remove(hostnames)
except Exception as e:
reraise(e)
@ -66,7 +66,7 @@ class HostApi(object):
:rtype: Host
"""
try:
hosts = BlazeHostApi().host_get_all()
hosts = KottosHostApi().host_get_all()
new_hosts = []
for host in hosts:
new_host = self.Host(host.name, host.get_groups())
@ -83,7 +83,7 @@ class HostApi(object):
:rtype: Host
"""
try:
hosts = BlazeHostApi().host_get(hostnames)
hosts = KottosHostApi().host_get(hostnames)
new_hosts = []
for host in hosts:
new_host = self.Host(host.name, host.get_groups())
@ -107,7 +107,7 @@ class HostApi(object):
:rtype: dictionary
"""
try:
return BlazeHostApi().host_ssh_check(hostnames)
return KottosHostApi().host_ssh_check(hostnames)
except Exception as e:
reraise(e)
@ -125,6 +125,6 @@ class HostApi(object):
:param hosts_info: dictionary
"""
try:
BlazeHostApi().host_setup(hosts_info)
KottosHostApi().host_setup(hosts_info)
except Exception as e:
reraise(e)

View File

@ -16,8 +16,8 @@ from kollacli.common.utils import reraise
class Job(object):
"""Job"""
def __init__(self, mesos_job):
self._mesos_job = mesos_job
def __init__(self, kottos_job):
self._kottos_job = kottos_job
def wait(self):
"""Wait for job to complete
@ -26,7 +26,7 @@ class Job(object):
:rtype: int
"""
try:
return self._mesos_job.wait()
return self._kottos_job.wait()
except Exception as e:
reraise(e)
@ -40,7 +40,7 @@ class Job(object):
:rtype: int or None
"""
try:
return self._mesos_job.get_status()
return self._kottos_job.get_status()
except Exception as e:
reraise(e)
@ -51,7 +51,7 @@ class Job(object):
:rtype: string
"""
try:
return self._mesos_job.get_error_message()
return self._kottos_job.get_error_message()
except Exception as e:
reraise(e)
@ -62,13 +62,13 @@ class Job(object):
:rtype: string
"""
try:
return self._mesos_job.get_console_output()
return self._kottos_job.get_console_output()
except Exception as e:
reraise(e)
def kill(self):
"""kill the job"""
try:
return self._mesos_job.kill()
return self._kottos_job.kill()
except Exception as e:
reraise(e)

View File

@ -11,8 +11,8 @@
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
from blaze.api.password import PasswordApi as BlazePasswordApi
from kollacli.common.utils import reraise
from kottos.api.password import PasswordApi as KottosPasswordApi
class PasswordApi(object):
@ -26,7 +26,7 @@ class PasswordApi(object):
:type value: string
"""
try:
BlazePasswordApi().password_set(name, value)
KottosPasswordApi().password_set(name, value)
except Exception as e:
reraise(e)
@ -37,7 +37,7 @@ class PasswordApi(object):
:type name: string
"""
try:
BlazePasswordApi().password_clear(name)
KottosPasswordApi().password_clear(name)
except Exception as e:
reraise(e)
@ -48,6 +48,6 @@ class PasswordApi(object):
:rtype: list of strings
"""
try:
return BlazePasswordApi().password_get_names()
return KottosPasswordApi().password_get_names()
except Exception as e:
reraise(e)

View File

@ -11,8 +11,8 @@
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
from blaze.api.properties import PropertyApi as BlazePropertyApi
from kollacli.common.utils import reraise
from kottos.api.properties import PropertyApi as KottosPropertyApi
GLOBAL_TYPE = 'global'
@ -61,8 +61,8 @@ class PropertyApi(object):
"""
try:
BlazePropertyApi().property_set(property_dict,
property_type, change_set)
KottosPropertyApi().property_set(property_dict,
property_type, change_set)
except Exception as e:
reraise(e)
@ -80,8 +80,8 @@ class PropertyApi(object):
"""
try:
BlazePropertyApi().property_clear(property_list,
property_type, change_set)
KottosPropertyApi().property_clear(property_list,
property_type, change_set)
except Exception as e:
reraise(e)
@ -97,14 +97,14 @@ class PropertyApi(object):
:rtype: list of Property objects
"""
try:
properties = BlazePropertyApi().property_get(property_type,
get_set)
properties = KottosPropertyApi().property_get(property_type,
get_set)
new_properties = []
for prop in properties:
new_prop = self.Property()
new_prop.name = prop.name
new_prop.value = prop.value
new_prop.file_name = prop.file_name
new_prop.file_name = prop.zk_path
new_prop.overrides = prop.overrides
new_prop.orig_value = prop.orig_value
new_prop.target = prop.target

View File

@ -11,8 +11,8 @@
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
from blaze.api.service import ServiceApi as BlazeServiceApi
from kollacli.common.utils import reraise
from kottos.api.service import ServiceApi as KottosServiceApi
class ServiceApi(object):
@ -38,8 +38,8 @@ class ServiceApi(object):
def __init__(self, servicename, parentname=None,
childnames=[], groupnames=[]):
self.name = servicename
self.service = BlazeServiceApi.Service(servicename, parentname,
childnames, groupnames)
self.service = KottosServiceApi.Service(servicename, parentname,
childnames, groupnames)
self.parentname = self.service.parentname
def get_name(self):
@ -81,7 +81,7 @@ class ServiceApi(object):
:rtype: List of Service objects
"""
try:
services = BlazeServiceApi().service_get_all()
services = KottosServiceApi().service_get_all()
new_services = []
for service in services:
new_service = self.Service(service.name,
@ -102,7 +102,7 @@ class ServiceApi(object):
:rtype: list of Service objects
"""
try:
services = BlazeServiceApi().service_get(servicenames)
services = KottosServiceApi().service_get(servicenames)
new_services = []
for service in services:
new_service = self.Service(service.name,

View File

@ -11,8 +11,8 @@
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
from blaze.api.support import SupportApi as BlazeSupportApi
from kollacli.common.utils import reraise
from kottos.api.support import SupportApi as KottosSupportApi
class SupportApi(object):
@ -30,7 +30,7 @@ class SupportApi(object):
:rtype: string
"""
try:
return BlazeSupportApi().support_dump(dirpath)
return KottosSupportApi().support_dump(dirpath)
except Exception as e:
reraise(e)
@ -50,7 +50,7 @@ class SupportApi(object):
:type dirpath: string
"""
try:
BlazeSupportApi().support_get_logs(servicenames, hostname,
dirpath)
KottosSupportApi().support_get_logs(servicenames, hostname,
dirpath)
except Exception as e:
reraise(e)

View File

@ -13,31 +13,31 @@
# under the License.
import os
import blaze.api.exceptions
import kollacli.api.exceptions
import kollacli.i18n as u
import kottos.api.exceptions
def reraise(exception):
"""convert mesos exception to cli exception
"""convert kottos exception to cli exception
This is a temporary measure until the rest api is available.
"""
if isinstance(exception, blaze.api.exceptions.FailedOperation):
if isinstance(exception, kottos.api.exceptions.FailedOperation):
raise kollacli.api.exceptions.FailedOperation(exception)
elif isinstance(exception, blaze.api.exceptions.HostError):
elif isinstance(exception, kottos.api.exceptions.HostError):
raise kollacli.api.exceptions.HostError(exception)
elif isinstance(exception,
blaze.api.exceptions.HostsSshCheckError):
kottos.api.exceptions.HostsSshCheckError):
raise kollacli.api.exceptions.HostsSshCheckError(exception)
elif isinstance(exception, blaze.api.exceptions.InvalidArgument):
elif isinstance(exception, kottos.api.exceptions.InvalidArgument):
raise kollacli.api.exceptions.InvalidArgument(exception)
elif isinstance(exception,
blaze.api.exceptions.InvalidConfiguration):
kottos.api.exceptions.InvalidConfiguration):
raise kollacli.api.exceptions.InvalidConfiguration(exception)
elif isinstance(exception, blaze.api.exceptions.MissingArgument):
elif isinstance(exception, kottos.api.exceptions.MissingArgument):
raise kollacli.api.exceptions.MissingArgument(exception)
elif isinstance(exception, blaze.api.exceptions.NotInInventory):
elif isinstance(exception, kottos.api.exceptions.NotInInventory):
raise kollacli.api.exceptions.NotInInventory(exception)
raise exception

View File

@ -1,6 +1,6 @@
[metadata]
name = kollacli
version = 1.0
version = 4.0.1
description-file =
README.rst

View File

@ -3,7 +3,6 @@
# process, which may cause wedges in the gate later.
# Hacking already pins down pep8, pyflakes and flake8
hacking>=0.10.2,<0.11
bandit>=0.13.2
coverage>=3.6
discover

View File

@ -20,9 +20,9 @@ import os
import shutil
import unittest
from blaze.common.inventory import SERVICES
from blaze.common.utils import get_kollacli_etc
from kollacli.api.client import ClientApi
from kottos.common.inventory import SERVICES
from kottos.common.utils import get_kollacli_etc
INV_NAME = 'inventory.json'

View File

@ -23,7 +23,7 @@ from copy import copy
from pexpect import pxssh
from shutil import copyfile
from blaze.common import utils
from kottos.common import utils
from kollacli.api.client import ClientApi
from kollacli.api.exceptions import InvalidArgument

View File

@ -15,8 +15,8 @@
from common import ALL_SERVICES
from common import KollaCliTest
from blaze.common.inventory import Inventory
from blaze.common.inventory import SERVICES
from kottos.common.inventory import Inventory
from kottos.common.inventory import SERVICES
import json
import unittest

View File

@ -17,11 +17,11 @@ from common import KollaCliTest
import json
import unittest
from blaze.common.inventory import DEFAULT_GROUPS
from blaze.common.inventory import DEFAULT_OVERRIDES
from blaze.common.inventory import DEPLOY_GROUPS
from kollacli.api.client import ClientApi
from kollacli.api.exceptions import NotInInventory
from kottos.common.inventory import DEFAULT_GROUPS
from kottos.common.inventory import DEFAULT_OVERRIDES
from kottos.common.inventory import DEPLOY_GROUPS
CLIENT = ClientApi()

View File

@ -16,7 +16,7 @@ from common import KollaCliTest
import os
import unittest
from blaze.common.utils import get_kolla_etc
from kottos.common.utils import get_kolla_etc
class TestFunctional(KollaCliTest):

View File

@ -18,11 +18,10 @@ import json
import os
import unittest
from blaze.common.utils import get_group_vars_dir
from blaze.common.utils import get_host_vars_dir
from blaze.common.utils import get_kolla_home
from blaze.common.inventory import Inventory
from kottos.common.inventory import Inventory
from kottos.common.utils import get_group_vars_dir
from kottos.common.utils import get_host_vars_dir
from kottos.common.utils import get_kolla_home
class TestFunctional(KollaCliTest):

View File

@ -17,9 +17,9 @@ from common import KollaCliTest
import json
import unittest
from blaze.common.inventory import DEFAULT_GROUPS
from blaze.common.inventory import DEFAULT_OVERRIDES
from blaze.common.inventory import SERVICES
from kottos.common.inventory import DEFAULT_GROUPS
from kottos.common.inventory import DEFAULT_OVERRIDES
from kottos.common.inventory import SERVICES
class TestFunctional(KollaCliTest):

View File

@ -20,14 +20,14 @@ import unittest
from common import KollaCliTest
from common import TestConfig
from blaze.common.utils import get_kollacli_home
from kollacli.api.client import ClientApi
from kollacli.common.utils import safe_decode
from kottos.common.utils import get_kollacli_home
LOGS_PREFIX = '/tmp/kolla_support_logs_'
CLIENT = ClientApi()
LOGDIR = '/tmp/utest_blaze_logs'
LOGDIR = '/tmp/utest_kottos_logs'
class TestFunctional(KollaCliTest):

View File

@ -13,7 +13,7 @@ deps = -r{toxinidir}/requirements.txt
-r{toxinidir}/test-requirements.txt
[testenv:py27]
commands =
commands =
/usr/bin/find . -type f -name "*.pyc" -delete
{envpython} -m unittest discover -s tests -p "*.*"