RedHatSatellite / katello-attach-subscription

automatically assign subscriptions to hypervisors based on certain rules
GNU General Public License v2.0
10 stars 5 forks source link

katello-attach-subscription/lib/katello_attach_subscription/fact_analyzer.rb:10:in `system_type_from_facts': undefined method `[]' for nil:NilClass (NoMethodError) #68

Open gearboxscott opened 5 years ago

gearboxscott commented 5 years ago

Getting this error when running katello-attach-subscription:

./katello-attach-subscription --config=myconfig.yml --noop
Subscription parsing started. Please be patient.
Started parsing entry 1/2
  Started parsing for product 'rhel'
    Subscription parsing results of search string '8a7ab47e6bfafc75016bfb6963c0045a' is empty, not adding any subscription
Started parsing entry 2/2
  Started parsing for product 'rhel'
    Subscription parsing results of search string '8a7ab47e6bfafc75016bfb6963c0045a' is empty, not adding any subscription
Starting host collection from API. Please be patient.
Searching for Hypervisors
Completed hypervisor collection.
Hypervisors entry: 66
Searching for Physicals
Completed physical collection.
Physical entry: 0
Searching for Guests
Completed guests collection.
Hosts Entry: 1
Total Entry: 67
Starting host subscription assignment
Traceback (most recent call last):
        6: from ./katello-attach-subscription:1829:in `<main>'
        5: from ./katello-attach-subscription:794:in `vdcupdate'
        4: from ./katello-attach-subscription:794:in `each_with_index'
        3: from ./katello-attach-subscription:794:in `each'
        2: from ./katello-attach-subscription:851:in `block in vdcupdate'
        1: from /root/bin/katello-attach-subscription/lib/katello_attach_subscription/fact_analyzer.rb:39:in `system_type'
/root/bin/katello-attach-subscription/lib/katello_attach_subscription/fact_analyzer.rb:10:in `system_type_from_facts': undefined method `[]' for nil:NilClass (NoMethodError)

Here is the inside of myconfig.yml:

---
:settings:
  :user: admin
  :pass: redhat123
  :uri: https://server
  :org: 1
:subs:
  -
    hostname: esx*\.local
    sub:
      rhel:
        - 8a7ab47e6bfafc75016bfb6963c0045a
Rocco83 commented 5 years ago

Hey Scott,

Satellite version running? KAS version running? Also, can you execute it with --debug?

gearboxscott commented 5 years ago

Satellite 6.5.1-1 KAS is an acronym for what?

Debug Output:

# ./katello-attach-subscription --config=signet.yml --noop --debug
Subscription parsing started. Please be patient.
 Started parsing entry 1/2
 VERBOSE: started parsing for entry 'plvbl1esx*\.redacted\.local'
 VERBOSE: subs look for host type '', looking for 'NORMAL' subscriptions
  Started parsing for product 'rhel'
  DEBUG: in the desired_sub_hash, desidered_product_sub_array: ["8a7ab47e6bfafc75016bfb6963c0045a"]
   VERBOSE: parsing subscription '8a7ab47e6bfafc75016bfb6963c0045a'
    Subscription parsing results of search string '8a7ab47e6bfafc75016bfb6963c0045a' is empty, not adding any subscription
 Started parsing entry 2/2
 VERBOSE: started parsing for entry 'xcscrlesx*\.redacted\.local'
 VERBOSE: subs look for host type '', looking for 'NORMAL' subscriptions
  Started parsing for product 'rhel'
  DEBUG: in the desired_sub_hash, desidered_product_sub_array: ["8a7ab47e6bfafc75016bfb6963c0045a"]
   VERBOSE: parsing subscription '8a7ab47e6bfafc75016bfb6963c0045a'
    Subscription parsing results of search string '8a7ab47e6bfafc75016bfb6963c0045a' is empty, not adding any subscription
 DEBUG: the full yaml subs output after modification
[{"hostname"=>"plvbl1esx*\\.redacted\\.local", "sub"=>{"rhel"=>["8a7ab47e6bfafc75016bfb6963c0045a"]}}, {"hostname"=>"xcscrlesx*\\.redacted\\.local", "sub"=>{"rhel"=>["8a7ab47e6bfafc75016bfb6963c0045a"]}}]
DEBUG: virt-who enabled: false
Starting host collection from API. Please be patient.
Searching for Hypervisors
Completed hypervisor collection.
Hypervisors entry: 117
Searching for Physicals
Completed physical collection.
Physical entry: 34
Searching for Guests
Completed guests collection.
Hosts Entry: 177
Total Entry: 328
Starting host subscription assignment
 VERBOSE: Current system 1/328: virt-who-esxecom03.redacated.local-1 (3)
 DEBUG: detail of the current system to be checked:
{"ip"=>nil, "ip6"=>nil, "environment_id"=>nil, "environment_name"=>nil, "last_report"=>nil, "mac"=>nil, "realm_id"=>nil, "realm_name"=>nil, "sp_mac"=>nil, "sp_ip"=>nil, "sp_name"=>nil, "domain_id"=>nil, "domain_name"=>nil, "architecture_id"=>nil, "architecture_name"=>nil, "operatingsystem_id"=>nil, "operatingsystem_name"=>nil, "subnet_id"=>nil, "subnet_name"=>nil, "subnet6_id"=>nil, "subnet6_name"=>nil, "sp_subnet_id"=>nil, "ptable_id"=>nil, "ptable_name"=>nil, "medium_id"=>nil, "medium_name"=>nil, "pxe_loader"=>nil, "build"=>false, "comment"=>nil, "disk"=>nil, "installed_at"=>nil, "model_id"=>nil, "hostgroup_id"=>nil, "owner_id"=>1, "owner_name"=>"Anonymous Admin", "owner_type"=>"User", "enabled"=>false, "managed"=>false, "use_image"=>nil, "image_file"=>"", "uuid"=>nil, "compute_resource_id"=>nil, "compute_resource_name"=>nil, "compute_profile_id"=>nil, "compute_profile_name"=>nil, "capabilities"=>["build"], "provision_method"=>"build", "certname"=>"virt-who-esxecom03.redacated.local-1", "image_id"=>nil, "image_name"=>nil, "created_at"=>"2019-07-16 13:56:28 UTC", "updated_at"=>"2019-07-19 15:25:27 UTC", "last_compile"=>"2019-07-16 14:02:23 UTC", "global_status"=>0, "global_status_label"=>"OK", "organization_id"=>1, "organization_name"=>"SIGNET", "location_id"=>2, "location_name"=>"FSC", "puppet_status"=>0, "model_name"=>nil, "subscription_status"=>0, "subscription_status_label"=>"Fully entitled", "purpose_sla_status"=>3, "purpose_sla_status_label"=>"Not Specified", "purpose_role_status"=>3, "purpose_role_status_label"=>"Not Specified", "purpose_usage_status"=>3, "purpose_usage_status_label"=>"Not Specified", "purpose_addons_status"=>3, "purpose_addons_status_label"=>"Not Specified", "purpose_status"=>3, "purpose_status_label"=>"Not Specified", "name"=>"virt-who-esxecom03.redacated.local-1", "id"=>3, "puppet_proxy_id"=>nil, "puppet_proxy_name"=>nil, "puppet_ca_proxy_id"=>nil, "puppet_ca_proxy_name"=>nil, "openscap_proxy_id"=>nil, "openscap_proxy_name"=>nil, "puppet_proxy"=>nil, "puppet_ca_proxy"=>nil, "openscap_proxy"=>nil, "hostgroup_name"=>nil, "hostgroup_title"=>nil, "subscription_global_status"=>0, "subscription_facet_attributes"=>{"id"=>2, "uuid"=>"cc86e8b4-a8d2-4923-be48-675bea163793", "last_checkin"=>"2019-07-16 13:56:27 UTC", "service_level"=>"", "release_version"=>nil, "autoheal"=>false, "registered_at"=>"2019-07-16 13:56:27 UTC", "registered_through"=>nil, "purpose_role"=>nil, "purpose_usage"=>nil, "purpose_addons"=>[], "user"=>nil}}
  DEBUG: 'virt-who-esxecom03.redacated.local-1' id 3 :hosts api data:
{"ip"=>nil, "ip6"=>nil, "environment_id"=>nil, "environment_name"=>nil, "last_report"=>nil, "mac"=>nil, "realm_id"=>nil, "realm_name"=>nil, "sp_mac"=>nil, "sp_ip"=>nil, "sp_name"=>nil, "domain_id"=>nil, "domain_name"=>nil, "architecture_id"=>nil, "architecture_name"=>nil, "operatingsystem_id"=>nil, "operatingsystem_name"=>nil, "subnet_id"=>nil, "subnet_name"=>nil, "subnet6_id"=>nil, "subnet6_name"=>nil, "sp_subnet_id"=>nil, "ptable_id"=>nil, "ptable_name"=>nil, "medium_id"=>nil, "medium_name"=>nil, "pxe_loader"=>nil, "build"=>false, "comment"=>nil, "disk"=>nil, "installed_at"=>nil, "model_id"=>nil, "hostgroup_id"=>nil, "owner_id"=>1, "owner_name"=>"Anonymous Admin", "owner_type"=>"User", "enabled"=>false, "managed"=>false, "use_image"=>nil, "image_file"=>"", "uuid"=>nil, "compute_resource_id"=>nil, "compute_resource_name"=>nil, "compute_profile_id"=>nil, "compute_profile_name"=>nil, "capabilities"=>["build"], "provision_method"=>"build", "certname"=>"virt-who-esxecom03.redacated.local-1", "image_id"=>nil, "image_name"=>nil, "created_at"=>"2019-07-16 13:56:28 UTC", "updated_at"=>"2019-07-19 15:25:27 UTC", "last_compile"=>"2019-07-16 14:02:23 UTC", "global_status"=>0, "global_status_label"=>"OK", "organization_id"=>1, "organization_name"=>"SIGNET", "location_id"=>2, "location_name"=>"FSC", "puppet_status"=>0, "model_name"=>nil, "subscription_status"=>0, "subscription_status_label"=>"Fully entitled", "purpose_sla_status"=>3, "purpose_sla_status_label"=>"Not Specified", "purpose_role_status"=>3, "purpose_role_status_label"=>"Not Specified", "purpose_usage_status"=>3, "purpose_usage_status_label"=>"Not Specified", "purpose_addons_status"=>3, "purpose_addons_status_label"=>"Not Specified", "purpose_status"=>3, "purpose_status_label"=>"Not Specified", "name"=>"virt-who-esxecom03.redacated.local-1", "id"=>3, "puppet_proxy_id"=>nil, "puppet_proxy_name"=>nil, "puppet_ca_proxy_id"=>nil, "puppet_ca_proxy_name"=>nil, "openscap_proxy_id"=>nil, "openscap_proxy_name"=>nil, "puppet_proxy"=>nil, "puppet_ca_proxy"=>nil, "openscap_proxy"=>nil, "hostgroup_name"=>nil, "hostgroup_title"=>nil, "parameters"=>[], "all_parameters"=>[{"priority"=>0, "created_at"=>"2019-07-09 18:42:55 UTC", "updated_at"=>"2019-07-09 18:42:55 UTC", "id"=>2, "name"=>"enable-puppet5", "value"=>"true"}, {"priority"=>0, "created_at"=>"2019-07-09 18:42:55 UTC", "updated_at"=>"2019-07-09 18:42:55 UTC", "id"=>1, "name"=>"enable-epel", "value"=>"false"}], "subscription_global_status"=>0, "subscription_facet_attributes"=>{"host_type"=>"VMware ESXi", "id"=>2, "uuid"=>"cc86e8b4-a8d2-4923-be48-675bea163793", "last_checkin"=>"2019-07-16 13:56:27 UTC", "service_level"=>"", "release_version"=>nil, "autoheal"=>false, "registered_at"=>"2019-07-16 13:56:27 UTC", "registered_through"=>nil, "purpose_role"=>nil, "purpose_usage"=>nil, "purpose_addons"=>[], "user"=>nil, "virtual_host"=>nil, "virtual_guests"=>[{"id"=>70, "name"=>"rhimgdevwas01.redacted.com"}], "installed_products"=>[], "activation_keys"=>[], "compliance_reasons"=>[]}, "host_collections"=>[], "interfaces"=>[{"subnet_id"=>nil, "subnet_name"=>nil, "subnet6_id"=>nil, "subnet6_name"=>nil, "domain_id"=>nil, "domain_name"=>nil, "created_at"=>"2019-07-16 13:56:28 UTC", "updated_at"=>"2019-07-16 13:56:28 UTC", "managed"=>true, "identifier"=>nil, "id"=>4, "name"=>"virt-who-esxecom03.redacated.local-1", "ip"=>nil, "ip6"=>nil, "mac"=>nil, "mtu"=>nil, "fqdn"=>"virt-who-esxecom03.redacated.local-1", "primary"=>true, "provision"=>true, "type"=>"interface", "virtual"=>false}], "puppetclasses"=>[], "config_groups"=>[], "all_puppetclasses"=>[], "permissions"=>{"view_hosts"=>true, "create_hosts"=>true, "edit_hosts"=>true, "destroy_hosts"=>true, "build_hosts"=>true, "power_hosts"=>true, "console_hosts"=>true, "ipmi_boot_hosts"=>true, "puppetrun_hosts"=>true, "play_roles_on_host"=>true, "view_discovered_hosts"=>true, "submit_discovered_hosts"=>true, "auto_provision_discovered_hosts"=>true, "provision_discovered_hosts"=>true, "edit_discovered_hosts"=>true, "destroy_discovered_hosts"=>true}}
 DEBUG: YAML dump with all definitions for the current system
{:settings=>{:user=>"admin", :pass=>"secret", :uri=>"https://prodsat.redacated.com", :org=>1}, :subs=>[{"hostname"=>"plvbl1esx*\\.redacted\\.local", "sub"=>{"rhel"=>["8a7ab47e6bfafc75016bfb6963c0045a"]}}, {"hostname"=>"xcscrlesx*\\.redacted\\.local", "sub"=>{"rhel"=>["8a7ab47e6bfafc75016bfb6963c0045a"]}}]}
  VERBOSE: skipping 'virt-who-esxecom03.redacated.local-1' as system cluster type doesn't match sub type or system name do not match following regexp:
           'plvbl1esx*\.redacted\.local'
  VERBOSE: skipping 'virt-who-esxecom03.redacated.local-1' as system cluster type doesn't match sub type or system name do not match following regexp:
           'xcscrlesx*\.redacted\.local'
 DEBUG: desired_sub_hash value
