-
Notifications
You must be signed in to change notification settings - Fork 898
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
Conversion script for mapped tags/classification from remote regions to global #17971
Conversation
49657f8
to
5985f34
Compare
09f81b2
to
b31c774
Compare
@miq-bot assign @gtanzillo |
tools/convert_mapped_tags.rb
Outdated
#!/usr/bin/env ruby | ||
require File.expand_path('../config/environment', __dir__) | ||
|
||
read_only = (ARGV[0] != 'WRITE') |
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 was thinking you can do this with command line options like this
require 'trollop'
opts = Trollop.options(ARGV) do
banner "USAGE: #{__FILE__} -c|--commit" \
"Example (Commit): #{__FILE__} --commit\n" \
"Example (Dry Run): #{__FILE__} \n" \
opt :commit, "Commit to database. The default behavior is to do a dry run", :short => "c"
end
read_only = !opts[:commit]
tools/convert_mapped_tags.rb
Outdated
|
||
condition_for_mapped_tags = ContainerLabelTagMapping::TAG_PREFIXES.map { "tags.name LIKE ?" }.join(' OR ') | ||
tag_values = ContainerLabelTagMapping::TAG_PREFIXES.map { |x| "#{x}%:%" } | ||
|
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.
It may be good to do this in a transaction and roll back if any of the saves fail
b31c774
to
bb8b99b
Compare
@gtanzillo thanks, I added your suggestions 👍 |
Checked commit lpichler@bb8b99b with ruby 2.3.3, rubocop 0.52.1, haml-lint 0.20.0, and yamllint 1.10.0 tools/convert_mapped_tags.rb
|
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 👍
Conversion script for mapped tags/classification from remote regions to global (cherry picked from commit 8a9222c) https://bugzilla.redhat.com/show_bug.cgi?id=1526000
Hammer backport details:
|
Conversion script for mapped tags/classification from remote regions to global (cherry picked from commit 8a9222c) https://bugzilla.redhat.com/show_bug.cgi?id=1650152
Gaprindashvili backport details:
|
What we need
In global region, create and filter report according to tags from remote regions.
How
Create tag/categories in global regions:
Usage
read only mode:
./tools/convert_mapped_tags.rb
will output (just tag 'bronagh1213' doesn't exist):
write mode:
./tools/convert_mapped_tags.rb WRITE
Note
This script is not enabling tags to be able assign them in Tag Control. - To reach behaviour we need also this PRs:
#18046
ManageIQ/manageiq-ui-classic#4723
Links
https://bugzilla.redhat.com/show_bug.cgi?id=1526000
#18015 this PR is needed for the BZ