az acr build command fails "NotImplementedError: APIVersion 2019-06-01-preview is not available" - azure-cli

I am running the following command in my AML workspace in a jupyter notebook:
!az acr build --image mlnet --subscription $ws.subscription_id --registry $cr --file docker/Dockerfile docker/
The command fails with the following error:
APIVersion 2019-06-01-preview is not available
Traceback (most recent call last):
File "/anaconda/envs/azureml_py36/lib/python3.6/site-packages/knack/cli.py", line 215, in invoke
cmd_result = self.invocation.execute(args)
File "/anaconda/envs/azureml_py36/lib/python3.6/site-packages/azure/cli/core/commands/__init__.py", line 631, in execute
raise ex
File "/anaconda/envs/azureml_py36/lib/python3.6/site-packages/azure/cli/core/commands/__init__.py", line 695, in _run_jobs_serially
results.append(self._run_job(expanded_arg, cmd_copy))
File "/anaconda/envs/azureml_py36/lib/python3.6/site-packages/azure/cli/core/commands/__init__.py", line 688, in _run_job
six.reraise(*sys.exc_info())
File "/anaconda/envs/azureml_py36/lib/python3.6/site-packages/six.py", line 703, in reraise
raise value
File "/anaconda/envs/azureml_py36/lib/python3.6/site-packages/azure/cli/core/commands/__init__.py", line 665, in _run_job
result = cmd_copy(params)
File "/anaconda/envs/azureml_py36/lib/python3.6/site-packages/azure/cli/core/commands/__init__.py", line 324, in __call__
return self.handler(*args, **kwargs)
File "/anaconda/envs/azureml_py36/lib/python3.6/site-packages/azure/cli/core/__init__.py", line 565, in default_command_handler
client = client_factory(cmd.cli_ctx, command_args) if client_factory else None
File "/anaconda/envs/azureml_py36/lib/python3.6/site-packages/azure/cli/command_modules/acr/_client_factory.py", line 47, in cf_acr_runs
return get_acr_service_client(cli_ctx, VERSION_2019_06_01_PREVIEW).runs
File "/anaconda/envs/azureml_py36/lib/python3.6/site-packages/azure/mgmt/containerregistry/container_registry_management_client.py", line 246, in runs
raise NotImplementedError("APIVersion {} is not available".format(api_version))
NotImplementedError: APIVersion 2019-06-01-preview is not available
To open an issue, please run: 'az feedback'
How can I debug and get past this error?

Looks like updating the cli version solves the issue. I faced the same issue. Upgraded azure cli version using the below command. After the upgrade acr commands worked fine.
pip install --upgrade azure-cli

Related

Elastic Beanstalk deployment fail cfnbootstrap.construction_errors.ToolError

My eb is on Amazon linux server:
without this command in config file my file deployed successfully
commands:
brewCommands:
command: brew install antiword
but when i added this, it is throwing error
cfnbootstrap.construction_errors.ToolError:
here is my cfn-init.log file error
Unhandled exception during build: Command 001_install failed Traceback (most recent call last):
File "/opt/aws/bin/cfn-init", line 176, in <module>
worklog.build(metadata, configSets) File "/usr/lib/python3.7/site-packages/cfnbootstrap/construction.py", line 137, in build
Contractor(metadata).build(configSets, self) File "/usr/lib/python3.7/site-packages/cfnbootstrap/construction.py", line 564, in build
self.run_config(config, worklog) File "/usr/lib/python3.7/site-packages/cfnbootstrap/construction.py", line 576, in run_config
CloudFormationCarpenter(config, self._auth_config).build(worklog) File "/usr/lib/python3.7/site-packages/cfnbootstrap/construction.py", line 276, in build
self._config.commands) File "/usr/lib/python3.7/site-packages/cfnbootstrap/command_tool.py", line 127, in apply
raise ToolError(u"Command %s failed" % name)
cfnbootstrap.construction_errors.ToolError: Command 001_install failed

MkDocs RuntimeError: StopIteration on mkdocs serve

