Validation failed: Name Operating system version already exists, Title has already been taken while trying to register physical server

While trying to register CentOS Linux release 7.6.1810 i receive the error on topic. Same for CentOS release 6.10 (Final). Both physical servers.

Foreman has just been updated to nighly distribution. However I got the same error while on 1.23.

I have the same problem.

Just upgraded from Foreman 1.22 to 1.23. It worked on 1.22.

Now when I register a new RHEL 7.7 host:

On the host:

# subscription-manager register --org=myorg --activationkey=Auto-Attach,RHEL7
HTTP error (422 - Unknown): Validation failed: Name Operating system version already exists

In foreman production.log:

2019-10-25T16:04:18 [E|kat|35d6ac1a] <Class> ActiveRecord::RecordInvalid
2019-10-25T16:04:18 [E|kat|35d6ac1a] name: ["Operating system version already exists"]

Activation keys used:

# hammer activation-key info --organization=myorg--id 10
Name:                  Auto-Attach
ID:                    10
Description:           This key must have ABSOLUTELY NO SUBSCRIPTIONS associated with it, and Auto-Attach set to Yes.

It will cause the host to run Auto Attach to pick up a temporary RHEL subscription on build.

This subscription will automatically be replaced when virt-who detects the new host.

https://bugzilla.redhat.com/show_bug.cgi?id=1500959
Host Limit:            Unlimited
Auto Attach:           true
Release Version:
Lifecycle Environment:
Content View:
Host Collections:

System Purpose:
    Service Level:  Standard
    Purpose Usage:  Production
    Purpose Role:   Red Hat Enterprise Linux Server
    Purpose Addons:

[root@nssforeman foreman]# hammer activation-key info --organization=myorg--id 13
Name:                  RHEL7
ID:                    13
Description:
Host Limit:            Unlimited
Auto Attach:           false
Release Version:       7Server
Lifecycle Environment: Library
Content View:          RHEL7_cv
Host Collections:

System Purpose:
    Service Level:  Standard
    Purpose Usage:  Production
    Purpose Role:   Red Hat Enterprise Linux Server
    Purpose Addons:

I set the Service Level, Purpose Usage and Purpose Role as part of the debug process. When it worked before, those were unset.

Is it trying to create another instance of the RHEL Server 7.7 Operating System entry?

# hammer os info --id 19
Id:                 19
Title:              RHEL Server 7.7
Release name:
Family:             Redhat
Name:               RedHat
Major version:      7
Minor version:      7
Partition tables:
    ProLiant DL380 Gen10 LUN 0 hw raid1
    ProLiant DL380 Gen10 LUN 0 hw raid1 - Huge disk -> GPT
   ...etc...
Default templates:
    Kickstart RHEL NSS - use with ansible (provision)
    Kickstart default PXELinux (PXELinux)
    Kickstart default PXEGrub (PXEGrub)
   ...etc...
Architectures:
    x86_64
Installation media:
    RHEL7
Templates:
    Discovery Red Hat kexec (kexec)
    Kickstart default (provision)
    Kickstart default finish (finish)
   ...etc...
Parameters:

This looks like a bug in the way @katello parses subscription manager facts. @Jonathon_Turel - could this somehow be related to this commit?
https://github.com/Katello/katello/commit/809da1cdb3ff6ac94fe6ffa12eaf8bc80deef5e5

There must be something concerning operating system version, becouse if I set a fake os into /etc/redhat-release file on client system (i.e. modifying 6.10 with 610) I’m able to correctly register the system. Then, if I navigate through Host -> Operating System on Foreman, I see a new entity is created with the fake operating system.
Then I put the right content back on redhat-release file, and I restart puppet service. Now the system is recognized with the correct OS version, so I’m able to clean up the fake OS entry created on Operating System, becouse It is no longer clued by any system.
Hope to have been clear.

Good call @tbrisker.

@Jonathon_Turel, if I back out the change on line 57 of app/models/katello/rhsm_fact_parser.rb, I can subscribe hosts again.

From what I can make out, there isn’t anything unusual about the facter output for the affected host:

# puppet facts list
...
    "operatingsystem": "RedHat",
    "operatingsystemmajrelease": "7",
    "operatingsystemrelease": "7.7",
    "os": {
      "architecture": "x86_64",
      "family": "RedHat",
      "hardware": "x86_64",
      "name": "RedHat",
      "release": {
        "full": "7.7",
        "major": "7",
        "minor": "7"
      },
      "selinux": {
        "config_mode": "enforcing",
        "current_mode": "enforcing",
        "enabled": true,
        "enforced": true,
        "policy_version": "31"
      }
    },
    "osfamily": "RedHat",
...

same here

Thanks for reporting this. I believe I have a real fix here: Bug #28143: Validation failed: Name Operating system version already exists when registering - Katello - Foreman

2 Likes

I’ve applied the patch to app/models/katello/rhsm_fact_parser.rb and I can confirm I can still subscribe a RHEL7.7 host, so that looks good.

I don’t have test/models/rhsm_fact_parser_test.rb on my Foreman. I assume that’s part of the build / test mechanism?

Thanks for your help.

(I’ll leave it to the original reporter to mark it as a solution.)

Glad it worked for you! Yes, the test/ files are so we don’t break this functionality again the future :wink:

I have the same problem with ubuntu 18.04 on katello 3.13, foreman 1.23

