Bug #105
closedOperating Major version too short for AIX
Description
The major column of the operating system is too short for AIX hosts. It's character varying(5), but facter reports '6100-04-01-0944' for OS major version.
puppet1:/srv/www/apps/foreman # rake puppet:migrate:populate_hosts RAILS_ENV=production (in /srv/www/apps/foreman) rake aborted! PGError: ERROR: value too long for type character varying(5) : INSERT INTO "operatingsystems" ("name", "created_at", "updated_at", "nameindicator", "major", "minor") VALUES(E'AIX', '2009-12-01 21:19:26.780600', '2009-12-01 21:19:26.780600', NULL, E'6100-04-01-0944', NULL) RETURNING "id"
Updated by Ohad Levy about 15 years ago
- Status changed from New to Need more information
- Assignee changed from Ohad Levy to Andrew Forgue
what is an acceptable length? does this value make any sense to you or should it be ignored in AIX?
Updated by Andrew Forgue about 15 years ago
Hi Ohad,
The Version is broken down like this:
6100-04-01-0944 ^ ^ ^ ^ | | | + This is the year/week it was released, week 44 of 2009 | | + Service Pack (this is SP1) | + Technology Level (aka release #), in this case, TL 4 + Major OS, in this case, this is AIX 6.1 (it'll be 5300, 5200, 5100)
IBM is a bit crazy about their versioning. Puppet reports the entire version string as major #, so maybe that should be fixed upstream in puppet?
I'd really rather have the major be "6", the minor be "1" and some other field for the TL and SP level. I don't know what that will gain me though -- I don't make decisions other than on the major and minor versions.
Updated by Ohad Levy about 15 years ago
Andrew Forgue wrote:
Hi Ohad,
The Version is broken down like this:
[...]IBM is a bit crazy about their versioning. Puppet reports the entire version string as major #, so maybe that should be fixed upstream in puppet?
I'd really rather have the major be "6", the minor be "1" and some other field for the TL and SP level. I don't know what that will gain me though -- I don't make decisions other than on the major and minor versions.
so thats means that:
major = first 4 chars (or everything until the first "-")
minor = value between 2nd and 3rd "-"
?
I think that it make sense to push it to facter, but I can easily work around it for the time being
can you provide me a facts yaml file? (usually on your puppetmaster at /var/lib/puppet/yaml/facts/hostname)
another question, is this info is correct for all AIX versions? only recent ones etc?
Thanks
Updated by Ohad Levy about 15 years ago
- Target version changed from 0.1-3 to 0.1-4
waiting for feedback, pushing a version for now
Updated by Andrew Forgue almost 15 years ago
Yes, the major is the first 4 characters, but should be converted into "v0.v2" and discard the 00 (It'll always be 00). Then the next should be the "Technology Level" and then Service pack level. I don't much care about the SP level, I don't know if there's a direct mapping to anything in the schema. There didn't seem to be.
I'll attach a YAML file in a few hours.
Updated by Andrew Forgue almost 15 years ago
I have no YAML files, I use storeconfigs. How can I get you what you want out of that?
Updated by Ohad Levy almost 15 years ago
Andrew Forgue wrote:
I have no YAML files, I use storeconfigs. How can I get you what you want out of that?
/var/lib/puppet/yaml/facts on your puppetmaster?
Updated by Andrew Forgue almost 15 years ago
No, no yaml files in there.
Here's a patch to format it:
diff --git a/app/models/host.rb b/app/models/host.rb index 3d4a407..e2415c5 100644 --- a/app/models/host.rb +++ b/app/models/host.rb @@ -274,7 +274,13 @@ class Host < Puppet::Rails::Host os_name = fv(:operatingsystem) if orel = fv(:lsbdistrelease) || fv(:operatingsystemrelease) - major, minor = orel.split(".") + if os_name == "AIX" + ver, tl, sp, week = orel.split("-") + major = ver.split(//).join(".") + minor = [tl,sp].join(".") + else + major, minor = orel.split(".") + end self.os = Operatingsystem.find_or_create_by_name_and_major_and_minor os_name, major, minor end # again we are saving without validations as input is required (e.g. partition tables) diff --git a/app/models/operatingsystem.rb b/app/models/operatingsystem.rb index b9994f0..f56951f 100644 --- a/app/models/operatingsystem.rb +++ b/app/models/operatingsystem.rb @@ -12,7 +12,11 @@ class Operatingsystem < ActiveRecord::Base # The OS is usually represented as the catenation of the OS and the revision. E.G. "Solaris 10" def to_label - "#{name} #{major}#{('.' + minor) unless minor.empty?}" + if name == "AIX" + "#{name} #{major}#{(" TL " + minor) unless minor.empty?}" + else + "#{name} #{major}#{('.' + minor) unless minor.empty?}" + end end def to_s
Updated by Ohad Levy over 12 years ago
Has facter been updated in the meanwhile? do we still have this issue with AIX?
thanks!
Updated by Benjamin Papillon about 12 years ago
Recently, I have the "chance" to get access to such a system. It seems that facter has been updated regarding this problem. Here is a small part of the result of facter 1.6.13 on AIX :
kernel => AIX
kernelmajversion => 6100
kernelrelease => 6100-06-05-1115
kernelversion => 6100
operatingsystem => AIX
operatingsystemrelease => 6100-06-05-1115
osfamily => AIX
Btw, the foreman used here in production (0.4.2) does not report the Operating system in the hosts page.
Updated by Benjamin Papillon over 11 years ago
- Status changed from Need more information to New
- Assignee deleted (
Andrew Forgue)
Updated by Benjamin Papillon almost 11 years ago
I upgraded my facter program to the last 1.7.5. The AIX output is exactly the same as the one I posted last year.
Updated by Dominic Cleal almost 11 years ago
- Related to Bug #4570: AIX Operating System version is shown in a strange way. added
Updated by Greg Sutcliffe almost 9 years ago
- Status changed from New to Resolved
This should no longer be an issue. In 1.11 (and probably earlier) the current code is:
elsif os_name[/AIX/i]
majoraix, tlaix, spaix, _yearaix = orel.split("-")
orel = majoraix + "." + tlaix + spaix
Given an input of "6100-06-05-1115" this should split to "6100.0605" which would hit this code:
major, minor = orel.split(".")
Giving a os_major of "6100" which fits in the 5 char limit. Since the other AIX issue is tracked at #4570 I'm going to close this. Please re-open if there's anything missing.