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

Don't overwrite message in create_automation_object #287

Merged
merged 1 commit into from
Jan 15, 2019

Conversation

d-m-u
Copy link
Contributor

@d-m-u d-m-u commented Jan 15, 2019

Creation of a custom button to request call_instance_with_message is overwriting the message in create_automation_object and we shouldn't do that. We can have one message stored in attrs and the other in options[:message] and they are distinct entities and should remain so. This appears to have been wrong for quite a while (9c5233b) (and also slightly less relevant but still worth noting, ManageIQ/manageiq@227afe6). This worked in most cases because we don't usually have a message attribute in the attr value pairs, just the request message (which defaults to create), so the message in the attrs was nil.

Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1651099

This is coming back into the edit screen for the button, note the fact that the messages are different, one hasn't been overwritten by the other.
screen shot 2019-01-15 at 9 59 36 am

@d-m-u
Copy link
Contributor Author

d-m-u commented Jan 15, 2019

@miq-bot add_label hammer/yes
@miq-bot add_label bug
@miq-bot assign @gmcculloug
@miq-bot add_reviewer @mkanoor

@miq-bot

This comment has been minimized.

@d-m-u
Copy link
Contributor Author

d-m-u commented Jan 15, 2019

Ugh, @bdunne, it's a stupid one-liner and I can't tag you for review here, any chance you could 👀 anyway please?

@coveralls
Copy link

Pull Request Test Coverage Report for Build 1980

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.003%) to 80.596%

Totals Coverage Status
Change from base Build 1955: -0.003%
Covered Lines: 5250
Relevant Lines: 6514

💛 - Coveralls

@coveralls
Copy link

coveralls commented Jan 15, 2019

Pull Request Test Coverage Report for Build 1984

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.01%) to 80.611%

Totals Coverage Status
Change from base Build 1955: 0.01%
Covered Lines: 5251
Relevant Lines: 6514

💛 - Coveralls

@d-m-u d-m-u changed the title Don't overwrite message in create_automation_object [WIP] Don't overwrite message in create_automation_object Jan 15, 2019
@miq-bot miq-bot added the wip label Jan 15, 2019
@d-m-u d-m-u changed the title [WIP] Don't overwrite message in create_automation_object Don't overwrite message in create_automation_object Jan 15, 2019
@miq-bot miq-bot removed the wip label Jan 15, 2019
@bdunne
Copy link
Member

bdunne commented Jan 15, 2019

Sorry, I'm not familiar enough with this to comment.

@d-m-u
Copy link
Contributor Author

d-m-u commented Jan 15, 2019

@miq-bot remove_label wip

Copy link
Member

@gmcculloug gmcculloug left a comment

Choose a reason for hiding this comment

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

Looks like the right change to me. There can be a key "message" in the generic key/pair section as well as the message which drives automate resolution.

Just looking for tests on this.

Copy link
Member

@kbrock kbrock left a comment

Choose a reason for hiding this comment

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

LGTM

@@ -258,7 +258,6 @@ def self.create_automation_object(name, attrs, options = {})
options[:instance_name] = name

options[:attrs] = create_ae_attrs(attrs, name, options[:vmdb_object])
options[:message] = options[:attrs][:message]
Copy link
Member

@kbrock kbrock Jan 15, 2019

Choose a reason for hiding this comment

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

👍 This does not belong in here

(if the line above it feels lonely, get rid of it too)

Original introduction: PR 3292
Cargo-culted from PR 3258

Do note, those PRs were open for a while, I'm assuming something got lost in the rebases

@d-m-u d-m-u force-pushed the fixing_message_thing branch 2 times, most recently from e5ef8f6 to 6e761d8 Compare January 15, 2019 18:43
host = FactoryBot.create(:host)
message = "request_message"
attrs = {"Host::host" => host.id, :message => "attr_message"}
extras = "MiqServer%3A%3Amiq_server=#{@miq_server_id}"
Copy link
Member

Choose a reason for hiding this comment

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

Prefer this iteration which does not add the MiqServer key/value in the attrs hash.

We should look to refactor @miq_server_id along with the other instance variables at the top of this spec into let blocks in a separate PR.

@miq-bot
Copy link
Member

miq-bot commented Jan 15, 2019

Checked commit d-m-u@7becae8 with ruby 2.3.3, rubocop 0.52.1, haml-lint 0.20.0, and yamllint 1.10.0
2 files checked, 0 offenses detected
Everything looks fine. 🏆

@gmcculloug gmcculloug merged commit f38c83c into ManageIQ:master Jan 15, 2019
@gmcculloug gmcculloug added this to the Sprint 103 Ending Jan 21, 2019 milestone Jan 15, 2019
@d-m-u d-m-u mentioned this pull request Jan 15, 2019
simaishi pushed a commit that referenced this pull request Feb 5, 2019
Don't overwrite message in create_automation_object

(cherry picked from commit f38c83c)

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

simaishi commented Feb 5, 2019

Hammer backport details:

$ git log -1
commit b8ec07a2fac279d9e3f5e40c3061df85e7055188
Author: Greg McCullough <gmccullo@redhat.com>
Date:   Tue Jan 15 16:15:32 2019 -0500

    Merge pull request #287 from d-m-u/fixing_message_thing
    
    Don't overwrite message in create_automation_object
    
    (cherry picked from commit f38c83c12af9154651f3f18f6febf2a762003cd9)
    
    Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1672693

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.

8 participants