SUSE / ha-sap-terraform-deployments

Automated SAP/HA Deployments in Public/Private Clouds
GNU General Public License v3.0
122 stars 88 forks source link

gcloud CLI installation failure using SLES 12 SPx for SAP Applications #884

Closed ab-mohamed closed 2 years ago

ab-mohamed commented 2 years ago

Used cloud platform GCP

Used SLES4SAP version SLES 12 SP4 for SAP applications

Used client machine OS macOS

Expected behaviour vs observed behaviour a successful HANA HA cluster deployment

How to reproduce

  1. Default deployment using the terraform apply --auto-approve command
  2. The deployment was failed as shown in the Used terraform.tfvars section
  3. gcloud was not configured correctly in the HANA nodes:
    
    ab-testing-vmhana01:~ # gcloud
    ERROR: gcloud failed to load: No module named 'typing'
    gcloud_main = _import_gcloud_main()
    import googlecloudsdk.gcloud_main
    from googlecloudsdk.calliope import base
    from googlecloudsdk.calliope import display
    from googlecloudsdk.calliope import display_taps
    from googlecloudsdk.core.resource import resource_printer_base
    from googlecloudsdk.core.resource import resource_projector
    import proto  # pylint: disable=g-import-not-at-top
    from .enums import Enum
    from proto.marshal.rules.enums import EnumRule
    from typing import Type

This usually indicates corruption in your gcloud installation or problems with your Python interpreter.

Please verify that the following is the path to a working Python 2.7 or 3.5+ executable: /usr/bin/python3

If it is not, please set the CLOUDSDK_PYTHON environment variable to point to a working Python 2.7 or 3.5+ executable.

If you are still experiencing problems, please reinstall the Cloud SDK using the instructions here: https://cloud.google.com/sdk/

4. Python 3.5+ is not available for SLES 12 SP4, so I used python 2.7:

ab-testing-vmhana01:~ # which python2.7 /usr/bin/python2.7

ab-testing-vmhana01:~ # export CLOUDSDK_PYTHON=/usr/bin/python2.7

ab-testing-vmhana01:~ # echo $CLOUDSDK_PYTHON /usr/bin/python2.7

5.  `gsutil` was not installed:

ab-testing-vmhana01:~ # ls -lh /usr/local/bin/ total 0 lrwxrwxrwx 1 root root 32 Aug 10 13:28 gcloud -> /opt/google-cloud-sdk/bin/gcloud lrwxrwxrwx 1 root root 32 Aug 10 13:28 gsutil -> /opt/google-cloud-sdk/bin/gsutil

ab-testing-vmhana01:~ # ls -lh /opt/google-cloud-sdk/bin/gsutil ls: cannot access '/opt/google-cloud-sdk/bin/gsutil': No such file or directory

ab-testing-vmhana01:~ # ls /opt/google-cloud-sdk/bin/ bootstrapping dev_appserver.py endpointscfg.py gcloud java_dev_appserver.sh

6. I reinstalled `gcloud` following the instructions in https://cloud.google.com/sdk/docs/install:

ab-testing-vmhana01:~ # rm -rf ~/.config/gcloud ab-testing-vmhana01:~ # rm -rf /opt/google-cloud-sdk/

ab-testing-vmhana01:~ # curl -O https://dl.google.com/dl/cloudsdk/channels/rapid/downloads/google-cloud-cli-397.0.0-linux- ab-testing-vmhana01:~ # tar xvf google-cloud-cli-397.0.0-linux-x86_64.tar.gz ab-testing-vmhana01:~ # cd google-cloud-sdk/ ab-testing-vmhana01:~/google-cloud-sdk # ./install.sh ab-testing-vmhana01:~/google-cloud-sdk # gcloud init

ab-testing-vmhana01:~ # gcloud init
ab-testing-vmhana01:~ # gsutil -m cp -r gs:///* /sapmedia/HANA ab-testing-vmhana01:~ # echo $? 0


**Used terraform.tfvars**

$ grep -v "#" terraform.tfvars | awk NF project = "" gcp_credentials_file = "" region = "us-west1" os_image = "suse-sap-cloud/sles-12-sp4-sap" public_key = "" private_key = "" cluster_ssh_pub = "salt://sshkeys/cluster.id_rsa.pub" cluster_ssh_key = "salt://sshkeys/cluster.id_rsa" ha_sap_deployment_repo = "https://download.opensuse.org/repositories/network:ha-clustering:sap-deployments:v8/" provisioning_log_level = "info" pre_deployment = true bastion_enabled = true bastion_nat_min_ports_per_vm = 1204 machine_type = "n1-highmem-4" hana_data_disk_size = 350 hana_backup_disk_size = "100" hana_inst_master = "" hana_master_password = "" hana_primary_site = "NUE" hana_secondary_site = "FRA"


