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 UUID to ensure the uniqueness of job template name #16672

Merged
merged 1 commit into from
Dec 18, 2017

Conversation

bzwei
Copy link
Contributor

@bzwei bzwei commented Dec 15, 2017

When we create job template (and inventory) to run a playbook, a timestamp was appended to the name to ensure the name uniqueness at the tower side. For the setup reported in the BZ after multiple VM provisioning completed they all tried to run the same playbook at the same second, causing a naming collision.

The solution is to replace the timestamp with a UUID.

fixes https://bugzilla.redhat.com/show_bug.cgi?id=1525683

@bzwei
Copy link
Contributor Author

bzwei commented Dec 15, 2017

@miq-bot assign @mkanoor
@miq-bot add_label bug, gaprindashvili/yes, automate

end

private

def build_parameter_list(options)
params = {
:name => options[:template_name] || "#{name}_#{Time.zone.now.to_i}",
:name => options[:template_name] || "#{name}_#{SecureRandom.uuid}",
Copy link
Member

Choose a reason for hiding this comment

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

@bzwei I like this change. Thinking we should add the time to the description so we have a reference if needed.

@miq-bot
Copy link
Member

miq-bot commented Dec 18, 2017

Checked commit bzwei@1906989 with ruby 2.3.3, rubocop 0.47.1, haml-lint 0.20.0, and yamllint 1.10.0
4 files checked, 0 offenses detected
Everything looks fine. 🍰

Copy link
Contributor

@syncrou syncrou left a comment

Choose a reason for hiding this comment

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

This looks great to me. I like the time stamp for the description ( as suggested by @gmcculloug )

@gmcculloug gmcculloug merged commit 80c69ec into ManageIQ:master Dec 18, 2017
@gmcculloug gmcculloug added this to the Sprint 76 Ending Jan 1, 2018 milestone Dec 18, 2017
@bzwei bzwei deleted the unique_jt_name branch December 18, 2017 17:10
simaishi pushed a commit that referenced this pull request Dec 19, 2017
Use UUID to ensure the uniqueness of job template name
(cherry picked from commit 80c69ec)

https://bugzilla.redhat.com/show_bug.cgi?id=1527560
@simaishi
Copy link
Contributor

Gaprindashvili backport details:

$ git log -1
commit 137b7e168a0613eca23ca6e0bbafd761b6469d6b
Author: Greg McCullough <gmccullo@redhat.com>
Date:   Mon Dec 18 10:14:26 2017 -0500

    Merge pull request #16672 from bzwei/unique_jt_name
    
    Use UUID to ensure the uniqueness of job template name
    (cherry picked from commit 80c69ec8f79c74d7e66219e367840f8d49947863)
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1527560

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.

6 participants