Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix 'Namespace' object has no attribute 'upgradeable_to' #3979

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

bitoku
Copy link
Collaborator

@bitoku bitoku commented Nov 27, 2024

Which issue this PR addresses:

Fixes N/A

What this PR does / why we need it:

When I try to create a cluster with --client-id and --client-secret, it failed with the error 'Namespace' object has no attribute 'upgradeable_to'.

--upgradeable-to doesn't exist for create subcommand, but --client-id and --client-secret options have a validation to validate namespace.upgradeable_to.
So the validator tries to access namespace.upgradeable_to and it failed.

This PR makes the validator aware of if it is create or update, and don't validate upgradeable_to when it is create.

This is the error I got (with --debug)

❯ az aro create \
--resource-group $MY_RESOURCEGROUP \
--name $MY_CLUSTER \
--vnet aro-vnet \
--master-subnet master-subnet \
--worker-subnet worker-subnet \
--pull-secret @/Users/atokubi/Downloads/pull-secret.txt \
--version 4.15.35 \
--cluster-resource-group aro-$MY_CLUSTER \
--client-id *** \
--client-secret ***
...
cli.azure.cli.core.azclierror: Traceback (most recent call last):
  File "/usr/local/Cellar/azure-cli/2.59.0/libexec/lib/python3.11/site-packages/knack/invocation.py", line 113, in _validation
    self._validate_arg_level(parsed_ns)
  File "/usr/local/Cellar/azure-cli/2.59.0/libexec/lib/python3.11/site-packages/azure/cli/core/commands/__init__.py", line 894, in _validate_arg_level
    validator(**self._build_kwargs(validator, ns))
  File "/Users/atokubi/ARO-RP/python/az/aro/azext_aro/_validators.py", line 55, in validate_client_id
    if namespace.upgradeable_to is not None:
       ^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'Namespace' object has no attribute 'upgradeable_to'

Test plan for issue:

Cluster creation with az cli.

Is there any documentation that needs to be updated for this PR?

N/A

How do you know this will function as expected in production?

cluster creation with az cli.

@bitoku
Copy link
Collaborator Author

bitoku commented Nov 27, 2024

@slawande2 Can you PTAL and confirm this change doesn't break your change #3844 ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant