Application Catalog for OpenStack
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

602 lines
21KB

  1. #!/usr/bin/env bash
  2. # Plugin file for Murano services
  3. # -------------------------------
  4. # Dependencies:
  5. # ``functions`` file
  6. # ``DEST``, ``DATA_DIR``, ``STACK_USER`` must be defined
  7. # Save trace setting
  8. XTRACE=$(set +o | grep xtrace)
  9. set -o xtrace
  10. # Support entry points installation of console scripts
  11. if [[ -d $MURANO_DIR/bin ]]; then
  12. MURANO_BIN_DIR=$MURANO_DIR/bin
  13. else
  14. MURANO_BIN_DIR=$(get_python_exec_prefix)
  15. fi
  16. # create_murano_accounts() - Set up common required murano accounts
  17. #
  18. # Tenant User Roles
  19. # ------------------------------
  20. # service murano admin
  21. function create_murano_accounts() {
  22. if ! is_service_enabled key; then
  23. return
  24. fi
  25. create_service_user "murano"
  26. get_or_create_service "murano" "application-catalog" "Application Catalog Service"
  27. get_or_create_endpoint "application-catalog" \
  28. "$REGION_NAME" \
  29. "$MURANO_SERVICE_PROTOCOL://$MURANO_SERVICE_HOST:$MURANO_SERVICE_PORT" \
  30. "$MURANO_SERVICE_PROTOCOL://$MURANO_SERVICE_HOST:$MURANO_SERVICE_PORT" \
  31. "$MURANO_SERVICE_PROTOCOL://$MURANO_SERVICE_HOST:$MURANO_SERVICE_PORT"
  32. if is_service_enabled murano-cfapi; then
  33. get_or_create_service "murano-cfapi" "service-broker" "Murano CloudFoundry Service Broker"
  34. get_or_create_endpoint "service-broker" \
  35. "$REGION_NAME" \
  36. "$MURANO_SERVICE_PROTOCOL://$MURANO_SERVICE_HOST:$MURANO_CFAPI_SERVICE_PORT" \
  37. "$MURANO_SERVICE_PROTOCOL://$MURANO_SERVICE_HOST:$MURANO_CFAPI_SERVICE_PORT" \
  38. "$MURANO_SERVICE_PROTOCOL://$MURANO_SERVICE_HOST:$MURANO_CFAPI_SERVICE_PORT"
  39. fi
  40. }
  41. function mkdir_chown_stack {
  42. if [[ ! -d "$1" ]]; then
  43. sudo mkdir -p "$1"
  44. fi
  45. sudo chown $STACK_USER "$1"
  46. }
  47. function configure_murano_rpc_backend() {
  48. # Configure the rpc service.
  49. iniset_rpc_backend muranoapi $MURANO_CONF_FILE DEFAULT
  50. # TODO(ruhe): get rid of this ugly workaround.
  51. inicomment $MURANO_CONF_FILE DEFAULT rpc_backend
  52. iniset $MURANO_CONF_FILE rabbitmq host $RABBIT_HOST
  53. iniset $MURANO_CONF_FILE rabbitmq login $RABBIT_USERID
  54. iniset $MURANO_CONF_FILE rabbitmq password $RABBIT_PASSWORD
  55. # Set non-default rabbit virtual host if required.
  56. if [[ -n "$MURANO_RABBIT_VHOST" ]]; then
  57. iniset $MURANO_CONF_FILE DEFAULT rabbit_virtual_host $MURANO_RABBIT_VHOST
  58. iniset $MURANO_CONF_FILE rabbitmq virtual_host $MURANO_RABBIT_VHOST
  59. fi
  60. }
  61. function configure_murano_glare_backend() {
  62. # Configure Murano to use GlARe application storage backend
  63. iniset $MURANO_CONF_FILE engine packages_service 'glare'
  64. iniset $MURANO_CONF_FILE glare url $GLANCE_SERVICE_PROTOCOL://$GLANCE_GLARE_HOSTPORT
  65. iniset $MURANO_CONF_FILE glare endpoint_type $GLARE_ENDPOINT_TYPE
  66. echo -e $"\nexport MURANO_PACKAGES_SERVICE='glare'" | sudo tee -a $TOP_DIR/openrc
  67. }
  68. function restart_glare_service() {
  69. # Restart GlARe service to apply Murano artifact plugin
  70. if is_running glance-glare; then
  71. echo_summary "Restarting GlARe to apply config changes"
  72. stop_process g-glare
  73. run_process g-glare "$GLANCE_BIN_DIR/glance-glare --config-file=$GLANCE_CONF_DIR/glance-glare.conf"
  74. echo "Waiting for GlARe [g-glare] ($GLANCE_GLARE_HOSTPORT) to start..."
  75. if ! wait_for_service $SERVICE_TIMEOUT $GLANCE_SERVICE_PROTOCOL://$GLANCE_GLARE_HOSTPORT; then
  76. die $LINENO " GlARe [g-glare] did not start"
  77. fi
  78. else
  79. echo_summary "GlARe service wasn't started yet. It will start in usual way."
  80. fi
  81. }
  82. function install_murano_artifact_plugin() {
  83. # Provide support of Murano artifacts type to GlARe
  84. setup_package $MURANO_DIR/contrib/glance -e
  85. }
  86. function is_murano_backend_glare() {
  87. is_service_enabled g-glare && [[ "$MURANO_USE_GLARE" == "True" ]] && return 0
  88. return 1
  89. }
  90. function configure_murano_networking {
  91. # Use keyword 'public' if Murano external network was not set.
  92. # If it was set but the network is not exist then
  93. # first available external network will be selected.
  94. local ext_net=${MURANO_EXTERNAL_NETWORK:-'public'}
  95. local ext_net_id=$(neutron net-external-list \
  96. | grep " $ext_net " | get_field 2)
  97. # Try to select first available external network
  98. if [[ -n "$ext_net_id" ]]; then
  99. ext_net_id=$(neutron net-external-list -f csv -c id \
  100. | tail -n +2 | tail -n 1)
  101. fi
  102. # Configure networking options for Murano
  103. if [[ -n "$ext_net" ]] && [[ -n "$ext_net_id" ]]; then
  104. iniset $MURANO_CONF_FILE networking external_network $ext_net_id
  105. iniset $MURANO_CONF_FILE networking create_router 'true'
  106. else
  107. iniset $MURANO_CONF_FILE networking create_router 'false'
  108. fi
  109. if [[ -n "$MURANO_DEFAULT_ROUTER" ]]; then
  110. iniset $MURANO_CONF_FILE networking router_name $MURANO_DEFAULT_ROUTER
  111. fi
  112. if [[ -n "$MURANO_DEFAULT_DNS" ]]; then
  113. iniset $MURANO_CONF_FILE networking default_dns $MURANO_DEFAULT_DNS
  114. fi
  115. }
  116. # Entry points
  117. # ------------
  118. # configure_murano() - Set config files, create data dirs, etc
  119. function configure_murano {
  120. mkdir_chown_stack "$MURANO_CONF_DIR"
  121. # Generate Murano configuration file and configure common parameters.
  122. oslo-config-generator --namespace keystonemiddleware.auth_token \
  123. --namespace murano \
  124. --namespace oslo.db \
  125. --namespace oslo.messaging \
  126. > $MURANO_CONF_FILE
  127. cp $MURANO_DIR/etc/murano/murano-paste.ini $MURANO_CONF_DIR
  128. cp $MURANO_DIR/etc/murano/policy.json $MURANO_POLICY_FILE
  129. cleanup_murano
  130. iniset $MURANO_CONF_FILE DEFAULT debug $MURANO_DEBUG
  131. iniset $MURANO_CONF_FILE DEFAULT use_syslog $SYSLOG
  132. # Format logging
  133. if [ "$LOG_COLOR" == "True" ] && [ "$SYSLOG" == "False" ]; then
  134. setup_colorized_logging $MURANO_CONF_FILE DEFAULT
  135. else
  136. # Show user_name and project_name instead of user_id and project_id
  137. iniset $MURANO_CONF_FILE DEFAULT logging_context_format_string "%(asctime)s.%(msecs)03d %(levelname)s %(name)s [%(request_id)s %(user_name)s %(project_name)s] %(instance)s%(message)s"
  138. fi
  139. iniset $MURANO_CONF_FILE DEFAULT home_region $REGION_NAME
  140. # Murano Policy Enforcement Configuration
  141. if [[ -n "$MURANO_ENABLE_MODEL_POLICY_ENFORCEMENT" ]]; then
  142. iniset $MURANO_CONF_FILE engine enable_model_policy_enforcer $MURANO_ENABLE_MODEL_POLICY_ENFORCEMENT
  143. fi
  144. # Murano Api Configuration
  145. #-------------------------
  146. # Setup keystone_authtoken section
  147. iniset $MURANO_CONF_FILE keystone_authtoken auth_uri "http://${KEYSTONE_AUTH_HOST}:5000"
  148. iniset $MURANO_CONF_FILE keystone_authtoken auth_host $KEYSTONE_AUTH_HOST
  149. iniset $MURANO_CONF_FILE keystone_authtoken auth_port $KEYSTONE_AUTH_PORT
  150. iniset $MURANO_CONF_FILE keystone_authtoken auth_protocol $KEYSTONE_AUTH_PROTOCOL
  151. iniset $MURANO_CONF_FILE keystone_authtoken cafile $KEYSTONE_SSL_CA
  152. iniset $MURANO_CONF_FILE keystone_authtoken admin_tenant_name $SERVICE_TENANT_NAME
  153. iniset $MURANO_CONF_FILE keystone_authtoken admin_user $MURANO_ADMIN_USER
  154. iniset $MURANO_CONF_FILE keystone_authtoken admin_password $SERVICE_PASSWORD
  155. configure_murano_rpc_backend
  156. # Configure notifications for status information during provisioning
  157. iniset $MURANO_CONF_FILE oslo_messaging_notifications driver messagingv2
  158. # configure the database.
  159. iniset $MURANO_CONF_FILE database connection `database_connection_url murano`
  160. # Configure keystone auth url
  161. iniset $MURANO_CONF_FILE keystone auth_url "http://${KEYSTONE_AUTH_HOST}:5000"
  162. # Configure Murano API URL
  163. iniset $MURANO_CONF_FILE murano url "http://127.0.0.1:8082"
  164. # Configure the number of engine workers
  165. if [[ -n "$MURANO_ENGINE_WORKERS" ]]; then
  166. iniset $MURANO_CONF_FILE engine workers $MURANO_ENGINE_WORKERS
  167. fi
  168. if is_murano_backend_glare; then
  169. configure_murano_glare_backend
  170. fi
  171. }
  172. # set the murano packages service backend
  173. function set_packages_service_backend() {
  174. if is_murano_backend_glare; then
  175. MURANO_PACKAGES_SERVICE='glare'
  176. else
  177. MURANO_PACKAGES_SERVICE='murano'
  178. fi
  179. }
  180. # configure_murano_cfapi() - Set config files
  181. function configure_murano_cfapi {
  182. # Generate Murano configuration file and configure common parameters.
  183. oslo-config-generator --namespace keystonemiddleware.auth_token \
  184. --namespace murano.cfapi \
  185. --namespace oslo.db \
  186. > $MURANO_CFAPI_CONF_FILE
  187. cp $MURANO_DIR/etc/murano/murano-cfapi-paste.ini $MURANO_CONF_DIR
  188. configure_service_broker
  189. }
  190. # install_murano_apps() - Install Murano apps from repository murano-apps, if required
  191. function install_murano_apps() {
  192. if [[ -z $MURANO_APPS ]]; then
  193. return
  194. fi
  195. # clone murano-apps only if app installation is required
  196. git_clone $MURANO_APPS_REPO $MURANO_APPS_DIR $MURANO_APPS_BRANCH
  197. set_packages_service_backend
  198. # install Murano apps defined in the comma-separated list $MURANO_APPS
  199. for murano_app in ${MURANO_APPS//,/ }; do
  200. find $MURANO_APPS_DIR -type d -name "package" | while read package; do
  201. full_name=$(grep "FullName" "$package/manifest.yaml" | awk -F ':' '{print $2}' | tr -d ' ')
  202. if [[ $full_name = $murano_app ]]; then
  203. pushd $package
  204. zip -r app.zip .
  205. murano --os-username $OS_USERNAME \
  206. --os-password $OS_PASSWORD \
  207. --os-tenant-name $OS_PROJECT_NAME \
  208. --os-auth-url http://$KEYSTONE_AUTH_HOST:5000 \
  209. --murano-url http://127.0.0.1:8082 \
  210. --murano-packages-service $MURANO_PACKAGES_SERVICE \
  211. package-import \
  212. --is-public \
  213. --exists-action u \
  214. app.zip
  215. popd
  216. fi
  217. done
  218. done
  219. }
  220. # configure_service_broker() - set service broker specific options to config
  221. function configure_service_broker {
  222. iniset $MURANO_CFAPI_CONF_FILE DEFAULT debug $MURANO_DEBUG
  223. iniset $MURANO_CFAPI_CONF_FILE DEFAULT use_syslog $SYSLOG
  224. #Add needed options to murano-cfapi.conf
  225. iniset $MURANO_CFAPI_CONF_FILE cfapi tenant "$MURANO_CFAPI_DEFAULT_TENANT"
  226. iniset $MURANO_CFAPI_CONF_FILE cfapi bind_host "$MURANO_SERVICE_HOST"
  227. iniset $MURANO_CFAPI_CONF_FILE cfapi bind_port "$MURANO_CFAPI_SERVICE_PORT"
  228. iniset $MURANO_CFAPI_CONF_FILE cfapi auth_url "http://${KEYSTONE_AUTH_HOST}:5000"
  229. # configure the database.
  230. iniset $MURANO_CFAPI_CONF_FILE database connection `database_connection_url murano_cfapi`
  231. # Setup keystone_authtoken section
  232. iniset $MURANO_CFAPI_CONF_FILE keystone_authtoken auth_uri "http://${KEYSTONE_AUTH_HOST}:5000"
  233. iniset $MURANO_CFAPI_CONF_FILE keystone_authtoken auth_host $KEYSTONE_AUTH_HOST
  234. iniset $MURANO_CFAPI_CONF_FILE keystone_authtoken auth_port $KEYSTONE_AUTH_PORT
  235. iniset $MURANO_CFAPI_CONF_FILE keystone_authtoken auth_protocol $KEYSTONE_AUTH_PROTOCOL
  236. iniset $MURANO_CFAPI_CONF_FILE keystone_authtoken cafile $KEYSTONE_SSL_CA
  237. iniset $MURANO_CFAPI_CONF_FILE keystone_authtoken admin_tenant_name $SERVICE_TENANT_NAME
  238. iniset $MURANO_CFAPI_CONF_FILE keystone_authtoken admin_user $MURANO_ADMIN_USER
  239. iniset $MURANO_CFAPI_CONF_FILE keystone_authtoken admin_password $SERVICE_PASSWORD
  240. }
  241. function prepare_core_library() {
  242. cd $MURANO_DIR/meta/io.murano && zip -r io.murano.zip .
  243. }
  244. function remove_core_library_zip() {
  245. rm -f $MURANO_DIR/meta/io.murano/io.murano.zip
  246. }
  247. # init_murano() - Initialize databases, etc.
  248. function init_murano() {
  249. configure_murano_networking
  250. # (re)create Murano database
  251. recreate_database murano utf8
  252. $MURANO_BIN_DIR/murano-db-manage --config-file $MURANO_CONF_FILE upgrade
  253. }
  254. # init_murano_cfapi() - Initialize databases, etc.
  255. function init_murano_cfapi() {
  256. # (re)create Murano database
  257. recreate_database murano_cfapi utf8
  258. $MURANO_BIN_DIR/murano-cfapi-db-manage --config-file $MURANO_CFAPI_CONF_FILE upgrade
  259. }
  260. function setup_core_library() {
  261. prepare_core_library
  262. set_packages_service_backend
  263. murano --os-username admin \
  264. --os-password $ADMIN_PASSWORD \
  265. --os-tenant-name admin \
  266. --os-auth-url http://$KEYSTONE_AUTH_HOST:5000 \
  267. --os-region-name $REGION_NAME \
  268. --murano-url http://127.0.0.1:8082 \
  269. --murano-packages-service $MURANO_PACKAGES_SERVICE \
  270. package-import $MURANO_DIR/meta/io.murano/io.murano.zip \
  271. --is-public
  272. remove_core_library_zip
  273. }
  274. # install_murano() - Collect source and prepare
  275. function install_murano() {
  276. install_murano_pythonclient
  277. git_clone $MURANO_REPO $MURANO_DIR $MURANO_BRANCH
  278. setup_develop $MURANO_DIR
  279. if is_murano_backend_glare; then
  280. install_murano_artifact_plugin
  281. fi
  282. }
  283. function install_murano_pythonclient() {
  284. # For using non-released client from git branch, need to add
  285. # LIBS_FROM_GIT=python-muranoclient parameter to localrc.
  286. # Otherwise, murano will install python-muranoclient from requirements.
  287. if use_library_from_git "python-muranoclient"; then
  288. git_clone_by_name "python-muranoclient"
  289. setup_dev_lib "python-muranoclient"
  290. # Installing bash_completion for murano
  291. sudo install -D -m 0644 -o $STACK_USER {${GITDIR["python-muranoclient"]}/tools/,/etc/bash_completion.d/}murano.bash_completion
  292. fi
  293. }
  294. # start_murano() - Start running processes, including screen
  295. function start_murano() {
  296. screen_it murano-api "cd $MURANO_DIR && $MURANO_BIN_DIR/murano-api --config-file $MURANO_CONF_DIR/murano.conf"
  297. screen_it murano-engine "cd $MURANO_DIR && $MURANO_BIN_DIR/murano-engine --config-file $MURANO_CONF_DIR/murano.conf"
  298. }
  299. # stop_murano() - Stop running processes
  300. function stop_murano() {
  301. # Kill the Murano screen windows
  302. screen -S $SCREEN_NAME -p murano-api -X kill
  303. screen -S $SCREEN_NAME -p murano-engine -X kill
  304. }
  305. # start_service_broker() - start murano CF service broker
  306. function start_service_broker() {
  307. screen_it murano-cfapi "cd $MURANO_DIR && $MURANO_BIN_DIR/murano-cfapi --config-file $MURANO_CONF_DIR/murano-cfapi.conf"
  308. }
  309. # stop_service_broker() - stop murano CF service broker
  310. function stop_service_broker() {
  311. # Kill the Murano screen windows
  312. screen -S $SCREEN_NAME -p murano-cfapi -X kill
  313. }
  314. function cleanup_murano() {
  315. # Cleanup keystone signing dir
  316. sudo rm -rf $MURANO_KEYSTONE_SIGNING_DIR
  317. }
  318. function configure_murano_tempest_plugin() {
  319. # Check tempest for enabling
  320. if is_service_enabled tempest; then
  321. echo_summary "Configuring Murano Tempest plugin"
  322. # Set murano service availability flag
  323. iniset $TEMPEST_CONFIG service_available murano "True"
  324. # Running tempest in isolation will using tempest user.
  325. if sudo id -u tempest >/dev/null 2>&1; then
  326. sudo chown -R tempest:stack $MURANO_DIR/murano_tempest_tests
  327. fi
  328. if is_service_enabled murano-cfapi; then
  329. # Enable Service Broker tests if cfapi enabled and set murano-cfapi service availability flag
  330. iniset $TEMPEST_CONFIG service_available murano_cfapi "True"
  331. iniset $TEMPEST_CONFIG service_broker run_service_broker_tests "True"
  332. fi
  333. if is_service_enabled g-glare; then
  334. # TODO(freerunner): This is bad way to configure tempest to
  335. # TODO see glare as enabled. We need to move it out to tempest
  336. # TODO of glance repo when glare become official OS API.
  337. iniset $TEMPEST_CONFIG service_available glare "True"
  338. fi
  339. if is_murano_backend_glare; then
  340. iniset $TEMPEST_CONFIG application_catalog glare_backend "True"
  341. fi
  342. fi
  343. }
  344. #### lib/murano-dashboard
  345. # Dependencies:
  346. #
  347. # - ``functions`` file
  348. # - ``DEST``, ``DATA_DIR``, ``STACK_USER`` must be defined
  349. # - ``SERVICE_HOST``
  350. # ``stack.sh`` calls the entry points in this order:
  351. #
  352. # - install_murano_dashboard
  353. # - configure_murano_dashboard
  354. # - cleanup_murano_dashboard
  355. source $TOP_DIR/lib/horizon
  356. # Defaults
  357. # --------
  358. HORIZON_CONFIG=${HORIZON_CONFIG:-$HORIZON_DIR/openstack_dashboard/settings.py}
  359. HORIZON_LOCAL_CONFIG=${HORIZON_LOCAL_CONFIG:-$HORIZON_DIR/openstack_dashboard/local/local_settings.py}
  360. # Set up default repos
  361. MURANO_DASHBOARD_REPO=${MURANO_DASHBOARD_REPO:-${GIT_BASE}/openstack/murano-dashboard.git}
  362. MURANO_DASHBOARD_BRANCH=${MURANO_DASHBOARD_BRANCH:-master}
  363. # Set up default directories
  364. MURANO_DASHBOARD_DIR=$DEST/murano-dashboard
  365. MURANO_PYTHONCLIENT_DIR=$DEST/python-muranoclient
  366. MURANO_DASHBOARD_CACHE_DIR=${MURANO_DASHBOARD_CACHE_DIR:-/tmp/murano}
  367. MURANO_REPOSITORY_URL=${MURANO_REPOSITORY_URL:-'http://apps.openstack.org/api/v1/murano_repo/liberty/'}
  368. # Entry points
  369. # ------------
  370. # configure_murano_dashboard() - Set config files, create data dirs, etc
  371. function configure_murano_dashboard() {
  372. configure_local_settings_py
  373. restart_apache_server
  374. }
  375. function configure_local_settings_py() {
  376. local horizon_config_part=$(mktemp)
  377. mkdir_chown_stack "$MURANO_DASHBOARD_CACHE_DIR"
  378. if is_murano_backend_glare; then
  379. # Make Murano use GlARe only if MURANO_USE_GLARE set to True and GlARe
  380. # service is enabled
  381. local murano_use_glare=True
  382. else
  383. local murano_use_glare=False
  384. fi
  385. if [[ -f "$HORIZON_LOCAL_CONFIG" ]]; then
  386. sed -e "s/\(^\s*OPENSTACK_HOST\s*=\).*$/\1 '$HOST_IP'/" -i "$HORIZON_LOCAL_CONFIG"
  387. fi
  388. # Install Murano as plugin for Horizon
  389. ln -sf $MURANO_DASHBOARD_DIR/muranodashboard/local/enabled/_50_murano.py $HORIZON_DIR/openstack_dashboard/local/enabled/
  390. # Install setting to Horizon
  391. ln -sf $MURANO_DASHBOARD_DIR/muranodashboard/local/local_settings.d/_50_murano.py $HORIZON_DIR/openstack_dashboard/local/local_settings.d/
  392. # Change Murano dashboard settings
  393. sed -e "s/\(^\s*MURANO_USE_GLARE\s*=\).*$/\1 $murano_use_glare/" -i $HORIZON_DIR/openstack_dashboard/local/local_settings.d/_50_murano.py
  394. sed -e "s%\(^\s*MURANO_REPO_URL\s*=\).*$%\1 '$MURANO_REPOSITORY_URL'%" -i $HORIZON_DIR/openstack_dashboard/local/local_settings.d/_50_murano.py
  395. sed -e "s%\(^\s*'NAME':\).*$%\1 os.path.join('$MURANO_DASHBOARD_DIR', 'openstack-dashboard.sqlite')%" -i $HORIZON_DIR/openstack_dashboard/local/local_settings.d/_50_murano.py
  396. echo -e $"\nMETADATA_CACHE_DIR = '$MURANO_DASHBOARD_CACHE_DIR'" | sudo tee -a $HORIZON_DIR/openstack_dashboard/local/local_settings.d/_50_murano.py
  397. }
  398. # init_murano_dashboard() - Initialize databases, etc.
  399. function init_murano_dashboard() {
  400. # clean up from previous (possibly aborted) runs
  401. # create required data files
  402. local horizon_manage_py="$HORIZON_DIR/manage.py"
  403. python "$horizon_manage_py" collectstatic --noinput
  404. python "$horizon_manage_py" compress --force
  405. python "$horizon_manage_py" migrate --noinput
  406. # Compile message for murano-dashboard
  407. cd $MURANO_DASHBOARD_DIR/muranodashboard
  408. python "$horizon_manage_py" compilemessages
  409. restart_apache_server
  410. }
  411. # install_murano_dashboard() - Collect source and prepare
  412. function install_murano_dashboard() {
  413. echo_summary "Install Murano Dashboard"
  414. git_clone $MURANO_DASHBOARD_REPO $MURANO_DASHBOARD_DIR $MURANO_DASHBOARD_BRANCH
  415. setup_develop $MURANO_DASHBOARD_DIR
  416. }
  417. # cleanup_murano_dashboard() - Remove residual data files, anything left over from previous
  418. # runs that a clean run would need to clean up
  419. function cleanup_murano_dashboard() {
  420. echo_summary "Cleanup Murano Dashboard"
  421. rm $HORIZON_DIR/openstack_dashboard/local/enabled/_50_murano.py
  422. rm $HORIZON_DIR/openstack_dashboard/local/local_settings.d/_50_murano.py
  423. }
  424. # Main dispatcher
  425. if is_service_enabled murano; then
  426. if [[ "$1" == "stack" && "$2" == "install" ]]; then
  427. echo_summary "Installing Murano"
  428. install_murano
  429. if is_service_enabled horizon; then
  430. install_murano_dashboard
  431. fi
  432. elif [[ "$1" == "stack" && "$2" == "post-config" ]]; then
  433. echo_summary "Configuring Murano"
  434. configure_murano
  435. create_murano_accounts
  436. if is_service_enabled horizon; then
  437. configure_murano_dashboard
  438. fi
  439. if is_service_enabled murano-cfapi; then
  440. configure_murano_cfapi
  441. fi
  442. elif [[ "$1" == "stack" && "$2" == "extra" ]]; then
  443. echo_summary "Initializing Murano"
  444. init_murano
  445. if is_service_enabled horizon; then
  446. init_murano_dashboard
  447. fi
  448. start_murano
  449. if is_murano_backend_glare; then
  450. restart_glare_service
  451. fi
  452. if is_service_enabled murano-cfapi; then
  453. init_murano_cfapi
  454. start_service_broker
  455. fi
  456. setup_core_library
  457. configure_murano_tempest_plugin
  458. # Give Murano some time to Start
  459. sleep 3
  460. # Install Murano apps, if needed
  461. install_murano_apps
  462. fi
  463. if [[ "$1" == "unstack" ]]; then
  464. stop_murano
  465. if is_service_enabled murano-cfapi; then
  466. stop_service_broker
  467. fi
  468. cleanup_murano
  469. if is_service_enabled horizon; then
  470. cleanup_murano_dashboard
  471. fi
  472. fi
  473. fi
  474. # Restore xtrace
  475. $XTRACE