I'm trying to run MkDocs and getting a StopIteration error when running mkdocs serve. This is on a fresh MkDocs project. I've installed MkDocs, ran mkdocs new my-project and then mkdocs serve.
It appears the file_match variable is empty on line 345 of config_options.py but I can't figure out what populates file_match. Is there an additional step between installing MkDocs and then using it that I'm missing?
Thanks for any help. My full stack trace is below.
Traceback (most recent call last):
File "/usr/local/lib/python3.8/site-packages/mkdocs/config/config_options.py", line 345, in walk_docs_dir
raise StopIteration
StopIteration
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/usr/local/bin/mkdocs", line 8, in <module>
sys.exit(cli())
File "/usr/local/lib/python3.8/site-packages/click/core.py", line 829, in __call__
return self.main(*args, **kwargs)
File "/usr/local/lib/python3.8/site-packages/click/core.py", line 782, in main
rv = self.invoke(ctx)
File "/usr/local/lib/python3.8/site-packages/click/core.py", line 1259, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/usr/local/lib/python3.8/site-packages/click/core.py", line 1066, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/usr/local/lib/python3.8/site-packages/click/core.py", line 610, in invoke
return callback(*args, **kwargs)
File "/usr/local/lib/python3.8/site-packages/mkdocs/__main__.py", line 110, in serve_command
serve.serve(
File "/usr/local/lib/python3.8/site-packages/mkdocs/commands/serve.py", line 78, in serve
config = builder()
File "/usr/local/lib/python3.8/site-packages/mkdocs/commands/serve.py", line 67, in builder
config = load_config(
File "/usr/local/lib/python3.8/site-packages/mkdocs/config/base.py", line 151, in load_config
errors, warnings = cfg.validate()
File "/usr/local/lib/python3.8/site-packages/mkdocs/config/base.py", line 84, in validate
self._post_validate()
File "/usr/local/lib/python3.8/site-packages/mkdocs/config/base.py", line 73, in _post_validate
config_option.post_validation(self, key_name=key)
File "/usr/local/lib/python3.8/site-packages/mkdocs/config/config_options.py", line 370, in post_validation
for filename in self.walk_docs_dir(config['docs_dir']):
RuntimeError: generator raised StopIteration

AttributeError in generating peewee model from mysql using pwiz

When i run pwiz to generate a peewee modem from existing database it shows following error:
root#server:~# python -m pwiz -e mysql -P -H 127.0.0.1 mysql
Traceback (most recent call last):
File "/usr/lib/python2.7/runpy.py", line 162, in _run_module_as_main
"__main__", fname, loader, pkg_name)
File "/usr/lib/python2.7/runpy.py", line 72, in _run_code
exec code in run_globals
File "/usr/local/lib/python2.7/dist-packages/pwiz.py", line 202, in <module>
print_models(introspector, tables, preserve_order=options.preserve_order)
File "/usr/local/lib/python2.7/dist-packages/pwiz.py", line 47, in print_models
database = introspector.introspect(table_names=tables)
File "/usr/local/lib/python2.7/dist-packages/playhouse/reflection.py", line 440, in introspect
tables = self.metadata.database.get_tables()
File "/usr/local/lib/python2.7/dist-packages/peewee.py", line 3089, in get_tables
return [table for table, in self.execute_sql('SHOW TABLES')]
File "/usr/local/lib/python2.7/dist-packages/peewee.py", line 2459, in execute_sql
cursor = self.cursor(commit)
File "/usr/local/lib/python2.7/dist-packages/peewee.py", line 2445, in cursor
self.connect()
File "/usr/local/lib/python2.7/dist-packages/peewee.py", line 2411, in connect
self._state.set_connection(self._connect())
File "/usr/local/lib/python2.7/dist-packages/peewee.py", line 3083, in _connect
return mysql.connect(db=self.database, **self.connect_params)
AttributeError: 'NoneType' object has no attribute 'connect'
What is the problem? The username and password of database is correct.
PyMySql is not installed. Install it using pip or other available options:
pip install PyMySql
Unfortunately, peewee does not write `PyMySql1 module of python in its dependency list, so it should be installed separately.

Login to the Azure-container-service fails with error 'bool' object has no attribute 'rstrip' using Azure CLI

Issue :
az acr login --name test1acr
Azure CLI version : azure-cli (2.0.24)
docker version :17.12.0-ce
Error : 'bool' object has no attribute 'rstrip' Traceback (most recent
call last): File
"/home/vagrant/lib/azure-cli/lib/python2.7/site-packages/knack/cli.py",
line 193, in invoke
cmd_result = self.invocation.execute(args) File "/home/vagrant/lib/azure-cli/lib/python2.7/site-packages/azure/cli/core/commands/init.py", line 319, in execute
six.reraise(*sys.exc_info()) File "/home/vagrant/lib/azure-cli/lib/python2.7/site-packages/azure/cli/core/commands/init.py", line 292, in execute
result = cmd(params) File "/home/vagrant/lib/azure-cli/lib/python2.7/site-packages/azure/cli/core/commands/init.py", line 169, in call
return super(AzCliCommand, self).call(*args, **kwargs) File "/home/vagrant/lib/azure-cli/lib/python2.7/site-packages/knack/commands.py",
line 109, in call
return self.handler(*args, **kwargs) File "/home/vagrant/lib/azure-cli/lib/python2.7/site-packages/azure/cli/core/init.py",
line 328, in default_command_handler
result = op(**command_args) File "/home/vagrant/lib/azure-cli/lib/python2.7/site-packages/azure/cli/command_modules/acr/custom.py",
line 195, in acr_login
password=password) File "/home/vagrant/lib/azure-cli/lib/python2.7/site-packages/azure/cli/command_modules/acr/_docker_utils.py",
line 194, in get_login_credentials
only_refresh_token=True) File "/home/vagrant/lib/azure-cli/lib/python2.7/site-packages/azure/cli/command_modules/acr/_docker_utils.py",
line 150, in _get_credentials
password = _get_aad_token(login_server, only_refresh_token, repository, permission) File
"/home/vagrant/lib/azure-cli/lib/python2.7/site-packages/azure/cli/command_modules/acr/_docker_utils.py",
line 35, in _get_aad_token
login_server = login_server.rstrip('/') AttributeError: 'bool' object has no attribute 'rstrip'
Azure cli context seems missing in the docker utils.
The below changes worked for me by modifying the _docker_utils file
File: /opt/az/lib/python3.6/site-packages/azure/cli/command_modules/acr/_docker_utils.py
Line Number: 150
- password = _get_aad_token(login_server, only_refresh_token, repository, permission)
+ password = _get_aad_token( cli_ctx , login_server, only_refresh_token, repository, permission)
It's best to move back to 2.0.23 for now, as 2.0.24 introduced a bug.

Django Unittest fails when run parallel on CircleCI

I am running Django Unit tests on CircleCI with 1 container setup. The tests run fine when I do not add Django's --parallel argument. However, when I add --parallel=2 to the test run, it fails with this cryptic error below.
I've tried both versions: with and without --keepdb - both fail with exactly the same error. The code for _clode_test_db appears to suggest that passing --keepdb=True should fail fast and return. See django/db/backends/mysql/creation.py line: 29 here [https://github.com/django/django/pull/4761/files]
Would appreciate any ideas on what is going on here
Using existing clone for alias 'default' ('test_django_learned')...
Traceback (most recent call last):
File "manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/home/circleci/sliderule/venv/lib/python2.7/site-packages/django/core/management/__init__.py", line 353, in execute_from_command_line
utility.execute()
File "/home/circleci/sliderule/venv/lib/python2.7/site-packages/django/core/management/__init__.py", line 345, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/home/circleci/sliderule/venv/lib/python2.7/site-packages/django/core/management/commands/test.py", line 30, in run_from_argv
super(Command, self).run_from_argv(argv)
File "/home/circleci/sliderule/venv/lib/python2.7/site-packages/django/core/management/base.py", line 348, in run_from_argv
self.execute(*args, **cmd_options)
File "/home/circleci/sliderule/venv/lib/python2.7/site-packages/django/core/management/commands/test.py", line 74, in execute
super(Command, self).execute(*args, **options)
File "/home/circleci/sliderule/venv/lib/python2.7/site-packages/django/core/management/base.py", line 399, in execute
output = self.handle(*args, **options)
File "/home/circleci/sliderule/venv/lib/python2.7/site-packages/django/core/management/commands/test.py", line 90, in handle
failures = test_runner.run_tests(test_labels)
File "/home/circleci/sliderule/venv/lib/python2.7/site-packages/django/test/runner.py", line 532, in run_tests
old_config = self.setup_databases()
File "/home/circleci/sliderule/venv/lib/python2.7/site-packages/django/test/runner.py", line 482, in setup_databases
self.parallel, **kwargs
File "/home/circleci/sliderule/venv/lib/python2.7/site-packages/django/test/runner.py", line 733, in setup_databases
keepdb=keepdb,
File "/home/circleci/sliderule/venv/lib/python2.7/site-packages/django/db/backends/base/creation.py", line 219, in clone_test_db
self._clone_test_db(number, verbosity, keepdb)
File "/home/circleci/sliderule/venv/lib/python2.7/site-packages/django/db/backends/mysql/creation.py", line 48, in _clone_test_db
dump_proc = subprocess.Popen(dump_cmd, stdout=subprocess.PIPE)
File "/usr/local/lib/python2.7/subprocess.py", line 390, in __init__
errread, errwrite)
File "/usr/local/lib/python2.7/subprocess.py", line 1024, in _execute_child
raise child_exception
OSError: [Errno 2] No such file or directory
Exited with code 1
I could reproduce it and debugged the problem in my ubuntu container by adding
sys.stderr.write("dump_cmd: %r" % dump_cmd)
to site-packages/django/db/backends/mysql/creation.py and it gave me
dump_cmd: ['mysqldump', '--user=root', '--password=pass', '--host=db', '--port=3306', 'test']
So probably your container is also missing mysqldump which I fixed with a simple sudo apt-get install mysql-client.