Class: ForemanInventoryUpload::Generators::Tags
- Inherits:
-
Object
- Object
- ForemanInventoryUpload::Generators::Tags
- Defined in:
- lib/foreman_inventory_upload/generators/tags.rb
Instance Method Summary collapse
- #generate ⇒ Object
- #generate_parameters ⇒ Object
-
#initialize(host) ⇒ Tags
constructor
A new instance of Tags.
Constructor Details
#initialize(host) ⇒ Tags
Returns a new instance of Tags.
4 5 6 |
# File 'lib/foreman_inventory_upload/generators/tags.rb', line 4 def initialize(host) @host = host end |
Instance Method Details
#generate ⇒ Object
8 9 10 11 12 13 14 15 16 17 |
# File 'lib/foreman_inventory_upload/generators/tags.rb', line 8 def generate ( locations + hostgroups + host_collections + organizations + content_data + satellite_server_data ).reject { |key, value| value.empty? }.map { |key, value| [key, truncated_value(value)] } end |
#generate_parameters ⇒ Object
19 20 21 22 23 24 25 |
# File 'lib/foreman_inventory_upload/generators/tags.rb', line 19 def generate_parameters return [] unless Setting[:include_parameter_tags] (@host.host_params || {}) .select { |_name, value| value.present? || value.is_a?(FalseClass) } .map { |key, value| [key, truncated_value(value)] } end |