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 copy_params_if_present in cloud network/subnet and floating ip controllers #6139

Merged
merged 1 commit into from
Sep 3, 2019

Conversation

hstastna
Copy link

@hstastna hstastna commented Sep 2, 2019

Issue: #6105

We can use new copy_params_if_present method in many places in the code and to improve functionality (remove "" vs nil issues and bad response of Add/Save buttons), to simplify the code.

Related PRs/changes:
#5815
d3c3878#diff-956e46b33fb5307990c4e1a4b5fd86ccR1267

@hstastna
Copy link
Author

hstastna commented Sep 2, 2019

@romanblanco What do you think about these changes? Thanks! :)

@hstastna hstastna force-pushed the Networks_copy_params_present branch from 43cf0fc to cd28fec Compare September 2, 2019 16:09
@hstastna hstastna mentioned this pull request Sep 2, 2019
21 tasks
@@ -223,17 +223,12 @@ def form_params
# Admin_state_Up is true by default
params[:enabled] = false unless params[:enabled]

options[:name] = params[:name] if params[:name]
options[:ems_id] = params[:ems_id] if params[:ems_id]
copy_params_if_present(options, params, %i[name ems_id qos_policy_id provider_network_type provider_physical_network provider_segmentation_id])
options[:admin_state_up] = switch_to_bol(params[:enabled])
options[:shared] = switch_to_bol(params[:shared])
options[:external_facing] = switch_to_bol(params[:external_facing])
# TODO: uncomment once form contains this field
# options[:port_security_enabled] = params[:port_security_enabled] if params[:port_security_enabled]
Copy link
Member

Choose a reason for hiding this comment

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

I feel like you can also remove the commented lines, as they are 3 years old now

@miq-bot
Copy link
Member

miq-bot commented Sep 2, 2019

Checked commit hstastna@cd28fec with ruby 2.4.6, rubocop 0.69.0, haml-lint 0.20.0, and yamllint 1.10.0
3 files checked, 0 offenses detected
Everything looks fine. 🍪

Copy link
Member

@romanblanco romanblanco left a comment

Choose a reason for hiding this comment

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

LGTM 👍

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.

4 participants