Safely check enabled of services
Change-Id: Ibc47efe5fe9840e97b0f1545511e51afc7da728c
Related-PROD: PROD-29652
diff --git a/octavia/upgrade/pkgs_latest.sls b/octavia/upgrade/pkgs_latest.sls
index 5b4e3d3..b04e708 100644
--- a/octavia/upgrade/pkgs_latest.sls
+++ b/octavia/upgrade/pkgs_latest.sls
@@ -13,13 +13,13 @@
exit 101
{%- set pkgs = [] %}
-{%- if api.enabled %}
+{%- if api.get('enabled', False) %}
{%- do pkgs.extend(api.pkgs) %}
{%- endif %}
-{%- if manager.enabled %}
+{%- if manager.get('enabled', False) %}
{%- do pkgs.extend(manager.pkgs) %}
{%- endif %}
-{%- if client.enabled %}
+{%- if client.get('enabled', False) %}
{%- do pkgs.extend(client.pkgs) %}
{%- endif %}
diff --git a/octavia/upgrade/render_config.sls b/octavia/upgrade/render_config.sls
index 3dc9bfb..d8de66b 100644
--- a/octavia/upgrade/render_config.sls
+++ b/octavia/upgrade/render_config.sls
@@ -8,14 +8,14 @@
file.managed:
- source: salt://octavia/files/{{ api.version }}/certificates/openssl.cnf
-{%- if api.enabled %}
+{%- if api.get('enabled', False) %}
/etc/octavia/octavia_api.conf:
file.managed:
- source: salt://octavia/files/{{ api.version }}/octavia_api.conf
- template: jinja
{%- endif %}
-{%- if manager.enabled %}
+{%- if manager.get('enabled', False) %}
{%- set ssh_dir = salt['file.dirname'](manager.ssh.private_key_file) %}
{%- set image_mine_data = salt['mine.get']('glance:client', 'glanceng.get_image_owner_id', 'pillar').values() %}
{%- set network_mine_data = salt['mine.get']('neutron:client', 'list_octavia_networks', 'pillar').values() %}
diff --git a/octavia/upgrade/service_running.sls b/octavia/upgrade/service_running.sls
index ad37e12..1a6e2b7 100644
--- a/octavia/upgrade/service_running.sls
+++ b/octavia/upgrade/service_running.sls
@@ -6,10 +6,10 @@
{%- set oservices = [] %}
-{%- if api.enabled %}
+{%- if api.get('enabled', false) %}
{%- do oservices.extend(api.services) %}
{%- endif %}
-{%- if manager.enabled %}
+{%- if manager.get('enabled', false) %}
{%- do oservices.extend(manager.services) %}
{%- endif %}
diff --git a/octavia/upgrade/service_stopped.sls b/octavia/upgrade/service_stopped.sls
index df6fa85..1285647 100644
--- a/octavia/upgrade/service_stopped.sls
+++ b/octavia/upgrade/service_stopped.sls
@@ -6,10 +6,10 @@
{%- set oservices = [] %}
-{%- if api.enabled %}
+{%- if api.get('enabled', false) %}
{%- do oservices.extend(api.services) %}
{%- endif %}
-{%- if manager.enabled %}
+{%- if manager.get('enabled', false) %}
{%- do oservices.extend(manager.services) %}
{%- endif %}