-
Notifications
You must be signed in to change notification settings - Fork 357
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
Ability to see/save Config settings for Region and Zone records. #3967
Ability to see/save Config settings for Region and Zone records. #3967
Conversation
@Fryguy need help with saving of config settings for Zone/Region record, please see spec test failure
|
To fix this spec failure, can we use |
Scratch that. So, again back to my original question...what methods are needed from MiqServer::ConfigurationManagement? |
@carbonin i can't use |
I created a new backend PR ManageIQ/manageiq#17494, which handles the various nuances better. |
@h-kataria With the new backend PR, you should also be able to remove the get_file and save_file references with something like the following diff: diff --git a/app/controllers/ops_controller/settings/common.rb b/app/controllers/ops_controller/settings/common.rb
index 08bcff353..7b256ae84 100644
--- a/app/controllers/ops_controller/settings/common.rb
+++ b/app/controllers/ops_controller/settings/common.rb
@@ -253,16 +253,17 @@ module OpsController::Settings::Common
def fetch_advanced_settings(resource)
@edit = {}
- @edit[:current] = {:file_data => VMDB::Config.get_file(resource)}
+ @edit[:current] = {:file_data => resource.settings_for_resource_yaml}
@edit[:new] = copy_hash(@edit[:current])
@edit[:key] = "#{@sb[:active_tab]}_edit__#{@sb[:selected_server_id]}"
@in_a_form = true
end
def save_advanced_settings(resource)
- result = VMDB::Config.save_file(@edit[:new][:file_data], resource) # Save the config file
- if result != true # Result contains errors?
- result.each do |field, msg|
+ begin
+ resource.add_settings_for_resource_yaml(@edit[:new][:file_data])
+ rescue Vmdb::Settings::ConfigurationInvalid => err
+ err.errors.each do |field, msg|
add_flash("#{field.to_s.titleize}: #{msg}", :error)
end
@changed = (@edit[:new] != @edit[:current])
|
38d366e
to
e968e3f
Compare
@Fryguy made suggested changes to use new methods from ManageIQ/manageiq#17494 |
core PR is merged |
resource = if selected?(x_node, "z") | ||
Zone.find(nodes.last) | ||
elsif selected?(x_node, "svr") | ||
MiqServer.find(@sb[:selected_server_id]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You still have the wrong number of indent here and on 2 lines above.
= _("Caution: Manual changes to configuration files can disable the Server!") | ||
- warning_msg = _("Caution: Manual changes to configuration files can disable the #{selected_node_title}!") | ||
- if selected?(x_node, "z") || selected?(x_node, "svr") | ||
- warning_msg << _(" Changes made to any individual settings will overwrite settings inherited from the #{selected_node_parent_title}") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you need a period or exclamation point at the end of this sentence.
:id => 'advanced') | ||
data = {} | ||
data.store_path(:api, :token_ttl, "1.day") | ||
data = data.to_yaml |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These 3 lines can be simplified to data = {:api => {:token_ttl => "1.day"}}
@h-kataria I made a few minor comments, and please take care of the rubocops, but otherwise this LGTM. |
d5c8d93
to
8040f11
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM...Have one minor comment but I wouldn't hold up a merge for it.
@@ -6,7 +6,10 @@ | |||
%span.pficon.pficon-error-octagon | |||
%span.pficon.pficon-error-exclamation | |||
%strong | |||
= _("Caution: Manual changes to configuration files can disable the Server!") | |||
- warning_msg = _("Caution: Manual changes to configuration files can disable the #{selected_node_title}!") | |||
- if selected?(x_node, "z") || selected?(x_node, "svr") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor, but technically this logic is duplicated here and in the selected_node_parent_title. You could de-dup that logic by changing selected_node_parent_title to return nil for regions, and then there just do if selected_node_parent_title
MiqServer.find(@sb[:selected_server_id]) | ||
else | ||
MiqRegion.my_region | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also minor, but this is also a duplicated pattern with the selected_node_title methods. I think this would be cleaner extracted as a selected_node
method that lives with the rest in ops_helper (if possible). In this way all of the "if selected?(x_node..." logic lives in one place.
Exposed 'Advanced' tab for Region/Zone nodes. Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1082155
8040f11
to
c1c0bdb
Compare
Checked commit h-kataria@c1c0bdb with ruby 2.3.3, rubocop 0.52.1, haml-lint 0.20.0, and yamllint 1.10.0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good - tested saving the settings on region/server/zone.
@@ -6,7 +6,10 @@ | |||
%span.pficon.pficon-error-octagon | |||
%span.pficon.pficon-error-exclamation | |||
%strong | |||
= _("Caution: Manual changes to configuration files can disable the Server!") | |||
- warning_msg = _("Caution: Manual changes to configuration files can disable the #{selected_node_title}!") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
May I add that string interpolation will not work in gettext strings. Also, it's not usually a good idea to concatenate strings that are meant to be translated (since it complicates work for translators).
reworked gettext string added in ManageIQ#3967 Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1082155
Exposed 'Advanced' tab for Region/Zone nodes.
Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1082155
Before:
After, Note has been updated on the Server level. Exposed Advanced tab on Region and Zone level:
Dependent upon core PR: Core PR: ManageIQ/manageiq#17458