こんにちは、MLBお兄さんこと松村です。
MLB は開幕して1ヶ月が経過しました。その間、我がニューヨーク・ヤンキースは11連勝を記録するなど、AL東地区首位を走っています。(2022/05/14 現在)
私の Azure サブスクリプションに作成している Azure Cloud Shell において az webpp
コマンドが動作しなくなりました。
Azure CLI の GitHub リポジトリにフィードバックを行い、解決方法を聞いたので共有します。
エラー内容
The command failed with an unexpected error. Here is the traceback: No module named 'vsts_cd_manager' Traceback (most recent call last): File "/opt/az/lib/python3.8/site-packages/knack/cli.py", line 231, in invoke cmd_result = self.invocation.execute(args) File "/opt/az/lib/python3.8/site-packages/azure/cli/core/commands/__init__.py", line 583, in execute parsed_args = self.parser.parse_args(args) File "/opt/az/lib/python3.8/site-packages/knack/parser.py", line 261, in parse_args return super().parse_args(args) File "/opt/az/lib/python3.8/argparse.py", line 1768, in parse_args args, argv = self.parse_known_args(args, namespace) File "/opt/az/lib/python3.8/site-packages/azure/cli/core/parser.py", line 284, in parse_known_args self._namespace, self._raw_arguments = super().parse_known_args(args=args, namespace=namespace) File "/opt/az/lib/python3.8/argparse.py", line 1800, in parse_known_args namespace, args = self._parse_known_args(args, namespace) File "/opt/az/lib/python3.8/argparse.py", line 1988, in _parse_known_args positionals_end_index = consume_positionals(start_index) File "/opt/az/lib/python3.8/argparse.py", line 1965, in consume_positionals take_action(action, args) File "/opt/az/lib/python3.8/argparse.py", line 1874, in take_action action(self, namespace, argument_values, option_string) File "/opt/az/lib/python3.8/argparse.py", line 1159, in __call__ subnamespace, arg_strings = parser.parse_known_args(arg_strings, None) File "/opt/az/lib/python3.8/site-packages/azure/cli/core/parser.py", line 284, in parse_known_args self._namespace, self._raw_arguments = super().parse_known_args(args=args, namespace=namespace) File "/opt/az/lib/python3.8/argparse.py", line 1800, in parse_known_args namespace, args = self._parse_known_args(args, namespace) File "/opt/az/lib/python3.8/argparse.py", line 2006, in _parse_known_args start_index = consume_optional(start_index) File "/opt/az/lib/python3.8/argparse.py", line 1946, in consume_optional take_action(action, args, option_string) File "/opt/az/lib/python3.8/argparse.py", line 1874, in take_action action(self, namespace, argument_values, option_string) File "/opt/az/lib/python3.8/argparse.py", line 1044, in __call__ parser.print_help() File "/opt/az/lib/python3.8/argparse.py", line 2494, in print_help self._print_message(self.format_help(), file) File "/opt/az/lib/python3.8/site-packages/azure/cli/core/parser.py", line 195, in format_help super(AzCliCommandParser, self).format_help() File "/opt/az/lib/python3.8/site-packages/knack/parser.py", line 248, in format_help self.cli_help.show_help(self.prog.split()[0], File "/opt/az/lib/python3.8/site-packages/azure/cli/core/_help.py", line 165, in show_help else self.group_help_cls(self, delimiters, parser) File "/opt/az/lib/python3.8/site-packages/knack/help.py", line 253, in __init__ child.load(options) File "/opt/az/lib/python3.8/site-packages/azure/cli/core/_help.py", line 303, in load loader.versioned_load(self, options) File "/opt/az/lib/python3.8/site-packages/azure/cli/core/_help_loaders.py", line 154, in versioned_load super(CliHelpFile, help_obj).load(parser) # pylint:disable=bad-super-call File "/opt/az/lib/python3.8/site-packages/knack/help.py", line 198, in load description = getattr(options, 'description', None) File "/opt/az/lib/python3.8/site-packages/knack/parser.py", line 241, in __getattribute__ self.description = self._description() \ File "/opt/az/lib/python3.8/site-packages/azure/cli/core/commands/command_operation.py", line 133, in description_loader op = self.get_op_handler(self.op_path) File "/opt/az/lib/python3.8/site-packages/azure/cli/core/commands/command_operation.py", line 59, in get_op_handler handler = import_module(mod_to_import) File "/opt/az/lib/python3.8/importlib/__init__.py", line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "<frozen importlib._bootstrap>", line 1014, in _gcd_import File "<frozen importlib._bootstrap>", line 991, in _find_and_load File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 671, in _load_unlocked File "<frozen importlib._bootstrap_external>", line 843, in exec_module File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed File "/home/xxx/.azure/cliextensions/appservice-kube/azext_appservice_kube/custom.py", line 90, in <module> from .vsts_cd_provider import VstsContinuousDeliveryProvider File "/home/xxx/.azure/cliextensions/appservice-kube/azext_appservice_kube/vsts_cd_provider.py", line 8, in <module> from vsts_cd_manager.continuous_delivery_manager import ContinuousDeliveryManager ModuleNotFoundError: No module named 'vsts_cd_manager'
※一部表記をマスクしています
フィードバックする
Azure CLI のコマンドのフィードバックを行いたい場合、リポジトリに Issue をいちから作成してもいいのですが、手っ取り早いのは az feedback
コマンドを実行することです。
az feedback
コマンドでは、過去に実行したコマンドのフィードバック Issue を作成するための URL を案内してくれます。
$ az feedback We appreciate your feedback! For more information on getting started, visit: aka.ms/azcli/get-started If you have questions, visit our Stack Overflow page: aka.ms/azcli/questions Please let us know how we are doing: https://aka.ms/azureclihats Recent commands: [0] create a generic issue. [1] az account set : SUCCESS. Ran: 3 hrs 01 mins ago. [2] az extension remove: SUCCESS. Ran: 2 hrs 59 mins ago. [3] az extension add : SUCCESS. Ran: 2 hrs 59 mins ago. [4] az webapp : FAILURE. Ran: 2 hrs 47 mins ago. [5] az login : SUCCESS. Ran: 2 hrs 45 mins ago. [6] az account set : SUCCESS. Ran: 2 hrs 45 mins ago. [7] az webapp : FAILURE. Ran: 2 hrs 43 mins ago. [8] az login : SUCCESS. Ran: 1 mins ago. [9] az account set : SUCCESS. Ran: 1 mins ago. Enter the number of the command you would like to create an issue for. Enter q to quit:
例えば4番目の az webpp
コマンドのフィードバックを送りたい場合、上記段階で「4」と入力します。
すると Issue をさくっと作成できる URL を発行してくれます。この URL にアクセスして Issue を作成しましょう。
Enter the number of the command you would like to create an issue for. Enter q to quit: 4 * If possible, a browser will be opened to aka.ms/azcli/issues to create an issue. * If the URL length exceeds GitHub or the browser's limitation and causes the content to be trimmed, you can run `az feedback --verbose` to emit the full issue draft to stderr. * Azure CLI repo: aka.ms/azcli/issues * Azure CLI Extensions repo: aka.ms/azcli/ext/issues There isn't an available browser to create an issue draft. You can copy and paste the url below in a browser to submit. https://github.com/azure/azure-cli/issues/new?body=(省略) Thanks for your feedback!
実際に私が作成した Issue はこちらです。
CLI 拡張機能を再インストールして解決
回答によると、原因は不明だけど appservice-kube
拡張機能の問題で似たような事象が起きたことがあるとのこと。
appservice-kube
拡張機能を再インストールしてみるとエラーが解消しました。
$ az extension remove -n appservice-kube $ az extension add -n appservice-kube The installed extension 'appservice-kube' is in preview.
$ az webapp the following arguments are required: _subcommand Examples from AI knowledge base: az webapp list --query "[].{hostName: defaultHostName, state: state}" List default host name and state for all web apps. https://docs.microsoft.com/en-US/cli/azure/webapp#az_webapp_list Read more about the command in reference docs
※はじめは勘違いして Azure CLI 自体の更新 az upgrade
を行おうとしました(コケました)
同様の事象が起きた方は参考にしてみてください。