Skip to content
This repository has been archived by the owner on Jan 14, 2021. It is now read-only.

Toggle modules to active=True when they are done building. #52

Merged
merged 3 commits into from Mar 15, 2017

Conversation

ralphbean
Copy link
Contributor

This is for https://pagure.io/fm-orchestrator/issue/407

Here we also switch to using the variant_uid to lookup individual modules in
PDC which is introduced in fedora-modularity/product-definition-center#11.

@@ -75,6 +75,12 @@ def handle(self, pdc, msg):

unreleased_variant = self.get_or_create_unreleased_variant(pdc, body)

if body['state_name'] == 'ready':
Copy link
Contributor

Choose a reason for hiding this comment

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

I would just use the state variable here instead

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fair.

uid = unreleased_variant['variant_uid']
# This submits an HTTP PATCH.
# The '/' is necessary to avoid losing the body in a 301.
pdc['unreleasedvariants'][uid + '/'] += {'variant_uid': uid, 'active': True}
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm wondering why the variant_uid is set here. I'm assuming that the uid is already correct since you seem to be querying by it with pdc['unreleasedvariants'][uid + '/']. I might be just misunderstanding what beanbag does in this instance though.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, I thought that too... but in practice PDC expects the patch data to also contain the lookup_field otherwise it considers it an incomplete partial patch (or something like that...).

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh okay. Thanks for clarifying!

@@ -130,12 +136,10 @@ def get_or_create_unreleased_variant(self, pdc, body):
# version/release, but for now we just do the right mapping here...
variant_version = body['stream'] # This is supposed to be equal to version
variant_release = body['version'] # This is supposed to be equal to release
variant_uid = "%s-%s-%s" % (variant_id, variant_version, variant_release)
Copy link
Contributor

@mprahl mprahl Mar 15, 2017

Choose a reason for hiding this comment

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

Not important, but I like the way this is done in create_unreleased better :) :

variant_uid = "{n}-{v}-{r}".format(n=name, v=version, r=release)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Heh, I'll punt on this one. ;)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Punt? Wrong metaphor. Kick a field goal?

Copy link
Contributor

Choose a reason for hiding this comment

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

Punt is fine 😛

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@ralphbean and the sports metaphor:

@mprahl
Copy link
Contributor

mprahl commented Mar 15, 2017

+1

@ralphbean
Copy link
Contributor Author

Thanks! Will wait on fedora-modularity/product-definition-center#11 to merge this one.

@jankaluza
Copy link

+1

@ralphbean ralphbean merged commit 1dd4867 into develop Mar 15, 2017
@ralphbean ralphbean deleted the feature/patch-on-module-done branch March 15, 2017 17:32
ralphbean added a commit that referenced this pull request Mar 16, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants