Skip to content

Commit 6cf9266

Browse files
authored
Merge pull request #886 from yeoldegrove/fix/gcp_gcloud_sles12
gcp: fix install of gcloud tool on SLES12
2 parents d5a5856 + b1e9529 commit 6cf9266

File tree

1 file changed

+14
-10
lines changed

1 file changed

+14
-10
lines changed

salt/macros/download_from_google_storage.sls

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,22 @@
55
{% set gcloud_dir = gcloud_inst_dir~'/google-cloud-sdk' %}
66
{% set gcloud_bin_dir = '/usr/local/bin' %}
77

8+
# Fix for https://github.com/SUSE/ha-sap-terraform-deployments/issues/669
9+
# gcloud and gsutil don't support python3.4 usage
10+
{%- set python3_version = salt['cmd.run']('python3 --version').split(' ')[1] %}
11+
{%- if salt['pkg.version_cmp'](python3_version, '3.5') < 0 %}
12+
{%- set use_py2 = true %}
13+
{%- else %}
14+
{%- set use_py2 = false %}
15+
{%- endif %}
16+
817
install_gcloud:
918
cmd.run:
10-
- name: curl https://sdk.cloud.google.com | bash -s -- '--disable-prompts' '--install-dir={{ gcloud_inst_dir }}'
19+
- name: export CLOUDSDK_PYTHON; curl https://sdk.cloud.google.com | bash -s -- '--disable-prompts' '--install-dir={{ gcloud_inst_dir }}'
20+
{%- if use_py2 %}
21+
- env:
22+
- CLOUDSDK_PYTHON: python2.7
23+
{%- endif %}
1124
- unless: ls {{ gcloud_dir }}
1225
1326
/etc/profile.d/google-cloud-sdk.completion.sh:
@@ -22,15 +35,6 @@ install_gcloud:
2235
file.symlink:
2336
- target: {{ gcloud_dir }}/bin/gsutil
2437
25-
# Fix for https://github.com/SUSE/ha-sap-terraform-deployments/issues/669
26-
# gcloud and gsutil don't support python3.4 usage
27-
{%- set python3_version = salt['cmd.run']('python3 --version').split(' ')[1] %}
28-
{%- if salt['pkg.version_cmp'](python3_version, '3.5') < 0 %}
29-
{%- set use_py2 = true %}
30-
{%- else %}
31-
{%- set use_py2 = false %}
32-
{%- endif %}
33-
3438
configure_gcloud_credentials:
3539
cmd.run:
3640
- name: {{ gcloud_bin_dir }}/gcloud auth activate-service-account --key-file {{ credentials_file }}

0 commit comments

Comments
 (0)