Applying maintenace to your PureApplication instance using the command-line interface

The PureApplication Knowledge Center documents how to apply maintenance to your instance using the virtual system management console. If you have maintenance that you want to apply to a large number of virtual system instances, you may wish to automate the application of this maintenance using the command-line interface. The Knowledge Center also documents how you can find and apply ifixes and fixpacks to your virtual system instances using the CLI. The following interactive session using the PureApplication CLI demonstrates how you can do this. First, we apply an ifix to an instance:

[ibmadmin@smoonen pure.cli]$ bin/pure -h 172.21.72.32
User name: smoonen
Password:
Welcome to the IBM PureApplication System CLI.  Enter 'help' if you
need help getting started.
>>> import time
>>> # Locate the virtual system instance
>>> instance = deployer.virtualsysteminstances.list({"deployment_name":"WebSphere advanced cluster"})[0]
>>> # Show me the names of the available fixes
>>> [fix['name'] for fix in instance.findFixes()]
[u'scott-efix', u'8.5.5.4-WS-WASProd-TFPI54321_8.5.5004.20150101_1412']
>>> # Apply the efix to all of the applicable nodes
>>> efix = [fix for fix in instance.findFixes() if fix['name'] == 'scott-efix'][0]
>>> operation = instance.applyFixes([ {'vmtemplate': template, 'vmfixes': [efix] } for template in efix['applicableto'] ])
>>> for x in range(30) :
...    if operation.status != 'PENDING' and operation.status != 'ACTIVE' : break
...    time.sleep(30)
...    operation.refresh()
...
{
  "complete_time": "2016-01-19T06:30:15.479Z",
  "name": None,
  "operation_id": "o-f846360f-2f02-458c-873e-6cabbff4335f",
  "parameters": (nested object),
  "result": "{
     "ODRNode.11453175791583.MAINTENANCE": "SUCCESS",
     "IHSNode.11453175791582.MAINTENANCE": "SUCCESS",
     "CustomNode.11453175791585.MAINTENANCE": "SUCCESS",
     "DmgrNode.11453175791584.MAINTENANCE": "SUCCESS"
  }",
  "return_value": (nested object),
  "role": "MAINTENANCE",
  "status": "COMPLETED",
  "submit_time": "2016-01-19T06:29:20.119Z",
  "type": "configuration",
  "virtualapplication": (nested object)
}
>>>

You follow a similar procedure, using slightly different method names, to apply a fixpack rather than an ifix:

>>> fixpacks = instance.findFixpacks()['candidate_fixpacks']
>>> # List available fixpacks
>>> for name in fixpacks.keys() :
...   print name + ': ' + str([fixpack['version'] for fixpack in fixpacks[name]])
...
IBM WebSphere Application Server Network Deployment: [u'8.5.5.5']
IBM HTTP Server for WebSphere Application Server: [u'8.5.5.5']
WebSphere Customization Toolbox: [u'8.5.5.5']
Web Server Plug-ins for IBM WebSphere Application Server: [u'8.5.5.5']
>>> # Update WAS ND
>>> operation = instance.applyFixpack('IBM WebSphere Application Server Network Deployment', '8.5.5.5')
>>> # Follow similar procedure as earlier to monitor for operation completion
>>> # Repeat to update other products

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s