Difference between revisions of "Using nxshell to automate bulk operations"

Jump to navigation Jump to search
Line 245: Line 245:
   config.close()
   config.close()
   print "%s %s updated" % ("Node" if isinstance(o, Node) else "Template", o.getObjectName())
   print "%s %s updated" % ("Node" if isinstance(o, Node) else "Template", o.getObjectName())
</syntaxhighlight>
== List Inventory Software for all nodes ==
<syntaxhighlight lang="python">
for node in [o for o in s.getAllObjects() if isinstance(o, objects.Node)]:
  print 'Node: ', node.getObjectName()
  try:
    for package in s.getNodeSoftwarePackages(node.getObjectId()):
        print package.getName()
  except:
    print "No package found"
</syntaxhighlight>
</syntaxhighlight>
14

edits

Navigation menu