Problems checking AIX oslevel

(imported topic written by SystemAdmin)

I’m creating a fixlet to upgrade AIX to 6.1.6.5, from 6.1.4.5

Q: (name of operating system as string equals “AIX 6.1”) AND (exists file ((pathname of (parent folder of client folder of current site)) & “/__OSLevel/oslevel.txt”)) AND (exists ((line 1 of file ((pathname of (parent folder of client folder of current site)) & “/__OSLevel/oslevel.txt”)) as string) whose (following text of first “-” of it as integer = 6)) AND (exists ((line 2 of file ((pathname of (parent folder of client folder of current site)) & “/__OSLevel/oslevel.txt”)) as string) whose (((if (it contains “-”) then (preceding text of first “-” of it) else it) of following text of first “-” of following text of first “-” of it) as integer < 5))

E: Singular expression refers to nonexistent object.

For 5.3.10.2 hosts it works fine… I just copied and changed the numbers, but does not work… Any suggestions?

The contents of the file that’s being evaluated is…

/var/opt/BESClient/__BESData/__OSLevel/oslevel.txt

6100-04

6100-04-05-1015

(imported comment written by SystemAdmin)

In terms of syntax, it should be correct. However, I noticed a couple of potential issues:

  1. “Singular expression refers to nonexistent object.” - It means that you are referring to a nonexisting file. Are you sure oslevel.txt exist?

  2. This relevance might potentially be wrong: (exists ((line 1 of file ((pathname of (parent folder of client folder of current site)) & “/__OSLevel/oslevel.txt”)) as string) whose (following text of first “-” of it as integer = 6))

What it is checking is that the technology level is “equal to 6”, but your current system is only at “4”. What you want to do is probably do is set it to “less than 6”, i.e.

(exists ((line 1 of file ((pathname of (parent folder of client folder of current site)) & 
"/__OSLevel/oslevel.txt")) as string) whose (following text of first 
"-" of it as integer < 6))
  1. This relevance might potentially be wrong as well: (exists ((line 2 of file ((pathname of (parent folder of client folder of current site)) & “/__OSLevel/oslevel.txt”)) as string) whose (((if (it contains “-”) then (preceding text of first “-” of it) else it) of following text of first “-” of following text of first “-” of it) as integer < 5))

What it is checking is that the service pack is “less than 5”, but your current service pack is equal to “5”. Unlike the previous relevance for technology level, you cannot just set this relevance check to be “less than 5” since you can potentially have a service pack level that’s equal to or greater than 5.

If you want to find all systems that has less than 6.1.6.5, you’ll need to check for 2 things: all systems with less than technology level 6, and all systems at technology level 6 but under service pack 5. So your relevance statement should be something like this:

(name of operating system as string equals 
"AIX 6.1") AND (exists file ((pathname of (parent folder of client folder of current site)) & 
"/__OSLevel/oslevel.txt")) AND ((exists ((line 1 of file ((pathname of (parent folder of client folder of current site)) & 
"/__OSLevel/oslevel.txt")) as string) whose (following text of first 
"-" of it as integer < 6)) OR ((exists ((line 1 of file ((pathname of (parent folder of client folder of current site)) & 
"/__OSLevel/oslevel.txt")) as string) whose (following text of first 
"-" of it as integer = 6)) AND (exists ((line 2 of file ((pathname of (parent folder of client folder of current site)) & 
"/__OSLevel/oslevel.txt")) as string) whose (((

if (it contains 
"-") then (preceding text of first 
"-" of it) 

else it) of following text of first 
"-" of following text of first 
"-" of it) as integer < 5))))