Project

General

Profile

Revision 3133582e

Added by Thomas McKay about 6 years ago

refs #14615 - handle no host collections, no channels

View differences:

lib/hammer_cli_import/base.rb
452 452
            }
453 453
          }
454 454
          @api.resource(:hosts).call(:update, params)
455
          @api.resource(:host_collections).call(:add_hosts, {
456
              'id' => entity_hash[:host_collection_ids][0],
457
              'host_ids' => [entity['id']]
458
          })
455
          unless entity_hash[:host_collection_ids].empty?
456
            @api.resource(:host_collections).call(:add_hosts, {
457
                'id' => entity_hash[:host_collection_ids][0],
458
                'host_ids' => [entity['id']]
459
            })
460
          end
459 461
          entity['id'] = entity['id'].to_s
460 462
        else
461 463
          entity_hash = {@wrap_out[entity_type] => entity_hash} if @wrap_out[entity_type]
lib/hammer_cli_import/importtools.rb
162 162
      end
163 163

  
164 164
      def create_composite_content_view(entity_type, org_id, cv_label, cv_description, cvs)
165
        return nil if cvs.empty?
165
        if cvs.empty?
166
          return list_server_entities(:content_views,
167
                                      {:organization_id => org_id, :name => "Default Organization View"})[0]['id']
168
        end
166 169
        if cvs.size == 1
167 170
          return cvs.to_a[0]
168 171
        else

Also available in: Unified diff