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

Use new dataflow templates, fix labels #2849

Merged

Conversation

emilymye
Copy link
Contributor

@modular-magician
Copy link
Collaborator

Hi! I'm the modular magician, I work on Magic Modules.
I see that this PR has already had some downstream PRs generated. Any open downstreams are already updated to your most recent commit, d7a83db.

Pull request statuses

No diff detected in terraform-google-conversion.
No diff detected in Ansible.
No diff detected in Inspec.

New Pull Requests

I built this PR into one or more new PRs on other repositories, and when those are closed, this PR will also be merged and closed.
depends: hashicorp/terraform-provider-google-beta#1530
depends: hashicorp/terraform-provider-google#5206

}

// If k is comparing length of maps, compare old and new value.
if strings.HasPrefix(k, "labels.%") {
Copy link
Contributor

Choose a reason for hiding this comment

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

What's an example where we would find a diff in this section but we wouldn't have in the logic above?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

An example diff that would cause this:
"labels.%": 2 => 0
"labels.google-dataflow-provided-template-name": "template" => ""
"labels.google-dataflow-provided-template-version": "2019_12_01_blahblah" => ""

The first if is just a guard so we aren't looking at non-label fields - I can remove it.
Second is for the two label fields.
Third is for the number comparison - we need to know whether new-old is empty and old-new is only suppressable labels.

Copy link
Contributor

Choose a reason for hiding this comment

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

is just checking the label prefix enough?
like,

if strings.HasPrefix(k, "labels.%") {
  return true
}

and then getting rid of the other section? because then you'd return true in cases where it's the label prefix, and false in cases where it's a real diff, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

i believe so? There was a weird thing a long time ago where it didn't work with non-present vs empty maps, but it maybe got fixed by 0.12? I'm fine with removing it

Copy link
Contributor

Choose a reason for hiding this comment

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

Ok! Yeah I don't really remember, but if you checked and this way works then yay less code.

@modular-magician
Copy link
Collaborator

Hi! I'm the modular magician, I work on Magic Modules.
I see that this PR has already had some downstream PRs generated. Any open downstreams are already updated to your most recent commit, b1b1d34.

Pull request statuses

terraform-provider-google-beta already has an open PR.
No diff detected in terraform-google-conversion.
terraform-provider-google already has an open PR.
No diff detected in Ansible.
No diff detected in Inspec.

New Pull Requests

I didn't open any new pull requests because of this PR.

1 similar comment
@modular-magician
Copy link
Collaborator

Hi! I'm the modular magician, I work on Magic Modules.
I see that this PR has already had some downstream PRs generated. Any open downstreams are already updated to your most recent commit, b1b1d34.

Pull request statuses

terraform-provider-google-beta already has an open PR.
No diff detected in terraform-google-conversion.
terraform-provider-google already has an open PR.
No diff detected in Ansible.
No diff detected in Inspec.

New Pull Requests

I didn't open any new pull requests because of this PR.

@modular-magician
Copy link
Collaborator

Hi! I'm the modular magician, I work on Magic Modules.
I see that this PR has already had some downstream PRs generated. Any open downstreams are already updated to your most recent commit, ea980ac.

Pull request statuses

terraform-provider-google-beta already has an open PR.
No diff detected in terraform-google-conversion.
terraform-provider-google already has an open PR.
No diff detected in Ansible.
No diff detected in Inspec.

New Pull Requests

I didn't open any new pull requests because of this PR.

}

// If k is comparing length of maps, compare old and new value.
if strings.HasPrefix(k, "labels.%") {
Copy link
Contributor

Choose a reason for hiding this comment

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

Ok! Yeah I don't really remember, but if you checked and this way works then yay less code.

@modular-magician modular-magician merged commit df85614 into GoogleCloudPlatform:master Dec 17, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Use different example in dataflow tests Fix TestAccDataflowJobCreateWithServiceAccount
4 participants