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

Registry task upgrade #743

Merged
merged 7 commits into from
Apr 13, 2021
Merged

Conversation

mikhailshilkov
Copy link
Member

Use the 2019-06-01-preview version for the containerregistry.Task resource, fix #736

@@ -21,10 +21,13 @@ class GetTaskResult:
The task that has the ARM resource and task properties.
The task will have all information to schedule a run against it.
"""
def __init__(__self__, agent_configuration=None, creation_date=None, credentials=None, id=None, identity=None, location=None, name=None, platform=None, provisioning_state=None, status=None, step=None, tags=None, timeout=None, trigger=None, type=None):
def __init__(__self__, agent_configuration=None, agent_pool_name=None, creation_date=None, credentials=None, id=None, identity=None, is_system_task=None, location=None, log_template=None, name=None, platform=None, provisioning_state=None, status=None, step=None, system_data=None, tags=None, timeout=None, trigger=None, type=None):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not specifically related to this PR, but this signature change could break positional arg usage. I'm not sure if it's worth appending new parameters rather than alphabetizing to avoid this. (Sacrifices readability in favor of compatibility)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, interesting. Do you know how we handle this in TF-based providers?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure. My guess is that we're clobbering the existing signature in the same way. Most users are likely to use kwargs given the long list of options on most resources, but this could lead to subtle breaks if not.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It doesn't look arbitrary to me. If something becomes Optional then it has a default value passed in, and so it has to go after the args that don't have default values.

At least, the gcp example doesn't look arbitrary to me. It looks like the example commented on here is sorted by alphabetical order.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A couple things worth noting here:

  1. GetTaskResult is the result of an invoke, which we instantiate internally. It's likely very rare that anyone would be calling its __init__.
  2. For TArgs classes, I've deliberately added a * parameter, which forces users to use kwargs to avoid this issue with positional arguments.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But yeah, I don't know how common it is for folks to use positional args. And in fact, with the new ResourceArgs changes in the python SDK I'm not sure it's even possible to use positional args now.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It doesn't look arbitrary to me

Yes, probably my bad wording. I meant that any argument may get a default value in a minor release and end up changing the position.

But it looks like you have it under control 👍

@mikhailshilkov mikhailshilkov merged commit 48d188d into master Apr 13, 2021
@pulumi-bot pulumi-bot deleted the mikhailshilkov/registry-task-upgrade branch April 13, 2021 20:05
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.

containerregistry:Task resource fails to create with InvalidRequestBody error
4 participants