summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJustin chi <chigang@huawei.com>2016-10-21 20:29:49 +0000
committerGerrit Code Review <gerrit@opnfv.org>2016-10-21 20:29:49 +0000
commit56a4f21b81b4273e5e5802caa8ed8351119002d4 (patch)
treec35f7f5de7880d74901219bc72d4ee7d29fb0933
parentfe7a6831d6a6c0f7a225b0c30cbeee65cd26f55e (diff)
parent065813ecbe8b4860da4281b6d67104798e3a8d43 (diff)
Merge "Make openstack dashboard theme configurable"
-rw-r--r--deploy/adapters/ansible/roles/dashboard/tasks/main.yml2
-rwxr-xr-xdeploy/compass_vm.sh23
-rw-r--r--deploy/conf/base.conf1
-rwxr-xr-xdeploy/launch.sh4
4 files changed, 29 insertions, 1 deletions
diff --git a/deploy/adapters/ansible/roles/dashboard/tasks/main.yml b/deploy/adapters/ansible/roles/dashboard/tasks/main.yml
index da6990c4..229e3cfe 100644
--- a/deploy/adapters/ansible/roles/dashboard/tasks/main.yml
+++ b/deploy/adapters/ansible/roles/dashboard/tasks/main.yml
@@ -28,7 +28,7 @@
- name: remove ubuntu theme
action: "{{ ansible_pkg_mgr }} name=openstack-dashboard-ubuntu-theme state=absent"
- when: ansible_os_family == 'Debian'
+ when: ansible_os_family == 'Debian' and not enable_ubuntu_theme
notify:
- restart dashboard services
diff --git a/deploy/compass_vm.sh b/deploy/compass_vm.sh
index 7e2ce40b..33e309c0 100755
--- a/deploy/compass_vm.sh
+++ b/deploy/compass_vm.sh
@@ -48,6 +48,29 @@ function install_compass() {
fi
}
+function exec_cmd_on_compass() {
+ ssh $ssh_args root@$MGMT_IP "$@"
+}
+
+function _inject_dashboard_conf() {
+ if [[ "$ENABLE_UBUNTU_THEME" == "true" ]]; then
+ cmd="
+ sed -i '/enable_ubuntu_theme/d' /etc/compass/templates/ansible_installer/openstack_mitaka/vars/HA-ansible-multinodes.tmpl; \
+ echo enable_ubuntu_theme: True >> /etc/compass/templates/ansible_installer/openstack_mitaka/vars/HA-ansible-multinodes.tmpl
+ "
+ else
+ cmd="
+ sed -i '/enable_ubuntu_theme/d' /etc/compass/templates/ansible_installer/openstack_mitaka/vars/HA-ansible-multinodes.tmpl; \
+ echo enable_ubuntu_theme: False >> /etc/compass/templates/ansible_installer/openstack_mitaka/vars/HA-ansible-multinodes.tmpl
+ "
+ fi
+ exec_cmd_on_compass $cmd
+}
+
+function inject_compass_conf() {
+ _inject_dashboard_conf
+}
+
function wait_ok() {
set +x
log_info "wait_compass_ok enter"
diff --git a/deploy/conf/base.conf b/deploy/conf/base.conf
index d60e68b1..bc0907a1 100644
--- a/deploy/conf/base.conf
+++ b/deploy/conf/base.conf
@@ -24,6 +24,7 @@ export DASHBOARD_URL=""
export ENABLE_SECGROUP=${ENABLE_SECGROUP:-"true"}
export ENABLE_VPNAAS="false"
export ENABLE_FWAAS="false"
+export ENABLE_UBUNTU_THEME=${ENABLE_UBUNTU_THEME:-"true"}
export EXPANSION=${EXPANSION:-"false"}
diff --git a/deploy/launch.sh b/deploy/launch.sh
index 6db9f362..4e6e1a39 100755
--- a/deploy/launch.sh
+++ b/deploy/launch.sh
@@ -87,6 +87,10 @@ if [[ -z "$REDEPLOY_HOST" || "$REDEPLOY_HOST" == "false" ]]; then
if ! set_compass_machine; then
log_error "set_compass_machine fail"
fi
+
+ # FIXME: refactor compass adapter and conf code, instead of doing
+ # hack conf injection.
+ inject_compass_conf
fi
if [[ "$DEPLOY_HOST" == "true" || $REDEPLOY_HOST == "true" ]]; then
{ color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */ }
#!/usr/bin/env python
# Copyright 2016 Cisco Systems, Inc.  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.
#

from log import LOG
from service_chain import ServiceChain
import traceback
from traffic_client import TrafficClient


class ChainRunner(object):
    """Run selected chain, collect results and analyse them."""

    def __init__(self, config, clients, cred, specs, factory, notifier=None):
        self.config = config
        self.clients = clients
        self.specs = specs
        self.factory = factory
        self.chain_name = self.config.service_chain

        try:
            TORClass = factory.get_tor_class(self.config.tor.type, self.config.no_tor_access)
        except AttributeError:
            raise Exception("Requested TOR class '{}' was not found.".format(self.config.tor.type))

        self.clients['tor'] = TORClass(self.config.tor.switches)
        self.clients['traffic'] = TrafficClient(config, notifier)
        self.chain = ServiceChain(config, clients, cred, specs, factory, notifier)

        LOG.info('ChainRunner initialized.')

    def run(self):
        """
        Run a chain, collect and analyse results.

        :return: dictionary
        """
        self.clients['traffic'].start_traffic_generator()
        self.clients['traffic'].set_macs()

        return self.chain.run()

    def close(self):
        try:
            if not self.config.no_cleanup:
                LOG.info('Cleaning up...')
            else:
                LOG.info('Clean up skipped.')

            for client in ['traffic', 'tor']:
                try:
                    self.clients[client].close()
                except Exception as e:
                    traceback.print_exc()
                    LOG.error(e)

            self.chain.close()
        except Exception:
            traceback.print_exc()
            LOG.error('Cleanup not finished.')

    def get_version(self):
        versions = {
            'Traffic Generator': self.clients['traffic'].get_version(),
            'TOR': self.clients['tor'].get_version(),
        }

        versions.update(self.chain.get_version())

        return versions