在 Ubuntu 16.04 上升级 gcloud 在 postinst 配置上失败。google-cloud-sdk 已安装并使用,没有安装问题,但这会在配置阶段中止升级。问题似乎是 postinst 脚本正在使用 Python2 解释器执行 Python3 脚本,该解释器在 Python3 语法行上失败。
# sudo dpkg --configure google-cloud-sdk
Setting up google-cloud-sdk (131.0.0-0) ...
dpkg: error processing package google-cloud-sdk (--configure):
subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
google-cloud-sdk
dpkg: error processing package google-cloud-sdk (--configure):
subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
google-cloud-sdk
# sudo dpkg --configure -D 777 google-cloud-sdk
D000001: ensure_diversions: new, (re)loading
D000001: process queue pkg google-cloud-sdk:all queue.len 0 progress 1, try 1
D000040: checking dependencies of google-cloud-sdk:all (- <none>)
D000400: checking group ...
D000400: checking possibility -> python2.7
D000400: checking non-provided pkg python2.7:amd64
D000400: is installed, ok and found
D000400: found 3
D000400: found 3 matched 0 possfixbytrig -
D000040: ok 2 msgs >><<
D000040: checking Breaks
Setting up google-cloud-sdk (131.0.0-0) ...
D000002: fork/exec /var/lib/dpkg/info/google-cloud-sdk.postinst ( configure 129.0.0-0 )
dpkg: error processing package google-cloud-sdk (--configure):
subprocess installed post-installation script returned error exit status 1
D000001: ensure_diversions: same, skipping
Errors were encountered while processing:
google-cloud-sdk
# sudo /usr/bin/gcloud components post-process
Compiling platform/gsutil/third_party/httplib2/python3/httplib2/__init__.py ...
File "platform/gsutil/third_party/httplib2/python3/httplib2/__init__.py", line 350
print('%s:' % h, end=' ', file=self._fp)
^
SyntaxError: invalid syntax
ERROR: gcloud crashed (CommandLoadFailure): Problem loading gcloud.dns.record-sets.import: 'module' object has no attribute 'CAA'.
If you would like to report this issue, please run the following command:
gcloud feedback
# sudo which python; sudo python --version
/usr/bin/python
Python 2.7.12
# sudo which python3; sudo python3 --version
/usr/bin/python3
Python 3.5.2
Trace:
/usr/lib/google-cloud-sdk/gcloud_main.py:130
gcloud_cli.Execute()
[...]
/usr/lib/google-cloud-sdk/calliope/backend.py:1630
resources = command_instance.Run(args)
surface/components/post_process.py:40
table.Update(self.cli)
/usr/lib/google-cloud-sdk/command_lib/static_completion/table.py:154
table = CompletionTableGenerator(cli).Wa...
/usr/lib/google-cloud-sdk/calliope/walker.py:98
root.LoadAllSubElements(recursive=True)
/usr/lib/google-cloud-sdk/calliope/backend.py:1490
element.LoadAllSubElements(recursive=rec...
/usr/lib/google-cloud-sdk/calliope/backend.py:1490
element.LoadAllSubElements(recursive=rec...
/usr/lib/google-cloud-sdk/calliope/backend.py:1488
element = self.LoadSubElement(name)
/usr/lib/google-cloud-sdk/calliope/backend.py:1528
parent_group=self)
/usr/lib/google-cloud-sdk/calliope/backend.py:1592
self._GetModuleFromPath(module_dir, modu...
/usr/lib/google-cloud-sdk/calliope/backend.py:1258
name_to_give, os.path.join(module_dir, *...
/usr/lib/google-cloud-sdk/core/util/pkg_resources.py:108
module = imp.load_module(name_to_give, f...
surface/dns/record_sets/import.py:19
from googlecloudsdk.api_lib.dns import i...
/usr/lib/google-cloud-sdk/api_lib/dns/import_util.py:162
rdatatype.CAA: _CAATranslation,
CommandLoadFailure: Problem loading gcloud.dns.record-sets.import: 'module' object has no attribute 'CAA'.
[output truncated]
# sudo gcloud --version
Google Cloud SDK 131.0.0
alpha 2016.10.17
beta 2016.10.17
bq 2.0.24
bq-nix 2.0.24
core 2016.10.17
core-nix 2016.10.17
gcloud
gsutil 4.21
gsutil-nix 4.21