Make openstack dashboard theme configurable 77/23377/3
authorQiLiang <liangqi1@huawei.com>
Wed, 19 Oct 2016 17:52:15 +0000 (01:52 +0800)
committerQiLiang <liangqi1@huawei.com>
Thu, 20 Oct 2016 17:42:09 +0000 (01:42 +0800)
Use flag ENABLE_UBUNTU_THEME to configure enable or disable ubuntu
dashboard theme.

Set default to use ubuntu theme.

JIRA: -

Change-Id: I454c69b0290084c244979bb86c733a03721481cb
Signed-off-by: QiLiang <liangqi1@huawei.com>
deploy/adapters/ansible/roles/dashboard/tasks/main.yml
deploy/compass_vm.sh
deploy/conf/base.conf
deploy/launch.sh

index da6990c..229e3cf 100644 (file)
@@ -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
 
index 7e2ce40..33e309c 100755 (executable)
@@ -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"
index d60e68b..bc0907a 100644 (file)
@@ -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"}
 
index 6db9f36..4e6e1a3 100755 (executable)
@@ -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