Classic virtual system patterns
Use the command-line interface to work with classic virtual system patterns by working with Pattern and Patterns objects.
Patterns object
The Patterns object represents the collection of classic virtual system patterns defined to PureApplication® Software. Objects of this type are used to create, delete, iterate over, list and search for Classic virtual system patterns in PureApplication Software.
The Patterns object requires you to define the name attribute to create a classic virtual system pattern. You can also specify a description using the description attribute.
>>> help(deployer.patterns)
For more information about working with resource objects, see the Related reference section.
Pattern object
A Pattern object represents a particular PureApplication Software classic virtual system pattern. Use the Pattern object to query and manipulate the classic virtual system pattern definition. Attributes of the classic virtual system pattern and relationships between the classic virtual system pattern and other PureApplication Software resources are represented as Jython attributes on the Pattern object. Manipulate these Jython attributes using standard Jython mechanisms to change the corresponding PureApplication Software data.
>>> help(deployer.pattern)
Pattern attributes
- acl
- An object for manipulating the access control list for this classic virtual system pattern.
For more information about the properties and methods supported by acl objects, enter the following command:
help(deployer.acl)
For more information, see the Related reference section.
- advancedoptions
- Use the advancedoptions object to view and set the advanced options for the classic virtual system pattern. Different advanced options are available depending on the topology described by your classic virtual system pattern. See the detailed information in the Advancedoptions object section.
- created
- The creation time of the classic virtual system pattern, as the number of seconds since midnight, January 1, 1970 UTC. When the classic virtual system pattern is displayed, this value is shown as the date and time in the local time zone. This field is read-only.
- currentmessage
- The message associated with the status of the classic virtual system pattern. This field is read-only.
- currentmessage_text
- Provides a textual description of the current message. This field is read-only.
- currentstatus
- The status of the classic virtual system pattern.
- currentstatus_text
- Provides a textual description of the status. This field is read-only.
- description
- The description of the classic virtual system pattern.
- id
- The ID of the classic virtual system pattern. This field is read-only.
- name
- The name associated with this classic virtual system pattern. Each classic virtual system pattern must have a unique name.
- owner
- A User object that references
the owner of this classic virtual system pattern.
For more information about the properties and methods supported by
user objects, enter the following command:
>>> help(deployer.user)
- parts
- A resource collection containing the parts contained within this classic virtual system pattern.
For more information about the properties and methods supported by classic virtual system pattern parts
objects, enter the following command:
>>> help(deployer.pattern_parts)
- updated
- The time the classic virtual system pattern was last updated, as number of seconds since midnight, January 1, 1970 UTC. When the classic virtual system pattern is displayed, this value is shown as the date and time in the local time zone. This field is read-only.
- validations
- The validation status and messages associated with the classic virtual system pattern.
The value of this attribute is a list containing the results of validation
tests run on the IBM® PureApplication Software.
Each entry in the list is a dict object
containing the following keys and values:
- status
- This key provides the validation status associated with this entry.
- status_text
- This key provides a textual representation of the status.
- message
- This key provides the message that is associated with the status.
- message_text
- This key provides the textual representation of the message.
help(deployer.pattern.validations)
- validationmessage
- The message associated with the validation status of the classic virtual system pattern. This field is read-only.
- validationmessage_text
- Provides a textual description of the validation message. This attribute provides a shortcut to access the first entry of the validations attribute. This field is read-only.
- validationstatus
- The status associated with validation of the classic virtual system pattern. This field is read-only.
- validationstatus_text
- Provides a textual description of the validation status. This attribute provides a shortcut to access the first entry of the validations attribute. This field is read-only.
- virtualimage (deprecated)
- The virtual image that is used to realize this classic virtual system pattern when
the classic virtual system pattern is
deployed.This attribute is deprecated. Instead, use this call to retrieve a virtual image:
mypattern.parts[0].virtualimage
- virtualsystems
- The classic virtual system instances currently
running this classic virtual system pattern.
For more information about the properties and methods supported by virtualsystems objects, enter the following
command:
help(deployer.virtualsystems)
Pattern methods
- clone()
- Clones this pattern object and
returns a pattern object for the
new classic virtual system pattern,
as shown in the following example:
This method recognizes the following optional parameters:clone(**options)
- description
- The description for the new classic virtual system pattern. If not specified, the description of the classic virtual system pattern being cloned is used.
- name
- The name assigned to the new classic virtual system pattern. If not specified, the new classic virtual system pattern name is based on the name of the classic virtual system pattern being cloned.
- virtualimage
- This deprecated parameter attempts to change all parts in the
new classic virtual system pattern to
the specified virtual image, regardless of the number of virtual images
referenced in the original classic virtual system pattern.
To change the virtual image associated with parts in the new classic virtual system pattern,
set the virtualimage attribute on those parts after
the classic virtual system pattern has
been cloned. If not specified, parts in the new classic virtual system pattern use
the same virtual images as the corresponding parts in this classic virtual system pattern.
If specified, an attempt is made to switch all parts in the new classic virtual system pattern to
the indicated virtual image, as shown in the following example:
>>> newpattern = mypattern.clone(name='foo', virtualimage=myvi)
>>> newpattern = mypattern.clone(name='foo', description='cloned pattern')
- isDraft()
- Indicates if this classic virtual system pattern is in draft mode.
- isReadOnly()
- Indicates if this classic virtual system pattern is read-only.
- listConfig(data={})
- Returns a dictionary (dict object)
of the configurable part properties and script parameters contained
in this classic virtual system pattern.
The keys for thisdict object are
as described in the create information in the online help for deployer.virtualsystems.create.
The values reflect the default values defined in the classic virtual system pattern.
This method accepts a single optional parameter that can be used to supply a dict object containing overrides to the default values. Specify the overrides as described in the create method information in Classic virtual system instances. Specifying overrides is useful to see what values are to be used during a classic virtual system pattern deployment without tying up the resources to perform an actual deployment.
- makeReadOnly()
- Makes this classic virtual system pattern read-only. When the classic virtual system pattern is read-only, the classic virtual system pattern can be deployed but not modified.
- runInCloud(cloud,options)
- Allocates cloud resources and starts a copy of this classic virtual system pattern in
the cloud. This method requires the following parameters:
- cloudorep
- This is either a cloud object representing the cloud group in which the classic virtual system pattern is to be run, or an EnvironmentProfile object representing the environment profile to be used for the deployment.
- options
- A Jython dict object containing:
- A name key/value that specifies a name for the classic virtual system instance to be created.
- The part property and script parameter values to be used for the deployment. See the create method in Classic virtual system instances for more information.
- The environment profile configuration information. For more information, see the create method in Classic virtual system instances.
>>> myvirtsys = mypattern.runInCloud(myCloud, { 'name': 'example', ... '*.*.password': 'thepassword' })
- toPython(f, **options)
- This method generates a Python script on the local system that,
when run, reconstructs a classic virtual system pattern from
the IBM PureApplication Software.
To use the generated script, the system on which the classic virtual system pattern is
reconstructed must already contains the virtual image and scripts
used by the classic virtual system pattern.
This method takes, as a parameter, a file name or file object to which the generated CLI script is saved. This method has no return value. Exceptions are thrown if any errors are encountered while generating the Python script.
Additional options can be passed to this method by including name=value pairs in the method invocation, as shown in the following example:
This method recognizes the following options:mypattern.toPython('filename.py', includePasswords=True)
- includePasswords
- A boolean value that indicates if passwords are included in the generated script. By default, the values for any part properties or script parameters that are passwords are omitted from the generated script.
Advancedoptions object
Use the Advancedoptions object to view and set the advanced options for the classic virtual system pattern. Different advanced options are available, depending on the topology that is described by your classic virtual system pattern. For some topologies, there are no advanced options available.
Advancedoptions methods
The Advancedoptions property supports the following methods to view and set the advanced options:
- add(key)
- Accepts a single parameter that must be either a string specifying
an advanced option or a list of these strings. The specified advanced
options are added to the existing advanced options for this classic virtual system pattern.
If any of the new advanced options conflict with advanced options
that were previously added, the new advanced options take precedence.
If any of the new advanced options depend on other advanced options
that have not already been set, the needed advanced options are automatically
set. The following example shows advanced options being set:
>>> mypattern.advancedoptions.add('messaging-enabled') >>> mypattern.advancedoptions.add(['sessionpersistence-db', ... 'security-enabled'])
- clear()
- Clears all advanced options from the classic virtual system pattern.
There are no parameters to this method, as shown in the following
example:
>>> mypattern.advancedoptions.clear()
- __contains__(item)
- Called implicitly by the Jython in operator,
this method accepts a single string parameter. The parameter names
an advanced option and returns a boolean value. The boolean value
indicates if the specified advanced option is set in the classic virtual system pattern,
as shown in the following example:
>>> if 'security-enabled' in mypattern.advancedoptions: ... print 'security is enabled'
- getAvailableOptions()
- Returns a list of strings that name all the advanced options available
for this classic virtual system pattern.
This method has no parameters, as shown in the following example.
>>> mypattern.getAvailableOptions()
Note: This list of strings returned includes all available advanced options, regardless of whether they are currently set.To see just the options that are currently set, pass the advancedoptions property to the Jython list() function. - __iadd__(other)
- Started implicitly when you use the Jython += operator
with the advancedoptions property,
as shown in the following example:
The __iadd__ method has the same behavior as the add method.>>> mypattern.advancedoptions += 'messaging-engine-ha'
- __isub__(other)
- This method is started implicitly when you use the Jython -= operator
with the advancedoptions property,
as shown in the following example:
The __isub__ method has the same behavior as the remove method.>>> mypattern.advancedoptions -= ['messaging-mq-link', ... 'messaging-enabled']
- __iter__()
- Returns an iterator over all the advanced options (as strings)
that are currently set for this classic virtual system pattern,
as shown in the following example:
The __iter__ method is implicitly started when the advancedoptions property is used in an iterative context>>> for ao in mypattern.advancedoptions: ... print 'advanced option %s is set' % ao
- __len__()
- Returns the number of advanced options currently set for the classic virtual system pattern.
This method is started implicitly by the Jython len function,
as shown in the following example:
>>> len(mypattern.advancedoptions)
- remove(other)
- This method accepts a single parameter that must be either a string
specifying an advanced option or a list of these strings, as shown
in the following example:
The specified advanced options are removed from the existing advanced options for this classic virtual system pattern.>>> mypattern.advancedoptions.remove('messaging-enabled') >>> mypattern.advancedoptions.remove(['sessionpersistence-db', ... 'security-enabled'])
Note:- Some advanced options are grouped into sets that require at least one of the advanced options to be set. If removing one advanced option would cause this constraint to be violated, the default advanced option from the set is automatically selected.
- Removing an advanced option does not automatically remove any parent advanced options.
- __repr__()
- Returns a string representation of the advanced options. The string representation includes short textual descriptions of each advanced option and shows the hierarchy of the advanced options.
- __str__()
- Returns a string representation of the advanced options. The string representation includes short textual descriptions of each advanced option and shows the hierarchy of the advanced options.
- __unicode__()
- Returns a string representation of the advanced options. The string representation includes short textual descriptions of each advanced option and shows the hierarchy of the advanced options.
In addition to these methods, you can also assign a string or list of strings to the advancedoptions property. The result is the same as if you had issued the clear() and then the add() methods of the same advanced options.
For more information about working with resource objects, see the Related reference section.