nil
 VERBOSE: Current system 2/328: virt-who-esxprod01.redacated.local-1 (120)
 DEBUG: detail of the current system to be checked:
{"ip"=>nil, "ip6"=>nil, "environment_id"=>nil, "environment_name"=>nil, "last_report"=>nil, "mac"=>nil, "realm_id"=>nil, "realm_name"=>nil, "sp_mac"=>nil, "sp_ip"=>nil, "sp_name"=>nil, "domain_id"=>nil, "domain_name"=>nil, "architecture_id"=>nil, "architecture_name"=>nil, "operatingsystem_id"=>nil, "operatingsystem_name"=>nil, "subnet_id"=>nil, "subnet_name"=>nil, "subnet6_id"=>nil, "subnet6_name"=>nil, "sp_subnet_id"=>nil, "ptable_id"=>nil, "ptable_name"=>nil, "medium_id"=>nil, "medium_name"=>nil, "pxe_loader"=>nil, "build"=>false, "comment"=>nil, "disk"=>nil, "installed_at"=>nil, "model_id"=>nil, "hostgroup_id"=>nil, "owner_id"=>1, "owner_name"=>"Anonymous Admin", "owner_type"=>"User", "enabled"=>false, "managed"=>false, "use_image"=>nil, "image_file"=>"", "uuid"=>nil, "compute_resource_id"=>nil, "compute_resource_name"=>nil, "compute_profile_id"=>nil, "compute_profile_name"=>nil, "capabilities"=>["build"], "provision_method"=>"build", "certname"=>"virt-who-esxprod01.redacated.local-1", "image_id"=>nil, "image_name"=>nil, "created_at"=>"2019-07-17 13:41:12 UTC", "updated_at"=>"2019-07-19 15:27:10 UTC", "last_compile"=>"2019-07-17 13:41:43 UTC", "global_status"=>0, "global_status_label"=>"OK", "organization_id"=>1, "organization_name"=>"SIGNET", "location_id"=>2, "location_name"=>"FSC", "puppet_status"=>0, "model_name"=>nil, "subscription_status"=>0, "subscription_status_label"=>"Fully entitled", "purpose_sla_status"=>3, "purpose_sla_status_label"=>"Not Specified", "purpose_role_status"=>3, "purpose_role_status_label"=>"Not Specified", "purpose_usage_status"=>3, "purpose_usage_status_label"=>"Not Specified", "purpose_addons_status"=>3, "purpose_addons_status_label"=>"Not Specified", "purpose_status"=>3, "purpose_status_label"=>"Not Specified", "name"=>"virt-who-esxprod01.redacated.local-1", "id"=>120, "puppet_proxy_id"=>nil, "puppet_proxy_name"=>nil, "puppet_ca_proxy_id"=>nil, "puppet_ca_proxy_name"=>nil, "openscap_proxy_id"=>nil, "openscap_proxy_name"=>nil, "puppet_proxy"=>nil, "puppet_ca_proxy"=>nil, "openscap_proxy"=>nil, "hostgroup_name"=>nil, "hostgroup_title"=>nil, "subscription_global_status"=>0, "subscription_facet_attributes"=>{"id"=>123, "uuid"=>"77b182bf-7e93-4fa9-8613-aea8e3778763", "last_checkin"=>"2019-07-17 13:41:05 UTC", "service_level"=>"", "release_version"=>nil, "autoheal"=>false, "registered_at"=>"2019-07-17 13:41:05 UTC", "registered_through"=>nil, "purpose_role"=>nil, "purpose_usage"=>nil, "purpose_addons"=>[], "user"=>nil}}
  DEBUG: 'virt-who-esxprod01.redacated.local-1' id 120 :hosts api data:
{"ip"=>nil, "ip6"=>nil, "environment_id"=>nil, "environment_name"=>nil, "last_report"=>nil, "mac"=>nil, "realm_id"=>nil, "realm_name"=>nil, "sp_mac"=>nil, "sp_ip"=>nil, "sp_name"=>nil, "domain_id"=>nil, "domain_name"=>nil, "architecture_id"=>nil, "architecture_name"=>nil, "operatingsystem_id"=>nil, "operatingsystem_name"=>nil, "subnet_id"=>nil, "subnet_name"=>nil, "subnet6_id"=>nil, "subnet6_name"=>nil, "sp_subnet_id"=>nil, "ptable_id"=>nil, "ptable_name"=>nil, "medium_id"=>nil, "medium_name"=>nil, "pxe_loader"=>nil, "build"=>false, "comment"=>nil, "disk"=>nil, "installed_at"=>nil, "model_id"=>nil, "hostgroup_id"=>nil, "owner_id"=>1, "owner_name"=>"Anonymous Admin", "owner_type"=>"User", "enabled"=>false, "managed"=>false, "use_image"=>nil, "image_file"=>"", "uuid"=>nil, "compute_resource_id"=>nil, "compute_resource_name"=>nil, "compute_profile_id"=>nil, "compute_profile_name"=>nil, "capabilities"=>["build"], "provision_method"=>"build", "certname"=>"virt-who-esxprod01.redacated.local-1", "image_id"=>nil, "image_name"=>nil, "created_at"=>"2019-07-17 13:41:12 UTC", "updated_at"=>"2019-07-19 15:27:10 UTC", "last_compile"=>"2019-07-17 13:41:43 UTC", "global_status"=>0, "global_status_label"=>"OK", "organization_id"=>1, "organization_name"=>"SIGNET", "location_id"=>2, "location_name"=>"FSC", "puppet_status"=>0, "model_name"=>nil, "subscription_status"=>0, "subscription_status_label"=>"Fully entitled", "purpose_sla_status"=>3, "purpose_sla_status_label"=>"Not Specified", "purpose_role_status"=>3, "purpose_role_status_label"=>"Not Specified", "purpose_usage_status"=>3, "purpose_usage_status_label"=>"Not Specified", "purpose_addons_status"=>3, "purpose_addons_status_label"=>"Not Specified", "purpose_status"=>3, "purpose_status_label"=>"Not Specified", "name"=>"virt-who-esxprod01.redacated.local-1", "id"=>120, "puppet_proxy_id"=>nil, "puppet_proxy_name"=>nil, "puppet_ca_proxy_id"=>nil, "puppet_ca_proxy_name"=>nil, "openscap_proxy_id"=>nil, "openscap_proxy_name"=>nil, "puppet_proxy"=>nil, "puppet_ca_proxy"=>nil, "openscap_proxy"=>nil, "hostgroup_name"=>nil, "hostgroup_title"=>nil, "parameters"=>[], "all_parameters"=>[{"priority"=>0, "created_at"=>"2019-07-09 18:42:55 UTC", "updated_at"=>"2019-07-09 18:42:55 UTC", "id"=>2, "name"=>"enable-puppet5", "value"=>"true"}, {"priority"=>0, "created_at"=>"2019-07-09 18:42:55 UTC", "updated_at"=>"2019-07-09 18:42:55 UTC", "id"=>1, "name"=>"enable-epel", "value"=>"false"}], "subscription_global_status"=>0, "subscription_facet_attributes"=>{"host_type"=>"VMware ESXi", "id"=>123, "uuid"=>"77b182bf-7e93-4fa9-8613-aea8e3778763", "last_checkin"=>"2019-07-17 13:41:05 UTC", "service_level"=>"", "release_version"=>nil, "autoheal"=>false, "registered_at"=>"2019-07-17 13:41:05 UTC", "registered_through"=>nil, "purpose_role"=>nil, "purpose_usage"=>nil, "purpose_addons"=>[], "user"=>nil, "virtual_host"=>nil, "virtual_guests"=>[{"id"=>285, "name"=>"rhecomprodcms01.redacted.com"}], "installed_products"=>[], "activation_keys"=>[], "compliance_reasons"=>[]}, "host_collections"=>[], "interfaces"=>[{"subnet_id"=>nil, "subnet_name"=>nil, "subnet6_id"=>nil, "subnet6_name"=>nil, "domain_id"=>nil, "domain_name"=>nil, "created_at"=>"2019-07-17 13:41:12 UTC", "updated_at"=>"2019-07-17 13:41:12 UTC", "managed"=>true, "identifier"=>nil, "id"=>125, "name"=>"virt-who-esxprod01.redacated.local-1", "ip"=>nil, "ip6"=>nil, "mac"=>nil, "mtu"=>nil, "fqdn"=>"virt-who-esxprod01.redacated.local-1", "primary"=>true, "provision"=>true, "type"=>"interface", "virtual"=>false}], "puppetclasses"=>[], "config_groups"=>[], "all_puppetclasses"=>[], "permissions"=>{"view_hosts"=>true, "create_hosts"=>true, "edit_hosts"=>true, "destroy_hosts"=>true, "build_hosts"=>true, "power_hosts"=>true, "console_hosts"=>true, "ipmi_boot_hosts"=>true, "puppetrun_hosts"=>true, "play_roles_on_host"=>true, "view_discovered_hosts"=>true, "submit_discovered_hosts"=>true, "auto_provision_discovered_hosts"=>true, "provision_discovered_hosts"=>true, "edit_discovered_hosts"=>true, "destroy_discovered_hosts"=>true}}
 DEBUG: YAML dump with all definitions for the current system
{:settings=>{:user=>"admin", :pass=>"redhat123", :uri=>"https://prodsat.redacated.com", :org=>1}, :subs=>[{"hostname"=>"plvbl1esx*\\.redacted\\.local", "sub"=>{"rhel"=>["8a7ab47e6bfafc75016bfb6963c0045a"]}}, {"hostname"=>"xcscrlesx*\\.redacted\\.local", "sub"=>{"rhel"=>["8a7ab47e6bfafc75016bfb6963c0045a"]}}]}
  VERBOSE: skipping 'virt-who-esxprod01.redacated.local-1' as system cluster type doesn't match sub type or system name do not match following regexp:
           'plvbl1esx*\.redacted\.local'
  VERBOSE: skipping 'virt-who-esxprod01.redacated.local-1' as system cluster type doesn't match sub type or system name do not match following regexp:
           'xcscrlesx*\.redacted\.local'
 DEBUG: desired_sub_hash value
