-
Notifications
You must be signed in to change notification settings - Fork 897
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
52 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
module LifecycleMixin | ||
extend ActiveSupport::Concern | ||
|
||
def update_lifecycle_state | ||
case miq_request.request_state | ||
when "finished" | ||
lifecycle_state = miq_request.status == 'Ok' ? "provisioned" : "error_provisioned" | ||
update(:lifecycle_state => lifecycle_state) | ||
else | ||
update(:lifecycle_state => 'provisioning') | ||
end | ||
end | ||
|
||
def provisioned? | ||
lifecycle_state == 'provisioned' | ||
end | ||
|
||
def provision_failed? | ||
lifecycle_state == 'error_provisioned' | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters