I'm trying to automate part of the setup of our cluster using Ansible.
As one of the steps, I'm trying to create a new osimage definition by
calling mkdef from an Ansible module, and I'm getting the error message:
Error: Could not find an object named \'rhels7.4-x86_64-netboot-hpccn\' of
type \'osimage\'
This is of course the object I am trying to *create*, so of course the
object does not exist yet.
Here is the command line I want to execute.
/opt/xcat/bin/mkdef -t osimage -o rhels7.4-x86_64-netboot-hpccn -u
provmethod=netboot profile=hpccn osvers=rhels7.4 permission=755
postinstall=/install/custom/netboot/rh/hpccn.rhels7.4.x86_64.postinstall
synclists=/install/custom/netboot/rh/hpccn.rhels7.4.x86_64.synclist
partitionfile=/install/custom/netboot/rh/hpccn.rhels7.4.x86_64.cfglocaldisk
exlist=/install/custom/netboot/rh/hpccn.rhels7.4.x86_64.exlist
otherpkglist=/install/custom/netboot/rh/hpccn.rhels7.4.x86_64.otherpkgs.pkglist
pkglist=/install/custom/netboot/rh/hpccn.rhels7.4.x86_64.pkglist
When I execute the exact same command line (copied and pasted, so I'm sure
there are no typos), it works as expected.
The code in my Ansible module does this:
def
_make_object(obj_type,obj_name,attributes):
cmd = [ "/opt/xcat/bin/mkdef"
]
cmd.append( "-t"
)
cmd.append( obj_type
)
cmd.append( "-o"
)
cmd.append( obj_name
)
# special-case for osimage: the -u argument is only valid there. It
means,
# fill in any missing attributes from xCAT
templates.
if obj_type ==
"osimage":
cmd.append( "-u "
)
for attr in
attributes:
value =
attributes[attr]
cmd.append(attr + '=' +
value)
try:
result =
subprocess.check_output(cmd)
except subprocess.CalledProcessError as
e:
raise Exception('cmd: ' + '
'.join(cmd))
return True, '
'.join(cmd)
--
_______________________________________________________________________
Kevin Keane | Systems Architect | University of San Diego ITS |
kke...@sandiego.edu
Maher Hall, 192 |5998 Alcalá Park | San Diego, CA 92110-2492 | 619.260.6859
<%28619%29%20260-2298>
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
xCAT-user mailing list
xCAT-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/xcat-user