nil
 VERBOSE: Current system 3/328: virt-who-esxprod02.redacated.local-1 (123)
 DEBUG: detail of the current system to be checked:
{"ip"=>nil, "ip6"=>nil, "environment_id"=>nil, "environment_name"=>nil, "last_report"=>nil, "mac"=>nil, "realm_id"=>nil, "realm_name"=>nil, "sp_mac"=>nil, "sp_ip"=>nil, "sp_name"=>nil, "domain_id"=>nil, "domain_name"=>nil, "architecture_id"=>nil, "architecture_name"=>nil, "operatingsystem_id"=>nil, "operatingsystem_name"=>nil, "subnet_id"=>nil, "subnet_name"=>nil, "subnet6_id"=>nil, "subnet6_name"=>nil, "sp_subnet_id"=>nil, "ptable_id"=>nil, "ptable_name"=>nil, "medium_id"=>nil, "medium_name"=>nil, "pxe_loader"=>nil, "build"=>false, "comment"=>nil, "disk"=>nil, "installed_at"=>nil, "model_id"=>nil, "hostgroup_id"=>nil, "owner_id"=>1, "owner_name"=>"Anonymous Admin", "owner_type"=>"User", "enabled"=>false, "managed"=>false, "use_image"=>nil, "image_file"=>"", "uuid"=>nil, "compute_resource_id"=>nil, "compute_resource_name"=>nil, "compute_profile_id"=>nil, "compute_profile_name"=>nil, "capabilities"=>["build"], "provision_method"=>"build", "certname"=>"virt-who-esxprod02.redacated.local-1", "image_id"=>nil, "image_name"=>nil, "created_at"=>"2019-07-17 13:41:12 UTC", "updated_at"=>"2019-07-19 15:28:43 UTC", "last_compile"=>"2019-07-17 13:41:43 UTC", "global_status"=>0, "global_status_label"=>"OK", "organization_id"=>1, "organization_name"=>"SIGNET", "location_id"=>2, "location_name"=>"FSC", "puppet_status"=>0, "model_name"=>nil, "subscription_status"=>0, "subscription_status_label"=>"Fully entitled", "purpose_sla_status"=>3, "purpose_sla_status_label"=>"Not Specified", "purpose_role_status"=>3, "purpose_role_status_label"=>"Not Specified", "purpose_usage_status"=>3, "purpose_usage_status_label"=>"Not Specified", "purpose_addons_status"=>3, "purpose_addons_status_label"=>"Not Specified", "purpose_status"=>3, "purpose_status_label"=>"Not Specified", "name"=>"virt-who-esxprod02.redacated.local-1", "id"=>123, "puppet_proxy_id"=>nil, "puppet_proxy_name"=>nil, "puppet_ca_proxy_id"=>nil, "puppet_ca_proxy_name"=>nil, "openscap_proxy_id"=>nil, "openscap_proxy_name"=>nil, "puppet_proxy"=>nil, "puppet_ca_proxy"=>nil, "openscap_proxy"=>nil, "hostgroup_name"=>nil, "hostgroup_title"=>nil, "subscription_global_status"=>0, "subscription_facet_attributes"=>{"id"=>126, "uuid"=>"16cf2976-7d24-40b2-b904-ca830f304374", "last_checkin"=>"2019-07-17 13:41:05 UTC", "service_level"=>"", "release_version"=>nil, "autoheal"=>false, "registered_at"=>"2019-07-17 13:41:05 UTC", "registered_through"=>nil, "purpose_role"=>nil, "purpose_usage"=>nil, "purpose_addons"=>[], "user"=>nil}}
  DEBUG: 'virt-who-esxprod02.redacated.local-1' id 123 :hosts api data:
{"ip"=>nil, "ip6"=>nil, "environment_id"=>nil, "environment_name"=>nil, "last_report"=>nil, "mac"=>nil, "realm_id"=>nil, "realm_name"=>nil, "sp_mac"=>nil, "sp_ip"=>nil, "sp_name"=>nil, "domain_id"=>nil, "domain_name"=>nil, "architecture_id"=>nil, "architecture_name"=>nil, "operatingsystem_id"=>nil, "operatingsystem_name"=>nil, "subnet_id"=>nil, "subnet_name"=>nil, "subnet6_id"=>nil, "subnet6_name"=>nil, "sp_subnet_id"=>nil, "ptable_id"=>nil, "ptable_name"=>nil, "medium_id"=>nil, "medium_name"=>nil, "pxe_loader"=>nil, "build"=>false, "comment"=>nil, "disk"=>nil, "installed_at"=>nil, "model_id"=>nil, "hostgroup_id"=>nil, "owner_id"=>1, "owner_name"=>"Anonymous Admin", "owner_type"=>"User", "enabled"=>false, "managed"=>false, "use_image"=>nil, "image_file"=>"", "uuid"=>nil, "compute_resource_id"=>nil, "compute_resource_name"=>nil, "compute_profile_id"=>nil, "compute_profile_name"=>nil, "capabilities"=>["build"], "provision_method"=>"build", "certname"=>"virt-who-esxprod02.redacated.local-1", "image_id"=>nil, "image_name"=>nil, "created_at"=>"2019-07-17 13:41:12 UTC", "updated_at"=>"2019-07-19 15:28:43 UTC", "last_compile"=>"2019-07-17 13:41:43 UTC", "global_status"=>0, "global_status_label"=>"OK", "organization_id"=>1, "organization_name"=>"SIGNET", "location_id"=>2, "location_name"=>"FSC", "puppet_status"=>0, "model_name"=>nil, "subscription_status"=>0, "subscription_status_label"=>"Fully entitled", "purpose_sla_status"=>3, "purpose_sla_status_label"=>"Not Specified", "purpose_role_status"=>3, "purpose_role_status_label"=>"Not Specified", "purpose_usage_status"=>3, "purpose_usage_status_label"=>"Not Specified", "purpose_addons_status"=>3, "purpose_addons_status_label"=>"Not Specified", "purpose_status"=>3, "purpose_status_label"=>"Not Specified", "name"=>"virt-who-esxprod02.redacated.local-1", "id"=>123, "puppet_proxy_id"=>nil, "puppet_proxy_name"=>nil, "puppet_ca_proxy_id"=>nil, "puppet_ca_proxy_name"=>nil, "openscap_proxy_id"=>nil, "openscap_proxy_name"=>nil, "puppet_proxy"=>nil, "puppet_ca_proxy"=>nil, "openscap_proxy"=>nil, "hostgroup_name"=>nil, "hostgroup_title"=>nil, "parameters"=>[], "all_parameters"=>[{"priority"=>0, "created_at"=>"2019-07-09 18:42:55 UTC", "updated_at"=>"2019-07-09 18:42:55 UTC", "id"=>2, "name"=>"enable-puppet5", "value"=>"true"}, {"priority"=>0, "created_at"=>"2019-07-09 18:42:55 UTC", "updated_at"=>"2019-07-09 18:42:55 UTC", "id"=>1, "name"=>"enable-epel", "value"=>"false"}], "subscription_global_status"=>0, "subscription_facet_attributes"=>{"host_type"=>"VMware ESXi", "id"=>126, "uuid"=>"16cf2976-7d24-40b2-b904-ca830f304374", "last_checkin"=>"2019-07-17 13:41:05 UTC", "service_level"=>"", "release_version"=>nil, "autoheal"=>false, "registered_at"=>"2019-07-17 13:41:05 UTC", "registered_through"=>nil, "purpose_role"=>nil, "purpose_usage"=>nil, "purpose_addons"=>[], "user"=>nil, "virtual_host"=>nil, "virtual_guests"=>[{"id"=>270, "name"=>"rhscmtestweb02.redacted.com"}, {"id"=>251, "name"=>"rhecomstageweb01.redacted.com"}, {"id"=>252, "name"=>"rhdmzdevwas01.redacted.com"}, {"id"=>313, "name"=>"rhrmdyprodapp02.redacted.com"}, {"id"=>280, "name"=>"rhcdeprodwas01.redacted.com"}, {"id"=>233, "name"=>"rhecombldwas01.redacted.com"}], "installed_products"=>[], "activation_keys"=>[], "compliance_reasons"=>[]}, "host_collections"=>[], "interfaces"=>[{"subnet_id"=>nil, "subnet_name"=>nil, "subnet6_id"=>nil, "subnet6_name"=>nil, "domain_id"=>nil, "domain_name"=>nil, "created_at"=>"2019-07-17 13:41:12 UTC", "updated_at"=>"2019-07-17 13:41:12 UTC", "managed"=>true, "identifier"=>nil, "id"=>128, "name"=>"virt-who-esxprod02.redacated.local-1", "ip"=>nil, "ip6"=>nil, "mac"=>nil, "mtu"=>nil, "fqdn"=>"virt-who-esxprod02.redacated.local-1", "primary"=>true, "provision"=>true, "type"=>"interface", "virtual"=>false}], "puppetclasses"=>[], "config_groups"=>[], "all_puppetclasses"=>[], "permissions"=>{"view_hosts"=>true, "create_hosts"=>true, "edit_hosts"=>true, "destroy_hosts"=>true, "build_hosts"=>true, "power_hosts"=>true, "console_hosts"=>true, "ipmi_boot_hosts"=>true, "puppetrun_hosts"=>true, "play_roles_on_host"=>true, "view_discovered_hosts"=>true, "submit_discovered_hosts"=>true, "auto_provision_discovered_hosts"=>true, "provision_discovered_hosts"=>true, "edit_discovered_hosts"=>true, "destroy_discovered_hosts"=>true}}
 DEBUG: YAML dump with all definitions for the current system
{:settings=>{:user=>"admin", :pass=>"redhat123", :uri=>"https://prodsat.redacated.com", :org=>1}, :subs=>[{"hostname"=>"plvbl1esx*\\.redacted\\.local", "sub"=>{"rhel"=>["8a7ab47e6bfafc75016bfb6963c0045a"]}}, {"hostname"=>"xcscrlesx*\\.redacted\\.local", "sub"=>{"rhel"=>["8a7ab47e6bfafc75016bfb6963c0045a"]}}]}
  VERBOSE: skipping 'virt-who-esxprod02.redacated.local-1' as system cluster type doesn't match sub type or system name do not match following regexp:
           'plvbl1esx*\.redacted\.local'
  VERBOSE: skipping 'virt-who-esxprod02.redacated.local-1' as system cluster type doesn't match sub type or system name do not match following regexp:
           'xcscrlesx*\.redacted\.local'
 DEBUG: desired_sub_hash value
nil
 VERBOSE: Current system 4/328: virt-who-esxprod04.redacated.local-1 (124)
 DEBUG: detail of the current system to be checked:
{"ip"=>nil, "ip6"=>nil, "environment_id"=>nil, "environment_name"=>nil, "last_report"=>nil, "mac"=>nil, "realm_id"=>nil, "realm_name"=>nil, "sp_mac"=>nil, "sp_ip"=>nil, "sp_name"=>nil, "domain_id"=>nil, "domain_name"=>nil, "architecture_id"=>nil, "architecture_name"=>nil, "operatingsystem_id"=>nil, "operatingsystem_name"=>nil, "subnet_id"=>nil, "subnet_name"=>nil, "subnet6_id"=>nil, "subnet6_name"=>nil, "sp_subnet_id"=>nil, "ptable_id"=>nil, "ptable_name"=>nil, "medium_id"=>nil, "medium_name"=>nil, "pxe_loader"=>nil, "build"=>false, "comment"=>nil, "disk"=>nil, "installed_at"=>nil, "model_id"=>nil, "hostgroup_id"=>nil, "owner_id"=>1, "owner_name"=>"Anonymous Admin", "owner_type"=>"User", "enabled"=>false, "managed"=>false, "use_image"=>nil, "image_file"=>"", "uuid"=>nil, "compute_resource_id"=>nil, "compute_resource_name"=>nil, "compute_profile_id"=>nil, "compute_profile_name"=>nil, "capabilities"=>["build"], "provision_method"=>"build", "certname"=>"virt-who-esxprod04.redacated.local-1", "image_id"=>nil, "image_name"=>nil, "created_at"=>"2019-07-17 13:41:13 UTC", "updated_at"=>"2019-07-19 17:35:43 UTC", "last_compile"=>"2019-07-17 13:41:43 UTC", "global_status"=>0, "global_status_label"=>"OK", "organization_id"=>1, "organization_name"=>"SIGNET", "location_id"=>2, "location_name"=>"FSC", "puppet_status"=>0, "model_name"=>nil, "subscription_status"=>0, "subscription_status_label"=>"Fully entitled", "purpose_sla_status"=>3, "purpose_sla_status_label"=>"Not Specified", "purpose_role_status"=>3, "purpose_role_status_label"=>"Not Specified", "purpose_usage_status"=>3, "purpose_usage_status_label"=>"Not Specified", "purpose_addons_status"=>3, "purpose_addons_status_label"=>"Not Specified", "purpose_status"=>3, "purpose_status_label"=>"Not Specified", "name"=>"virt-who-esxprod04.redacated.local-1", "id"=>124, "puppet_proxy_id"=>nil, "puppet_proxy_name"=>nil, "puppet_ca_proxy_id"=>nil, "puppet_ca_proxy_name"=>nil, "openscap_proxy_id"=>nil, "openscap_proxy_name"=>nil, "puppet_proxy"=>nil, "puppet_ca_proxy"=>nil, "openscap_proxy"=>nil, "hostgroup_name"=>nil, "hostgroup_title"=>nil, "subscription_global_status"=>0, "subscription_facet_attributes"=>{"id"=>127, "uuid"=>"882e1253-524b-47a5-94a6-d37bcd6a5428", "last_checkin"=>"2019-07-17 13:41:05 UTC", "service_level"=>"", "release_version"=>nil, "autoheal"=>false, "registered_at"=>"2019-07-17 13:41:05 UTC", "registered_through"=>nil, "purpose_role"=>nil, "purpose_usage"=>nil, "purpose_addons"=>[], "user"=>nil}}
  DEBUG: 'virt-who-esxprod04.redacated.local-1' id 124 :hosts api data:
{"ip"=>nil, "ip6"=>nil, "environment_id"=>nil, "environment_name"=>nil, "last_report"=>nil, "mac"=>nil, "realm_id"=>nil, "realm_name"=>nil, "sp_mac"=>nil, "sp_ip"=>nil, "sp_name"=>nil, "domain_id"=>nil, "domain_name"=>nil, "architecture_id"=>nil, "architecture_name"=>nil, "operatingsystem_id"=>nil, "operatingsystem_name"=>nil, "subnet_id"=>nil, "subnet_name"=>nil, "subnet6_id"=>nil, "subnet6_name"=>nil, "sp_subnet_id"=>nil, "ptable_id"=>nil, "ptable_name"=>nil, "medium_id"=>nil, "medium_name"=>nil, "pxe_loader"=>nil, "build"=>false, "comment"=>nil, "disk"=>nil, "installed_at"=>nil, "model_id"=>nil, "hostgroup_id"=>nil, "owner_id"=>1, "owner_name"=>"Anonymous Admin", "owner_type"=>"User", "enabled"=>false, "managed"=>false, "use_image"=>nil, "image_file"=>"", "uuid"=>nil, "compute_resource_id"=>nil, "compute_resource_name"=>nil, "compute_profile_id"=>nil, "compute_profile_name"=>nil, "capabilities"=>["build"], "provision_method"=>"build", "certname"=>"virt-who-esxprod04.redacated.local-1", "image_id"=>nil, "image_name"=>nil, "created_at"=>"2019-07-17 13:41:13 UTC", "updated_at"=>"2019-07-19 17:35:43 UTC", "last_compile"=>"2019-07-17 13:41:43 UTC", "global_status"=>0, "global_status_label"=>"OK", "organization_id"=>1, "organization_name"=>"SIGNET", "location_id"=>2, "location_name"=>"FSC", "puppet_status"=>0, "model_name"=>nil, "subscription_status"=>0, "subscription_status_label"=>"Fully entitled", "purpose_sla_status"=>3, "purpose_sla_status_label"=>"Not Specified", "purpose_role_status"=>3, "purpose_role_status_label"=>"Not Specified", "purpose_usage_status"=>3, "purpose_usage_status_label"=>"Not Specified", "purpose_addons_status"=>3, "purpose_addons_status_label"=>"Not Specified", "purpose_status"=>3, "purpose_status_label"=>"Not Specified", "name"=>"virt-who-esxprod04.redacated.local-1", "id"=>124, "puppet_proxy_id"=>nil, "puppet_proxy_name"=>nil, "puppet_ca_proxy_id"=>nil, "puppet_ca_proxy_name"=>nil, "openscap_proxy_id"=>nil, "openscap_proxy_name"=>nil, "puppet_proxy"=>nil, "puppet_ca_proxy"=>nil, "openscap_proxy"=>nil, "hostgroup_name"=>nil, "hostgroup_title"=>nil, "parameters"=>[], "all_parameters"=>[{"priority"=>0, "created_at"=>"2019-07-09 18:42:55 UTC", "updated_at"=>"2019-07-09 18:42:55 UTC", "id"=>2, "name"=>"enable-puppet5", "value"=>"true"}, {"priority"=>0, "created_at"=>"2019-07-09 18:42:55 UTC", "updated_at"=>"2019-07-09 18:42:55 UTC", "id"=>1, "name"=>"enable-epel", "value"=>"false"}], "subscription_global_status"=>0, "subscription_facet_attributes"=>{"host_type"=>"VMware ESXi", "id"=>127, "uuid"=>"882e1253-524b-47a5-94a6-d37bcd6a5428", "last_checkin"=>"2019-07-17 13:41:05 UTC", "service_level"=>"", "release_version"=>nil, "autoheal"=>false, "registered_at"=>"2019-07-17 13:41:05 UTC", "registered_through"=>nil, "purpose_role"=>nil, "purpose_usage"=>nil, "purpose_addons"=>[], "user"=>nil, "virtual_host"=>nil, "virtual_guests"=>[{"id"=>215, "name"=>"rhrmdystageapp01.redacted.com"}, {"id"=>284, "name"=>"rhdmzprodwas01.redacted.com"}, {"id"=>221, "name"=>"rhcredevtws01.redacted.com"}, {"id"=>231, "name"=>"rhrdsdevtws01.redacted.com"}], "installed_products"=>[], "activation_keys"=>[], "compliance_reasons"=>[]}, "host_collections"=>[], "interfaces"=>[{"subnet_id"=>nil, "subnet_name"=>nil, "subnet6_id"=>nil, "subnet6_name"=>nil, "domain_id"=>nil, "domain_name"=>nil, "created_at"=>"2019-07-17 13:41:13 UTC", "updated_at"=>"2019-07-17 13:41:13 UTC", "managed"=>true, "identifier"=>nil, "id"=>129, "name"=>"virt-who-esxprod04.redacated.local-1", "ip"=>nil, "ip6"=>nil, "mac"=>nil, "mtu"=>nil, "fqdn"=>"virt-who-esxprod04.redacated.local-1", "primary"=>true, "provision"=>true, "type"=>"interface", "virtual"=>false}], "puppetclasses"=>[], "config_groups"=>[], "all_puppetclasses"=>[], "permissions"=>{"view_hosts"=>true, "create_hosts"=>true, "edit_hosts"=>true, "destroy_hosts"=>true, "build_hosts"=>true, "power_hosts"=>true, "console_hosts"=>true, "ipmi_boot_hosts"=>true, "puppetrun_hosts"=>true, "play_roles_on_host"=>true, "view_discovered_hosts"=>true, "submit_discovered_hosts"=>true, "auto_provision_discovered_hosts"=>true, "provision_discovered_hosts"=>true, "edit_discovered_hosts"=>true, "destroy_discovered_hosts"=>true}}
 DEBUG: YAML dump with all definitions for the current system
{:settings=>{:user=>"admin", :pass=>"redhat123", :uri=>"https://prodsat.redacated.com", :org=>1}, :subs=>[{"hostname"=>"plvbl1esx*\\.redacted\\.local", "sub"=>{"rhel"=>["8a7ab47e6bfafc75016bfb6963c0045a"]}}, {"hostname"=>"xcscrlesx*\\.redacted\\.local", "sub"=>{"rhel"=>["8a7ab47e6bfafc75016bfb6963c0045a"]}}]}
  VERBOSE: skipping 'virt-who-esxprod04.redacated.local-1' as system cluster type doesn't match sub type or system name do not match following regexp:
           'plvbl1esx*\.redacted\.local'
  VERBOSE: skipping 'virt-who-esxprod04.redacated.local-1' as system cluster type doesn't match sub type or system name do not match following regexp:
           'xcscrlesx*\.redacted\.local'
 DEBUG: desired_sub_hash value
