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

Fix extend_retires_on method for number of days. #14143

Merged
merged 4 commits into from
Mar 16, 2017

Conversation

tinaafitz
Copy link
Member

The retires_on field was changed from a :date column to a :datetime
Issue brought to our attention by:
ManageIQ/manageiq-content#62

Prefer to use the model method extend_retires_on in Automate methods.
https://bugzilla.redhat.com/show_bug.cgi?id=1427503

@tinaafitz
Copy link
Member Author

@miq-bot add_label bug, euwe/yes

psachin pushed a commit to psachin/manageiq-content that referenced this pull request Mar 3, 2017
The retires_on field was changed from a `:date` column to a `:datetime`
which now requires the days(in seconds) be added to the time.

- Depends on: ManageIQ/manageiq#14143
- This issue was introduced in PR ManageIQ/manageiq#11156
- https://bugzilla.redhat.com/show_bug.cgi?id=1427503

Signed-off-by: Sachin <psachin@redhat.com>
@tinaafitz tinaafitz changed the title [WIP] Fix extend_retires_on method for number of days. Fix extend_retires_on method for number of days. Mar 6, 2017
@miq-bot miq-bot removed the wip label Mar 6, 2017
@tinaafitz
Copy link
Member Author

@mkanoor Please review.

@@ -51,7 +51,7 @@ def retires_on=(timestamp)

def extend_retires_on(days, date = Time.zone.today)
Copy link
Contributor

Choose a reason for hiding this comment

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

@tinaafitz
Should the default value also be Time.zone.now

@@ -51,7 +51,7 @@ def retires_on=(timestamp)

def extend_retires_on(days, date = Time.zone.today)
_log.info "Extending Retirement Date on #{self.class.name} id:<#{self.id}>, name:<#{self.name}> "
new_retires_date = date + days.to_i
new_retires_date = date + days.to_i.days
Copy link
Contributor

Choose a reason for hiding this comment

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

@tinaafitz
What is the date object coming into this function, would it have the time embedded in it? Since days returns a Duration object its possible that the time component could produce different results based on the timezone.

@gmcculloug
Copy link
Member

@mkanoor Please take another look.

@tinaafitz
Copy link
Member Author

@mkanoor Added date validation.

@@ -199,7 +199,7 @@ def invoke_ae
:retirement_last_warn => Time.zone.today,
:retirement_state => "retiring"
)
service_service.retires_on = Time.zone.today + 1
service_service.retires_on = Time.zone.today + 1.day
Copy link
Contributor

Choose a reason for hiding this comment

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

@tinaafitz
Should this be Time.zone.now?

@miq-bot
Copy link
Member

miq-bot commented Mar 10, 2017

Checked commits tinaafitz/manageiq@ddb9238~...8359630 with ruby 2.2.6, rubocop 0.47.1, and haml-lint 0.20.0
3 files checked, 0 offenses detected
Everything looks good. 🍰

@tinaafitz
Copy link
Member Author

@mkanoor Thanks for catching that.

@gmcculloug gmcculloug merged commit f20cab8 into ManageIQ:master Mar 16, 2017
@gmcculloug gmcculloug added this to the Sprint 57 Ending Mar 27, 2017 milestone Mar 16, 2017
simaishi pushed a commit that referenced this pull request Mar 20, 2017
Fix extend_retires_on method for number of days.
(cherry picked from commit f20cab8)

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

Euwe backport details:

$ git log -1
commit 92d185a740c6ce8324fee4f58e2d0aa242fde3bf
Author: Greg McCullough <gmccullo@redhat.com>
Date:   Thu Mar 16 12:10:04 2017 -0400

    Merge pull request #14143 from tinaafitz/retire_extends_on_fix
    
    Fix extend_retires_on method for number of days.
    (cherry picked from commit f20cab897166492f3fe8e766d2b57e69769c7420)
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1433980

@simaishi simaishi removed the euwe/yes label Mar 20, 2017
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.

5 participants