**Logs**

module.hana_node.module.hana_provision.null_resource.provision[0] (remote-exec): ---------- module.hana_node.module.hana_provision.null_resource.provision[0] (remote-exec): ID: install_gcloud module.hana_node.module.hana_provision.null_resource.provision[0] (remote-exec): Function: cmd.run module.hana_node.module.hana_provision.null_resource.provision[0] (remote-exec): Name: curl https://sdk.cloud.google.com | bash -s -- '--disable-prompts' '--install-dir=/opt' module.hana_node.module.hana_provision.null_resource.provision[0] (remote-exec): Result: False module.hana_node.module.hana_provision.null_resource.provision[0] (remote-exec): Comment: Command "curl https://sdk.cloud.google.com | bash -s -- '--disable-prompts' '--install-dir=/opt'" run module.hana_node.module.hana_provision.null_resource.provision[0] (remote-exec): Started: 13:28:03.671651 module.hana_node.module.hana_provision.null_resource.provision[0] (remote-exec): Duration: 4569.941 ms module.hana_node.module.hana_provision.null_resource.provision[0] (remote-exec): Changes: [...] module.hana_node.module.hana_provision.null_resource.provision[0] (remote-exec): ---------- module.hana_node.module.hana_provision.null_resource.provision[0] (remote-exec): ID: configure_gcloud_credentials module.hana_node.module.hana_provision.null_resource.provision[0] (remote-exec): Function: cmd.run module.hana_node.module.hana_provision.null_resource.provision[0] (remote-exec): Name: /usr/local/bin/gcloud auth activate-service-account --key-file /root/google_credentials.json module.hana_node.module.hana_provision.null_resource.provision[0] (remote-exec): Result: False module.hana_node.module.hana_provision.null_resource.provision[0] (remote-exec): Comment: One or more requisite failed: hana_node.download_hana_inst.install_gcloud module.hana_node.module.hana_provision.null_resource.provision[0] (remote-exec): Started: 13:28:08.411100 module.hana_node.module.hana_provision.null_resource.provision[0] (remote-exec): Duration: 0.017 ms module.hana_node.module.hana_provision.null_resource.provision[0] (remote-exec): Changes: [...] module.hana_node.module.hana_provision.null_resource.provision[0] (remote-exec): ---------- module.hana_node.module.hana_provision.null_resource.provision[0] (remote-exec): ID: download_files_from_gcp module.hana_node.module.hana_provision.null_resource.provision[0] (remote-exec): Function: cmd.run module.hana_node.module.hana_provision.null_resource.provision[0] (remote-exec): Name: /usr/local/bin/gsutil -m cp -r gs:///* /sapmedia/HANA module.hana_node.module.hana_provision.null_resource.provision[0] (remote-exec): Result: False module.hana_node.module.hana_provision.null_resource.provision[0] (remote-exec): Comment: One or more requisite failed: hana_node.download_hana_inst.install_gcloud module.hana_node.module.hana_provision.null_resource.provision[0] (remote-exec): Started: 13:28:08.411506 module.hana_node.module.hana_provision.null_resource.provision[0] (remote-exec): Duration: 0.01 ms module.hana_node.module.hana_provision.null_resource.provision[0] (remote-exec): Changes:


module.hana_node.module.hana_provision.null_resource.provision[0] (remote-exec): Summary for local module.hana_node.module.hana_provision.null_resource.provision[0] (remote-exec): ------------- module.hana_node.module.hana_provision.null_resource.provision[0] (remote-exec): Succeeded: 49 (changed=46) module.hana_node.module.hana_provision.null_resource.provision[0] (remote-exec): Failed: 3 module.hana_node.module.hana_provision.null_resource.provision[0] (remote-exec): ------------- module.hana_node.module.hana_provision.null_resource.provision[0] (remote-exec): Total states run: 52 module.hana_node.module.hana_provision.null_resource.provision[0] (remote-exec): Total run time: 90.835 s module.hana_node.module.hana_provision.null_resource.provision[0] (remote-exec): Wed Aug 10 13:28:20 UTC 2022::ab-testing-vmhana01::[ERROR] predeployment failed

ab-mohamed commented 2 years ago

I had a successful deployment using SLES 15 SP3 for SAP Applications. So, It seems to be an issue with the CLOUDSDK_PYTHON variable for SLES 12 SPx for SAP applications.

yeoldegrove commented 2 years ago

@ab-mohamed A fix is on the way. Fixing a few other SLES12 related things on the way.

yeoldegrove commented 2 years ago

886 will fix the issue

yeoldegrove commented 2 years ago

fixed in #886 and released in https://github.com/SUSE/ha-sap-terraform-deployments/releases/tag/8.1.6