nil
 VERBOSE: Current system 5/328: virt-who-esxprod05.redacted.com-1 (118)
 DEBUG: detail of the current system to be checked:
{"ip"=>nil, "ip6"=>nil, "environment_id"=>nil, "environment_name"=>nil, "last_report"=>nil, "mac"=>nil, "realm_id"=>nil, "realm_name"=>nil, "sp_mac"=>nil, "sp_ip"=>nil, "sp_name"=>nil, "domain_id"=>nil, "domain_name"=>nil, "architecture_id"=>nil, "architecture_name"=>nil, "operatingsystem_id"=>nil, "operatingsystem_name"=>nil, "subnet_id"=>nil, "subnet_name"=>nil, "subnet6_id"=>nil, "subnet6_name"=>nil, "sp_subnet_id"=>nil, "ptable_id"=>nil, "ptable_name"=>nil, "medium_id"=>nil, "medium_name"=>nil, "pxe_loader"=>nil, "build"=>false, "comment"=>nil, "disk"=>nil, "installed_at"=>nil, "model_id"=>nil, "hostgroup_id"=>nil, "owner_id"=>1, "owner_name"=>"Anonymous Admin", "owner_type"=>"User", "enabled"=>false, "managed"=>false, "use_image"=>nil, "image_file"=>"", "uuid"=>nil, "compute_resource_id"=>nil, "compute_resource_name"=>nil, "compute_profile_id"=>nil, "compute_profile_name"=>nil, "capabilities"=>["build"], "provision_method"=>"build", "certname"=>"virt-who-esxprod05.redacted.com-1", "image_id"=>nil, "image_name"=>nil, "created_at"=>"2019-07-17 13:41:11 UTC", "updated_at"=>"2019-07-19 15:32:01 UTC", "last_compile"=>"2019-07-17 13:41:42 UTC", "global_status"=>0, "global_status_label"=>"OK", "organization_id"=>1, "organization_name"=>"SIGNET", "location_id"=>2, "location_name"=>"FSC", "puppet_status"=>0, "model_name"=>nil, "subscription_status"=>0, "subscription_status_label"=>"Fully entitled", "purpose_sla_status"=>3, "purpose_sla_status_label"=>"Not Specified", "purpose_role_status"=>3, "purpose_role_status_label"=>"Not Specified", "purpose_usage_status"=>3, "purpose_usage_status_label"=>"Not Specified", "purpose_addons_status"=>3, "purpose_addons_status_label"=>"Not Specified", "purpose_status"=>3, "purpose_status_label"=>"Not Specified", "name"=>"virt-who-esxprod05.redacted.com-1", "id"=>118, "puppet_proxy_id"=>nil, "puppet_proxy_name"=>nil, "puppet_ca_proxy_id"=>nil, "puppet_ca_proxy_name"=>nil, "openscap_proxy_id"=>nil, "openscap_proxy_name"=>nil, "puppet_proxy"=>nil, "puppet_ca_proxy"=>nil, "openscap_proxy"=>nil, "hostgroup_name"=>nil, "hostgroup_title"=>nil, "subscription_global_status"=>0, "subscription_facet_attributes"=>{"id"=>121, "uuid"=>"514bd621-71c0-445a-9018-d7fa478eade5", "last_checkin"=>"2019-07-17 13:41:05 UTC", "service_level"=>"", "release_version"=>nil, "autoheal"=>false, "registered_at"=>"2019-07-17 13:41:05 UTC", "registered_through"=>nil, "purpose_role"=>nil, "purpose_usage"=>nil, "purpose_addons"=>[], "user"=>nil}}
  DEBUG: 'virt-who-esxprod05.redacted.com-1' id 118 :hosts api data:
{"ip"=>nil, "ip6"=>nil, "environment_id"=>nil, "environment_name"=>nil, "last_report"=>nil, "mac"=>nil, "realm_id"=>nil, "realm_name"=>nil, "sp_mac"=>nil, "sp_ip"=>nil, "sp_name"=>nil, "domain_id"=>nil, "domain_name"=>nil, "architecture_id"=>nil, "architecture_name"=>nil, "operatingsystem_id"=>nil, "operatingsystem_name"=>nil, "subnet_id"=>nil, "subnet_name"=>nil, "subnet6_id"=>nil, "subnet6_name"=>nil, "sp_subnet_id"=>nil, "ptable_id"=>nil, "ptable_name"=>nil, "medium_id"=>nil, "medium_name"=>nil, "pxe_loader"=>nil, "build"=>false, "comment"=>nil, "disk"=>nil, "installed_at"=>nil, "model_id"=>nil, "hostgroup_id"=>nil, "owner_id"=>1, "owner_name"=>"Anonymous Admin", "owner_type"=>"User", "enabled"=>false, "managed"=>false, "use_image"=>nil, "image_file"=>"", "uuid"=>nil, "compute_resource_id"=>nil, "compute_resource_name"=>nil, "compute_profile_id"=>nil, "compute_profile_name"=>nil, "capabilities"=>["build"], "provision_method"=>"build", "certname"=>"virt-who-esxprod05.redacted.com-1", "image_id"=>nil, "image_name"=>nil, "created_at"=>"2019-07-17 13:41:11 UTC", "updated_at"=>"2019-07-19 15:32:01 UTC", "last_compile"=>"2019-07-17 13:41:42 UTC", "global_status"=>0, "global_status_label"=>"OK", "organization_id"=>1, "organization_name"=>"SIGNET", "location_id"=>2, "location_name"=>"FSC", "puppet_status"=>0, "model_name"=>nil, "subscription_status"=>0, "subscription_status_label"=>"Fully entitled", "purpose_sla_status"=>3, "purpose_sla_status_label"=>"Not Specified", "purpose_role_status"=>3, "purpose_role_status_label"=>"Not Specified", "purpose_usage_status"=>3, "purpose_usage_status_label"=>"Not Specified", "purpose_addons_status"=>3, "purpose_addons_status_label"=>"Not Specified", "purpose_status"=>3, "purpose_status_label"=>"Not Specified", "name"=>"virt-who-esxprod05.redacted.com-1", "id"=>118, "puppet_proxy_id"=>nil, "puppet_proxy_name"=>nil, "puppet_ca_proxy_id"=>nil, "puppet_ca_proxy_name"=>nil, "openscap_proxy_id"=>nil, "openscap_proxy_name"=>nil, "puppet_proxy"=>nil, "puppet_ca_proxy"=>nil, "openscap_proxy"=>nil, "hostgroup_name"=>nil, "hostgroup_title"=>nil, "parameters"=>[], "all_parameters"=>[{"priority"=>0, "created_at"=>"2019-07-09 18:42:55 UTC", "updated_at"=>"2019-07-09 18:42:55 UTC", "id"=>2, "name"=>"enable-puppet5", "value"=>"true"}, {"priority"=>0, "created_at"=>"2019-07-09 18:42:55 UTC", "updated_at"=>"2019-07-09 18:42:55 UTC", "id"=>1, "name"=>"enable-epel", "value"=>"false"}], "subscription_global_status"=>0, "subscription_facet_attributes"=>{"host_type"=>"VMware ESXi", "id"=>121, "uuid"=>"514bd621-71c0-445a-9018-d7fa478eade5", "last_checkin"=>"2019-07-17 13:41:05 UTC", "service_level"=>"", "release_version"=>nil, "autoheal"=>false, "registered_at"=>"2019-07-17 13:41:05 UTC", "registered_through"=>nil, "purpose_role"=>nil, "purpose_usage"=>nil, "purpose_addons"=>[], "user"=>nil, "virtual_host"=>nil, "virtual_guests"=>[], "installed_products"=>[], "activation_keys"=>[], "compliance_reasons"=>[]}, "host_collections"=>[], "interfaces"=>[{"subnet_id"=>nil, "subnet_name"=>nil, "subnet6_id"=>nil, "subnet6_name"=>nil, "domain_id"=>nil, "domain_name"=>nil, "created_at"=>"2019-07-17 13:41:11 UTC", "updated_at"=>"2019-07-17 13:41:11 UTC", "managed"=>true, "identifier"=>nil, "id"=>123, "name"=>"virt-who-esxprod05.redacted.com-1", "ip"=>nil, "ip6"=>nil, "mac"=>nil, "mtu"=>nil, "fqdn"=>"virt-who-esxprod05.redacted.com-1", "primary"=>true, "provision"=>true, "type"=>"interface", "virtual"=>false}], "puppetclasses"=>[], "config_groups"=>[], "all_puppetclasses"=>[], "permissions"=>{"view_hosts"=>true, "create_hosts"=>true, "edit_hosts"=>true, "destroy_hosts"=>true, "build_hosts"=>true, "power_hosts"=>true, "console_hosts"=>true, "ipmi_boot_hosts"=>true, "puppetrun_hosts"=>true, "play_roles_on_host"=>true, "view_discovered_hosts"=>true, "submit_discovered_hosts"=>true, "auto_provision_discovered_hosts"=>true, "provision_discovered_hosts"=>true, "edit_discovered_hosts"=>true, "destroy_discovered_hosts"=>true}}
Traceback (most recent call last):
        6: from ./katello-attach-subscription:1829:in `<main>'
        5: from ./katello-attach-subscription:794:in `vdcupdate'
        4: from ./katello-attach-subscription:794:in `each_with_index'
        3: from ./katello-attach-subscription:794:in `each'
        2: from ./katello-attach-subscription:851:in `block in vdcupdate'
        1: from /root/bin/katello-attach-subscription/lib/katello_attach_subscription/fact_analyzer.rb:39:in `system_type'