root@zubuntu11:~# subscription-manager register --org=“bla” --activationkey=“ubuntu_1804_key” --force
HTTP error (422 - Unknown): Validation failed: Name Operating system version already exists, Title has already been taken
root@zubuntu11:~#

tail -f /var/log/rhsm/rhsm.log

2019-11-04 13:13:05,415 [INFO] subscription-manager:20735:MainThread @connection.py:905 - Connection built: host=foreman1.test.local port=443 handler=/rhsm auth=none
2019-11-04 13:13:12,174 [ERROR] subscription-manager:20735:MainThread @managercli.py:1373 - HTTP error (422 - Unknown): Validation failed: Name Operating system version already exists, Title has already been taken
Traceback (most recent call last):
File “/usr/lib/python2.7/dist-packages/subscription_manager/managercli.py”, line 1370, in _do_command
type=self.options.consumertype
File “/usr/lib/python2.7/dist-packages/rhsmlib/services/register.py”, line 91, in register
usage=usage
File “/usr/lib/python2.7/dist-packages/rhsm/connection.py”, line 1021, in registerConsumer
return self.conn.request_post(url, params)
File “/usr/lib/python2.7/dist-packages/rhsm/connection.py”, line 729, in request_post
return self._request(“POST”, method, params, headers=headers)
File “/usr/lib/python2.7/dist-packages/rhsm/connection.py”, line 752, in _request
info=info, headers=headers)
File “/usr/lib/python2.7/dist-packages/rhsm/connection.py”, line 627, in _request
self.validateResponse(result, request_type, handler)
File “/usr/lib/python2.7/dist-packages/rhsm/connection.py”, line 689, in validateResponse
raise RestlibException(response[‘status’], error_msg, response.get(‘headers’))
RestlibException: HTTP error (422 - Unknown): Validation failed: Name Operating system version already exists, Title has already been taken

and if I change rhsm_fact_parser.rb on server with latest one from https://github.com/Katello/katello/blob/master/app/models/katello/rhsm_fact_parser.rb doesn’t help

reinstallation of python-subscription-manager doesn’t help on client

Can you provide some extra info from hammer for the operating system in question? You can narrow it down like this:

hammer os list
hammer os info --id=XX from the previous output

If there are multiple Ubuntu entries please share them all. Thanks

The work around was to delete os (Ubuntu) from foreman and then I was able to subscribe it back, but this is no good solution if I would have more then one ubuntu servers already subscribed

[root@foreman1 ~]# hammer os list
—|---------------------|--------------|-------
ID | TITLE | RELEASE NAME | FAMILY
—|---------------------|--------------|-------
1 | CentOS 7.7.1908 | | Redhat
3 | Ubuntu 18.04 Bionic | bionic | Debian
—|---------------------|--------------|-------
[root@foreman1 ~]#

[root@foreman1 ~]# hammer os info --id=1
Id: 1
Title: CentOS 7.7.1908
Release name:
Family: Redhat
Name: CentOS
Major version: 7
Minor version: 7.1908
Partition tables:
Kickstart default
Default templates:
Kickstart default PXELinux (PXELinux)
Kickstart default PXEGrub (PXEGrub)
Kickstart default PXEGrub2 (PXEGrub2)
Kickstart default iPXE (iPXE)
Kickstart default (provision)
Kickstart default finish (finish)
Kickstart default user data (user_data)
Architectures:
x86_64
Installation media:
Templates:
Kickstart default (provision)
Kickstart default finish (finish)
Kickstart default iPXE (iPXE)
Kickstart default PXEGrub (PXEGrub)
Kickstart default PXEGrub2 (PXEGrub2)
Kickstart default PXELinux (PXELinux)
Kickstart default user data (user_data)
Parameters:
[root@foreman1 ~]#

[root@foreman1 ~]# hammer os info --id=3
Id: 3
Title: Ubuntu 18.04 Bionic
Release name: bionic
Family: Debian
Name: Ubuntu
Major version: 18
Minor version: 04
Partition tables:
Default templates:
Architectures:
x86_64
Installation media:
Templates:
Parameters:
[root@foreman1 ~]#

Thank you, this is useful. I forgot to ask you for one more piece of data from the Ubuntu client system: subscription-manager facts | grep distribution | sort

This way I’ll have the whole picture to reproduce the problem on my side.

root@zubuntu11:~# subscription-manager facts | grep distribution | sort
distribution.id: Bionic Beaver
distribution.name: Ubuntu
distribution.version: 18.04
distribution.version.modifier: Unknown
root@zubuntu11:~#

Thank you @jost

The operating systems that you shared with me from the hammer output - did you create those by hand in the UI / with hammer, or were they created automatically by puppet or subscription-manager? Puppet and subscription-manager should be creating operating systems that are compatible in format (so this error won’t occur) which is why I wonder if you created them by hand.

As I remember, first it was created during registration with subscription-manager that I compile from source , then I try registration ubuntu with script from https://pypi.org/project/deb-subscription/ and I have to create by hand in the UI.

Now when I try to reproduce the problem it doesn’t give me the same error, but I get this “‘NoneType’ object is not callable” nevertheless ubuntu is registered.

Sorry, I was reproducing error when I put back rhsm_fact_parser.rb from original. If I use rhsm_fact_parser.rb from github and restart # foreman-maintain service restart it works as it should. Only error is ‘NoneType’ object is not callable

Glad it works! I’m not sure about the python error. Maybe /var/log/rhsm/rhsm.log has more information about it, although that seems like a separate issue from the subject of this thread.

1 Like