-
Notifications
You must be signed in to change notification settings - Fork 897
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
Adding options field to ext_management_system #15398
Conversation
ExtManagementSystem.where(:type => "ManageIQ::Providers::Kubernetes::ContainerManager").each do |cp| | ||
migrated_options = {} | ||
migrated_options[:image_inspector_repository] = Settings.ems.ems_kubernetes.image_inspector_repository | ||
migrated_options[:image_inspector_registry] = Settings.ems.ems_kubernetes.image_inspector_registry |
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.
@enoodle we don't want to move the Settings
values in the options.
:resource_type => cp.type, | ||
:resource_id => cp.id, | ||
:section => ManageIQ::Providers::Kubernetes::ContainerManager::Scanning::Job::ATTRIBUTE_SECTION, | ||
:name => ManageIQ::Providers::Kubernetes::ContainerManager::Scanning::Job::PROXY_ENV_VARIABLES).each do |ca| |
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.
@enoodle I don't think we want to rely on the Kubernetes module dependency here for this migration. cc @blomquisg
I am not sure I understand, if we dont migrate these kubernetes options and
not the ones from the settings, what should we migrate?
On Jun 20, 2017 12:56 AM, "Federico Simoncelli" <[email protected]> wrote:
*@simon3z* commented on this pull request.
------------------------------
In db/migrate/20170619161514_add_options_to_ext_management_system.rb
<#15398 (comment)>:
+ serialize :serialized_value
+ end
+
+ def up
+ add_column :ext_management_systems, :options, :text
+
+ say_with_time("Migrating Kubernetes provider options") do
+ ExtManagementSystem.where(:type =>
"ManageIQ::Providers::Kubernetes::ContainerManager").each do |cp|
+ migrated_options = {}
+ migrated_options[:image_inspector_repository] =
Settings.ems.ems_kubernetes.image_inspector_repository
+ migrated_options[:image_inspector_registry] =
Settings.ems.ems_kubernetes.image_inspector_registry
+ CustomAttribute.where(
+ :resource_type => cp.type,
+ :resource_id => cp.id,
+ :section =>
ManageIQ::Providers::Kubernetes::ContainerManager::Scanning::Job::ATTRIBUTE_SECTION,
+ :name =>
ManageIQ::Providers::Kubernetes::ContainerManager::Scanning::Job::PROXY_ENV_VARIABLES).each
do |ca|
@enoodle <https://github.com/enoodle> I don't think we want to reply on the
Kubernetes module dependency here for this migration. cc @blomquisg
<https://github.com/blomquisg>
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#15398 (review)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AC-ogKxtxMuepzazq7RdtTYwaxaFyXH5ks5sFu5vgaJpZM4N-kbK>
.
|
@enoodle I don't want you to prepopulate the values in the db for the Read more carefully the comment about the kubernetes options, it's about the module dependency. |
e42b21c
to
28e7df3
Compare
Current implementation adding a generic Of course I am also considering the downside of this approach. The table For completeness I want to mention that since most of the times (I'd say always?) these are also global settings, e.g.: :ems:
:ems_kubernetes:
:miq_namespace: management-infra
:image_inspector_registry: docker.io
:image_inspector_repository: openshift/image-inspector It's worth mentioning that this could be achieved also using
I am not sure of the implications of this second approach though. cc @blomquisg |
5ce53e8
to
fca068a
Compare
:resource_type => cp.type, | ||
:resource_id => cp.id, | ||
:section => ManageIQ::Providers::Kubernetes::ContainerManager::Scanning::Job::ATTRIBUTE_SECTION, | ||
:name => ManageIQ::Providers::Kubernetes::ContainerManager::Scanning::Job::PROXY_ENV_VARIABLES |
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.
@enoodle as mentioned before I am not sure if we can afford this dependency to the Kubernetes module. cc @blomquisg You may have to hard-code the values here.
fca068a
to
bbcdbfe
Compare
I have added deletion of the old CustomAttribute's with the settings and also made sure that the migration is happening on Kubernetes and Openshift Providers. |
:name => %w(no_proxy http_proxy https_proxy) | ||
).each do |ca| | ||
migrated_options["image_inspector_#{ca.name}".to_sym] = ca.value | ||
ca.delete |
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.
@enoodle isn't it risky to delete this before having it persisted in the new options? (cp.update
)
2fef4cc
to
ae9a16d
Compare
@blomquisg @Fryguy can you review? |
This pull request is not mergeable. Please rebase and repush. |
Database migrations have now been moved to the https://github.com/ManageIQ/manageiq-schema repo. Please see http://talk.manageiq.org/t/new-split-repo-manageiq-schema/2478 for instructions on how to transfer your database migrations. If this PR contains only migrations, I will leave it open for a short time during the transition, after which I will close this if it has not been moved over. |
ae9a16d
to
ad37b0e
Compare
Checked commit enoodle@ad37b0e with ruby 2.2.6, rubocop 0.47.1, and haml-lint 0.20.0 |
cc @Loicavenel |
This will add the serialzed column
options
toExtManagementSystem
.There is also a migration for
ManageIQ::Providers::Kubernetes::ContainerManager
options that where saved inCustomAttribute
s and general settings but should be there. This takes inspiration from #13826 and #14106 but the options details will be added in a later stage in the appropriate provider modules.RFE BZ: https://bugzilla.redhat.com/show_bug.cgi?id=1462835