acme with gcloud DNS - python error

Started by siga75, July 05, 2020, 10:56:10 AM

Previous topic - Next topic
gcloud validation does not work anymore since the last 20.1.8 update

Also manually using gcloud command does not works:

[root@myfw ~]# gcloud dns record-sets list -z internal
ERROR: gcloud failed to load: No module named _sqlite3
    gcloud_main = _import_gcloud_main()
    import googlecloudsdk.gcloud_main
    from googlecloudsdk.api_lib.iamcredentials import util as iamcred_util
    from googlecloudsdk.core.credentials import http as http_creds
    from googlecloudsdk.core.credentials import creds as core_creds
    import sqlite3
    from dbapi2 import *
    from _sqlite3 import *

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/local/bin/python2

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/


Adding the env var in /etc/login.conf
default:\
29         :setenv=MAIL=/var/mail/$,BLOCKSIZE=K,CLOUDSDK_PYTHON=/usr/local/bin/python3:\

And rebuilding makes the command line to correctly works

root@myfw:~ # cap_mkdb /etc/login.conf

Still acme validation does not works, I tried to add

export CLOUDSDK_PYTHON=/usr/local/bin/python3

in the following scripts, none of them solved the issue

/usr/local/bin/gcloud
/usr/local/sbin/acme.sh
/usr/local/share/examples/acme.sh/dnsapi/dns_gcloud.sh
https://www.signorini.ch
Protectli Pfsense Mi7500L6 Intel 7Th Gen Core I7 7500U 16Gb Ddr4 Ram
512Gb Msata Ssd
6 X Intel Gigabit Ethernet

it fails here

"/usr/local/share/examples/acme.sh/dnsapi/dns_gcloud.sh"

59   if ! gcloud dns record-sets transaction start \
60     --transaction-file="$tr" \
61     --zone="$managedZone"; then
62     rm -r "$trd"
63     _err "_dns_gcloud_start_tr: failed to execute transaction"
64     return 1
65   fi

doing it manually works

[root@myfw /tmp/tmp.qYVZkyNr]# gcloud dns record-sets transaction start --transaction-file /tmp/tmp.qYVZkyNr/tr.yaml --zone=internal
Transaction started [/tmp/tmp.qYVZkyNr/tr.yaml].
[root@myfw /tmp/tmp.qYVZkyNr]# echo $?
0
[root@myfw /tmp/tmp.qYVZkyNr]# cat tr.yaml
---
additions:
- kind: dns#resourceRecordSet
  name: signorini.in.
  rrdatas:
  - ns-cloud-a1.googledomains.com. cloud-dns-hostmaster.google.com. 62 21600 3600
    259200 300
  ttl: 21600
  type: SOA
deletions:
- kind: dns#resourceRecordSet
  name: signorini.in.
  rrdatas:
  - ns-cloud-a1.googledomains.com. cloud-dns-hostmaster.google.com. 61 21600 3600
    259200 300
  ttl: 21600
  type: SOA
https://www.signorini.ch
Protectli Pfsense Mi7500L6 Intel 7Th Gen Core I7 7500U 16Gb Ddr4 Ram
512Gb Msata Ssd
6 X Intel Gigabit Ethernet