-
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
Add rake task to export custom buttons #17699
Conversation
@miq-bot add_label enhancement |
07909fb
to
aabc4dd
Compare
4813ce3
to
6a84cf4
Compare
@tinaafitz @syncrou @eclarizio |
@miq-bot remove_label wip |
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.
@d-m-u - some small nits, but would like to see specs around this.
end | ||
end | ||
|
||
export_dir = options[:directory] |
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.
@d-m-u Should we have some validation that this directory exists?
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.
The export helper itself handles that here: https://github.com/ManageIQ/manageiq/blob/master/lib/task_helpers/exports.rb#L22
def self.create_association_list(obj, item) | ||
associations = obj.class.try(:reflections) | ||
if associations | ||
associations = associations.collect { |r| { r[0] => r[1].class.to_s.demodulize } }.select { |d| d.values.first != "BelongsToReflection" && d.keys.first != "all_relationships" } |
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.
@d-m-u - Building the associations are in the weeds, but I wouldn't mind seeing variable names that reflect what the variable is e.g. r
, d
aa2c3fd
to
8bee5d7
Compare
8bee5d7
to
e6f816f
Compare
Checked commit d-m-u@e6f816f 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.
LGTM 👍
@d-m-u Looks good. My only comment is around exporting the At the moment this ID is only used for tracking who created the button. I'll comment on the import PR so we can address this. |
Hi, it seems I've found the problem in https://github.com/ManageIQ/manageiq/blob/master/spec/lib/task_helpers/imports/custom_buttons_spec.rb It seems the glob should be like Also, we should explicitly remove tmp file in the example code, otherwize the whole test may fail |
Hi @borisko123, thanks for reporting this issue. Can you please open a git issue and someone can take a look. Thanks. |
Hi @gmcculloug, |
We need to be able to import/export custom buttons. This is basically a generic active record object export that works on custom buttons.
The related import PR:
#17726
Related:
#17726
Exporting
Create a directory for the exports:
mkdir /tmp/custom_buttons
Export cbs:
rake evm:export:custom_buttons -- --directory /tmp/custom_buttons
The export has a list of custom_button_sets with nested custom_buttons and associated resource actions as well as custom_buttons without sets and their associated resources.
export looks like this: