Skip to content

Commit

Permalink
Merge pull request #886 from yeoldegrove/fix/gcp_gcloud_sles12
Browse files Browse the repository at this point in the history
gcp: fix install of gcloud tool on SLES12
  • Loading branch information
yeoldegrove authored Aug 16, 2022
2 parents d5a5856 + b1e9529 commit 6cf9266
Showing 1 changed file with 14 additions and 10 deletions.
24 changes: 14 additions & 10 deletions salt/macros/download_from_google_storage.sls
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,22 @@
{% set gcloud_dir = gcloud_inst_dir~'/google-cloud-sdk' %}
{% set gcloud_bin_dir = '/usr/local/bin' %}

# Fix for https://github.com/SUSE/ha-sap-terraform-deployments/issues/669
# gcloud and gsutil don't support python3.4 usage
{%- set python3_version = salt['cmd.run']('python3 --version').split(' ')[1] %}
{%- if salt['pkg.version_cmp'](python3_version, '3.5') < 0 %}
{%- set use_py2 = true %}
{%- else %}
{%- set use_py2 = false %}
{%- endif %}

install_gcloud:
cmd.run:
- name: curl https://sdk.cloud.google.com | bash -s -- '--disable-prompts' '--install-dir={{ gcloud_inst_dir }}'
- name: export CLOUDSDK_PYTHON; curl https://sdk.cloud.google.com | bash -s -- '--disable-prompts' '--install-dir={{ gcloud_inst_dir }}'
{%- if use_py2 %}
- env:
- CLOUDSDK_PYTHON: python2.7
{%- endif %}
- unless: ls {{ gcloud_dir }}
/etc/profile.d/google-cloud-sdk.completion.sh:
Expand All @@ -22,15 +35,6 @@ install_gcloud:
file.symlink:
- target: {{ gcloud_dir }}/bin/gsutil
# Fix for https://github.com/SUSE/ha-sap-terraform-deployments/issues/669
# gcloud and gsutil don't support python3.4 usage
{%- set python3_version = salt['cmd.run']('python3 --version').split(' ')[1] %}
{%- if salt['pkg.version_cmp'](python3_version, '3.5') < 0 %}
{%- set use_py2 = true %}
{%- else %}
{%- set use_py2 = false %}
{%- endif %}

configure_gcloud_credentials:
cmd.run:
- name: {{ gcloud_bin_dir }}/gcloud auth activate-service-account --key-file {{ credentials_file }}
Expand Down

0 comments on commit 6cf9266

Please sign in to comment.