Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 0 additions & 43 deletions src/azure-cli/azure/cli/command_modules/acr/check_health.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@
MIN_HELM_VERSION = "2.11.0"
HELM_VERSION_REGEX = re.compile(r'(SemVer|Version):"v([.\d]+)"')
ACR_CHECK_HEALTH_MSG = "Try running 'az acr check-health -n {} --yes' to diagnose this issue."
RECOMMENDED_NOTARY_VERSION = "0.6.0"
NOTARY_VERSION_REGEX = re.compile(r'Version:\s+([.\d]+)')
DOCKER_PULL_WRONG_PLATFORM = 'cannot be used on this platform'


Expand Down Expand Up @@ -167,46 +165,6 @@ def _get_helm_version(ignore_errors):
_handle_error(obsolete_ver_error, ignore_errors)


def _get_notary_version(ignore_errors):
from ._errors import NOTARY_VERSION_ERROR
from .notary import get_notary_command
from packaging.version import parse # pylint: disable=import-error,no-name-in-module

# Notary command check
notary_command, error = get_notary_command(is_diagnostics_context=True)

if error:
_handle_error(error, ignore_errors)
return

# Notary version check
output, warning, stderr, succeeded = _subprocess_communicate([notary_command, "version"])

if not succeeded:
_handle_error(NOTARY_VERSION_ERROR.append_error_message(stderr), ignore_errors)
return

if warning:
logger.warning(warning)

# Retrieve the notary version if regex pattern is found
match_obj = NOTARY_VERSION_REGEX.search(output)
if match_obj:
output = match_obj.group(1)

logger.warning("Notary version: %s", output)

# Display error if the current version does not match the recommended version
if match_obj and parse(output) != parse(RECOMMENDED_NOTARY_VERSION):
version_msg = "upgrade"
if parse(output) > parse(RECOMMENDED_NOTARY_VERSION):
version_msg = "downgrade"
obsolete_ver_error = NOTARY_VERSION_ERROR.set_error_message(
"Current notary version is not recommended. Please {} your notary client to version {}."
.format(version_msg, RECOMMENDED_NOTARY_VERSION))
_handle_error(obsolete_ver_error, ignore_errors)


# Checks for the connectivity
# Check DNS lookup and access to challenge endpoint
def _get_registry_status(login_server, registry_name, ignore_errors):
Expand Down Expand Up @@ -468,6 +426,5 @@ def acr_check_health(cmd, # pylint: disable useless-return

if not in_cloud_console:
_get_helm_version(ignore_errors)
_get_notary_version(ignore_errors)

logger.warning(FAQ_MESSAGE)
Loading