/root/bin/katello-attach-subscription/lib/katello_attach_subscription/fact_analyzer.rb:10:in `system_type_from_facts': undefined method `[]' for nil:NilClass (NoMethodError)
Rocco83 commented 5 years ago

Hey Scott, KAS stand for Katello-Attach-Subscription.

If you are using the current released version of KAS, the error is triggered in https://github.com/RedHatSatellite/katello-attach-subscription/blob/master/katello-attach-subscription#L851

It would be useful to show the detail for host virt-who-esxprod05.[...], can you share it? Is this host still live? The best is to export it via API.

On top of it, the difference seems to me that on host virt-who-esxprod05 no guests are added. But my feeling is that this is an effect, not a cause.

HTH,

gearboxscott commented 5 years ago

KAS = is the v0.0.2, basically, we did a git clone https://github.com/RedHatSatellite/katello-attach-subscription.git last week to get what was ever current.

virt-who-esxprod05 is alive, last week we tried to pre-assign sub before we converted host to sat 6. 05 is on the same vsphere as 04, 03, etc. what if I exclude it for now, to see if that would allow the script to run. for the hostname match line, how can I say include all the esx* but exclude 05 from the mix?

Rocco83 commented 5 years ago

Hey Scott,

It's a while that i do not look deeply into the code, so @mossicrue for sure can reply better.

