{"action":"created","issue":{"url":"https://api.github.com/repos/ManageIQ/manageiq/issues/14236","repository_url":"https://api.github.com/repos/ManageIQ/manageiq","labels_url":"https://api.github.com/repos/ManageIQ/manageiq/issues/14236/labels{/name}","comments_url":"https://api.github.com/repos/ManageIQ/manageiq/issues/14236/comments","events_url":"https://api.github.com/repos/ManageIQ/manageiq/issues/14236/events","html_url":"https://github.com/ManageIQ/manageiq/pull/14236","id":212849216,"number":14236,"title":"[WIP] Refactor ContainerLabelTagMapping","user":{"login":"djberg96","id":78529,"avatar_url":"https://avatars0.githubusercontent.com/u/78529?v=3","gravatar_id":"","url":"https://api.github.com/users/djberg96","html_url":"https://github.com/djberg96","followers_url":"https://api.github.com/users/djberg96/followers","following_url":"https://api.github.com/users/djberg96/following{/other_user}","gists_url":"https://api.github.com/users/djberg96/gists{/gist_id}","starred_url":"https://api.github.com/users/djberg96/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/djberg96/subscriptions","organizations_url":"https://api.github.com/users/djberg96/orgs","repos_url":"https://api.github.com/users/djberg96/repos","events_url":"https://api.github.com/users/djberg96/events{/privacy}","received_events_url":"https://api.github.com/users/djberg96/received_events","type":"User","site_admin":false},"labels":[{"id":106615678,"url":"https://api.github.com/repos/ManageIQ/manageiq/labels/enhancement","name":"enhancement","color":"84b6eb","default":true},{"id":126991110,"url":"https://api.github.com/repos/ManageIQ/manageiq/labels/gem%20changes","name":"gem changes","color":"6A92BC","default":false},{"id":211526106,"url":"https://api.github.com/repos/ManageIQ/manageiq/labels/providers/amazon","name":"providers/amazon","color":"5319e7","default":false},{"id":182909090,"url":"https://api.github.com/repos/ManageIQ/manageiq/labels/providers/cloud","name":"providers/cloud","color":"5319e7","default":false},{"id":182802215,"url":"https://api.github.com/repos/ManageIQ/manageiq/labels/providers/containers","name":"providers/containers","color":"5319e7","default":false},{"id":278602885,"url":"https://api.github.com/repos/ManageIQ/manageiq/labels/sql%20migration","name":"sql migration","color":"6A92BC","default":false},{"id":176168677,"url":"https://api.github.com/repos/ManageIQ/manageiq/labels/wip","name":"wip","color":"eeeeee","default":false}],"state":"open","locked":false,"assignee":{"login":"Fryguy","id":52120,"avatar_url":"https://avatars0.githubusercontent.com/u/52120?v=3","gravatar_id":"","url":"https://api.github.com/users/Fryguy","html_url":"https://github.com/Fryguy","followers_url":"https://api.github.com/users/Fryguy/followers","following_url":"https://api.github.com/users/Fryguy/following{/other_user}","gists_url":"https://api.github.com/users/Fryguy/gists{/gist_id}","starred_url":"https://api.github.com/users/Fryguy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Fryguy/subscriptions","organizations_url":"https://api.github.com/users/Fryguy/orgs","repos_url":"https://api.github.com/users/Fryguy/repos","events_url":"https://api.github.com/users/Fryguy/events{/privacy}","received_events_url":"https://api.github.com/users/Fryguy/received_events","type":"User","site_admin":false},"assignees":[{"login":"Fryguy","id":52120,"avatar_url":"https://avatars0.githubusercontent.com/u/52120?v=3","gravatar_id":"","url":"https://api.github.com/users/Fryguy","html_url":"https://github.com/Fryguy","followers_url":"https://api.github.com/users/Fryguy/followers","following_url":"https://api.github.com/users/Fryguy/following{/other_user}","gists_url":"https://api.github.com/users/Fryguy/gists{/gist_id}","starred_url":"https://api.github.com/users/Fryguy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Fryguy/subscriptions","organizations_url":"https://api.github.com/users/Fryguy/orgs","repos_url":"https://api.github.com/users/Fryguy/repos","events_url":"https://api.github.com/users/Fryguy/events{/privacy}","received_events_url":"https://api.github.com/users/Fryguy/received_events","type":"User","site_admin":false}],"milestone":null,"comments":2,"created_at":"2017-03-08T20:36:33Z","updated_at":"2017-03-10T15:52:51Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/ManageIQ/manageiq/pulls/14236","html_url":"https://github.com/ManageIQ/manageiq/pull/14236","diff_url":"https://github.com/ManageIQ/manageiq/pull/14236.diff","patch_url":"https://github.com/ManageIQ/manageiq/pull/14236.patch"},"body":"This is the first part of an effort to support AWS tag mapping in ManageIQ. The current code was basically hard coded for Kubernetes' containers instead of a generic fashion which resulted in several problems:\r\n\r\n* Provider-specific named table\r\n* No way to distinguish mappings between providers\r\n* Hard coded mappable types (Container types only)\r\n* Hard coded tag prefix (always \"kubernetes\")\r\n\r\nThe first part of this PR is to move the previously hard-coded MAPPABLE_TYPES array into its own table with two fields - `name` (e.g. ContainerNode) and `provider` e.g. (amazon). Then I populate the table with the current array values, along with one entry for Amazon. Presumably more will be added later.\r\n\r\nIn addition, I've moved the ContainerLabelTagMapping table to a more generic name of ProviderLabelTagMapping, which contains the original code (minus the hard-coded constants). To help with backwards compatibility, the original class was then subclassed from this. I also added the model relationships.\r\n\r\nNote that this PR will necessitate an update on the classic-ui side as well. Not only will they not be able to use the constants that I removed, a drop-down selection of providers needs to be selected. Based on which provider the user selects, the list of mappable types will then be visible."},"comment":{"url":"https://api.github.com/repos/ManageIQ/manageiq/issues/comments/285704990","html_url":"https://github.com/ManageIQ/manageiq/pull/14236#issuecomment-285704990","issue_url":"https://api.github.com/repos/ManageIQ/manageiq/issues/14236","id":285704990,"user":{"login":"miq-bot","id":7806257,"avatar_url":"https://avatars2.githubusercontent.com/u/7806257?v=3","gravatar_id":"","url":"https://api.github.com/users/miq-bot","html_url":"https://github.com/miq-bot","followers_url":"https://api.github.com/users/miq-bot/followers","following_url":"https://api.github.com/users/miq-bot/following{/other_user}","gists_url":"https://api.github.com/users/miq-bot/gists{/gist_id}","starred_url":"https://api.github.com/users/miq-bot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/miq-bot/subscriptions","organizations_url":"https://api.github.com/users/miq-bot/orgs","repos_url":"https://api.github.com/users/miq-bot/repos","events_url":"https://api.github.com/users/miq-bot/events{/privacy}","received_events_url":"https://api.github.com/users/miq-bot/received_events","type":"User","site_admin":false},"created_at":"2017-03-10T15:52:51Z","updated_at":"2017-03-10T15:52:51Z","body":"<rubocop />Checked commits https://github.com/djberg96/manageiq/compare/39112b9e92fe45345709d7a73e617a5ac8218209~...a6a587ef80ff3121c65c52e8407a3e1fd2a1a5db with ruby 2.2.6, rubocop 0.47.1, and haml-lint 0.20.0\n5 files checked, 4 offenses detected\n\n**Gemfile**\n- [ ] :exclamation: - [Line 29](https://github.com/djberg96/manageiq/blob/a6a587ef80ff3121c65c52e8407a3e1fd2a1a5db/Gemfile#L29), Col 3 - [Style/LeadingCommentSpace](http://rubydoc.info/gems/rubocop/0.47.1/RuboCop/Cop/Style/LeadingCommentSpace) - Missing space after #.\n\n**app/models/provider_label_tag_mapping.rb**\n- [ ] :exclamation: - [Line 67](https://github.com/djberg96/manageiq/blob/a6a587ef80ff3121c65c52e8407a3e1fd2a1a5db/app/models/provider_label_tag_mapping.rb#L67), Col 7 - [Style/IfInsideElse](http://rubydoc.info/gems/rubocop/0.47.1/RuboCop/Cop/Style/IfInsideElse) - Convert `if` nested inside `else` to `elsif`.\n\n**db/migrate/20170307215002_rename_container_label_tag_mapping.rb**\n- [ ] :exclamation: - [Line 14](https://github.com/djberg96/manageiq/blob/a6a587ef80ff3121c65c52e8407a3e1fd2a1a5db/db/migrate/20170307215002_rename_container_label_tag_mapping.rb#L14), Col 5 - [Style/PercentLiteralDelimiters](http://rubydoc.info/gems/rubocop/0.47.1/RuboCop/Cop/Style/PercentLiteralDelimiters) - `%w`-literals should be delimited by `(` and `)`.\n- [ ] :exclamation: - [Line 41](https://github.com/djberg96/manageiq/blob/a6a587ef80ff3121c65c52e8407a3e1fd2a1a5db/db/migrate/20170307215002_rename_container_label_tag_mapping.rb#L41), Col 36 - [Rails/DynamicFindBy](http://rubydoc.info/gems/rubocop/0.47.1/RuboCop/Cop/Rails/DynamicFindBy) - Use `find_by` instead of dynamic `find_by_name`.\n"}}
{"actor":{"display_login":"miq-bot"}}