But,

  1. regex is used, so any valid regex would work (and i feel that an issue/PR for describing that is welcome)
  2. your regex is already "missing" esxprod05.redacted.com, see .com, not .local. The regex check is done at line 886: https://github.com/RedHatSatellite/katello-attach-subscription/blob/master/katello-attach-subscription#L886 which is after the failing part, at line 851: https://github.com/RedHatSatellite/katello-attach-subscription/blob/master/katello-attach-subscription#L851

The failing line is anyway related to https://github.com/RedHatSatellite/katello-attach-subscription/blob/master/lib/katello_attach_subscription/fact_analyzer.rb#L28 because (and this is the opposite of what i wrote above) given that there are no guests, KAS cannot be sure if this is a host or not. For the other host, you have guest, so HYPERVISOR is returned. For this host, you do not have guest, so the check continue and once you reach self.system_type_from_facts(facts), it will fail.

Back to how to move on with the issue, not having an infrastructure to replicate the issue, i would suggest fix it in fact_analyzer.rb, based on the above comment.

You will get anyway UNKNOWN for that specific host, unless you have facts (see below if you want to avoid it). This is not necessarily bad, because you won't consume a sub for that specific empty host. Still the sub count is not done properly if you need to register also this host (but in this specific case, see point 2 above).

Feel free to check the patch created just now, totally untested, and to improve it if you feel so :) https://github.com/Rocco83/katello-attach-subscription/tree/fix_empty_hosts_crash

Related hint: The option virtwho = true (e.g.: just adding it into your yaml file) can be useful as well to avoid this issue. beware you need to have a valid virt-who config on the same machine where you run KAS. If some info are missing in satellite but available in virt-who, that can do the trick. The reason behind is that facts will be taken from virt-who. There are a couple of bugs (which i think must be documented along with virtwho option), which i can't recall right now. The idea is that currently virt-who (from a certain version) is able to extract more data, but candlepin is not able to store it yet. If nothing changed up to now.

HTH, Daniele

mossicrue commented 5 years ago

Hi Scott,

what pointed out by @Rocco83 is correct. This error was already spotted and fixed in #50

Also, looking at this bugzilla I think that the --virt-who options can be avoided if using Satellite 6.5 as facts reported by virt-who are now uploaded in Satellite. Otherwise I think that this options should be enabled in order to avoid unknown results from empty hypervisors.

Hth Simone