Pattern parts
Use the command-line interface to work with classic virtual system patterns by working with classic virtual system pattern parts.
Pparts object
- As a Part object for the part that is to be added to this classic virtual system pattern, as shown in the following example:
>>> mypattern.parts.create(thepart)
- As a dictionary (dict) object with the required keys, as shown
in the following example:
>>> mypattern.parts.create({'id': thepart.id })
- As a long or int value that specifies the ID of the Part object to be used to create a classic virtual system pattern part, as shown in the following
example:
>>> mypattern.parts.create(thepart.id)
- As the name of a file containing a Jython expression that evaluates to one of the values in this list.
- As the value deployer.wizard or a wizard instance created by calling deployer.wizard(). If either of these values is supplied, the command-line interface prompts interactively for the values to create the resource. See Wizard objects on the command-line interface for more information about using the wizard to create a pattern_parts object.
- As a list of any of the previous items in the list, in which case multiple parts are created
within the classic virtual system pattern. This usage is shown
in the following example:
>>> mypattern.parts.create([part1, part2])
>>> help(deployer.pattern_parts)
Ppart object
A Ppart object represents a part that has been added to a classic virtual system pattern on the system. Use the pattern_part object to query and manipulate the part definition on the system. Attributes of the part and relationships between the part and other resources on PureApplication Software system are represented as Jython attributes on the pattern_part object. Manipulate these Jython attributes using standard Jython mechanisms to change the corresponding data on the system.
>>> help(deployer.pattern_part)
Ppart Attributes
The Ppart object has the following attributes:
- count
- The number of instances of this part that are to be created when
the classic virtual system pattern is
deployed. Note: This property is only defined for types of parts that can be replicated at deployment time. For those types of parts, the count is initially set to 1 and can be changed to any positive integer value. For other types of parts, the count is None and cannot be changed.
- countLocked
- This attribute provides a boolean value that indicates if virtual
machines, based on this part, can be dynamically added to or removed
from the classic virtual system instance after
the classic virtual system pattern has
been deployed. For parts that cannot be dynamically added or removed,
the countLocked attribute returns
the None value and cannot be changed.
For more information, enter the following command:
help(deployer.pattern_part.countLocked)
- description
- The description of the part. This field is a string value with a maximum of 1024 characters.
- id
- The ID of the part. This numeric value is automatically generated by the system.
- partCaption
- The label used for this part. This field is a string value with a maximum of 1024 characters.
- pattern
- The classic virtual system pattern that
contains this part. For more information about the properties and
methods supported by pattern objects,
enter the following command:
>>> help(deployer.pattern)
- properties
- The list of properties defined for this part. Each property is
a dict object with the following
properties:
- key
- The key of the property.
- locked
- Indicates whether the value of the userConfigurable property can be changed.
- pclass
- The pclass value of the property.
- value
- The default value assigned to the property.
- userConfigurable
- Indicates whether the value of the property can be changed at deployment time.
Note: This property is read-only. Changes to the dict object have no effect on the part. To change a property of the part, use the setProperty() method of the part. - scripts
- A resource collection containing the scripts contained within
this classic virtual system pattern part.
For more information about the properties and methods supported by pattern_scripts objects, enter the following
command:
>>> help(deployer.pattern_scripts)
- startsafter
- The set of parts in the classic virtual system pattern that
must start before this part. For additional information on manipulating
part startup order, enter the following command:
For more information, see StartsAfter object.>>> help(deployer.pattern_part.StartsAfter)
- startuporder
- The startup order of this part relative to other parts in the same classic virtual system pattern. Classic virtual system pattern parts with smaller values start before classic virtual system pattern parts with larger values. This attribute is an integer.
- validations
- This attribute provides the validation status and messages associated with the classic virtual system pattern part. The value of this attribute is
an array containing the results of validation tests run on PureApplication Software. Each entry in the array is a
dict object containing the following keys and values:
- message
- This key provides the message that is associated with the status.
- message_text
- This key provides the textual representation of the message.
- status
- This key provides the validation status associated with this entry.
- status_text
- This key provides a textual representation of the status.
help(deployer.pattern_part.validations)
- virtualimage
- The virtual image to be used to realize this part when the classic virtual system pattern including
the part is deployed. For more information about the properties and
methods supported by virtualimage objects,
enter the following command:
help(deployer.virtualimage)
Ppart Methods
The Ppart object has the following methods:
- getProperty
- Returns information about a particular property of a part. This
method accepts the following parameters:
- key
- The key of the property to be retrieved. This parameter is required.
- pclass
- The pclass of the property to be retrieved. This parameter is required.
- wantMetadata
- An optional boolean value indicating one of the following method
returns:
- Metadata about the property (True)
- Just the value of the property (False)
>>> mypattern.parts[0].getProperty('ConfigPWD_ROOT', 'password', True)
- setProperty
- Sets the value and (optionally) metadata for a part property.
This method accepts the following parameters:
- key
- The key of the property to be retrieved. This parameter is required.
- metadata
- An optional dict object that can contain the userConfigurable key. The userConfigurable key is a boolean value that indicates if users can change the value of this property at deployment time.
- pclass
- The pclass of the property to be retrieved. This parameter is required.
- value
- An optional value to be set for the property. If not specified, the current value of the property is unchanged.
>>> mypattern.parts[0].setProperty('ConfigPWD_ROOT', 'password', ... 'mypassword', **{ 'userConfigurable': False })
>>> mypattern.parts[0].setProperty('ConfigPWD_ROOT', 'password', ... 'mypassword', userConfigurable=False)
StartsAfter object
A list-like object that represents the parts in the pattern that must start before this part.
StartsAfter methods
- __contains__
- This method is invoked implicitly by Jython when you use the in operator
on a StartsAfter object. Its single parameter
must be a classic virtual system pattern part
from the same classic virtual system pattern.
The method returns True or False to
indicate if the specified classic virtual system pattern part
is in the set of classic virtual system pattern parts
that must start before the classic virtual system pattern part
to which the StartsAfter object belongs.
Invocation of this method is shown in the following example:
>>> firstPart = mypattern.parts[0] >>> secondPart = mypattern.parts[1] >>> if firstPart in secondPart.startsafter: >>> # firstPart starts before secondPart
- __delitem__
- This method is invoked implicitly by Jython when you use the del operator
on a StartsAfter object. Its single parameter
must be the index of the classic virtual system pattern part
to be removed from the set of classic virtual system pattern parts
that must start before the classic virtual system pattern part
to which the StartsAfter object belongs.
Invocation of this method is shown in the following example:
>>> del mypattern.parts[0].startsafter[0]
- __getitem__
- This method is invoked implicitly by Jython when you use the [] operator
on a StartsAfter object. Its single parameter
must be the non-negative index of the classic virtual system pattern part
to be returned from the set of classic virtual system pattern parts
that must start before the classic virtual system pattern part
to which the StartsAfter object belongs.
Invocation of this method is shown in the following example:
>>> mypattern.parts[0].startsafter[0]
- __iadd__
- This method is invoked implicitly by Jython when you use the += operator
on the StartsAfter attribute of a classic virtual system pattern part.
It accepts a single parameter that can be either a classic virtual system pattern part
or list of classic virtual system pattern parts.
All classic virtual system pattern arts
must belong to the same classic virtual system pattern.
All parts passed as arguments are added to the set ofclassic virtual system pattern parts
that must start before the classic virtual system pattern part
to which the StartsAfter object belongs.
Invocation of this method is shown in the following example:
This method returns StartsAfter to allow chained operations.>>> firstPart = mypattern.parts[0] >>> secondPart = mypattern.parts[1] >>> secondPart.startsafter += firstPart
- isDeletable
- Indicates if the specified classic virtual system pattern part can be removed from the list of parts that start after this part.
- __isub__
- This method is invoked implicitly by Jython when you use the -= operator
on the StartsAfter attribute of a classic virtual system pattern part.
It accepts a single parameter that can be either a classic virtual system pattern part
or list of classic virtual system pattern parts.
All classic virtual system pattern parts
must belong to the same classic virtual system pattern.
All parts passed as arguments are removed from the set of classic virtual system pattern parts
that must start before the classic virtual system pattern part
to which the StartsAfter attribute belongs.
Invocation of this method is shown in the following example:
This method returns the StartsAfter attribute to allow chained operations.>>> firstPart = mypattern.parts[0] >>> secondPart = mypattern.parts[1] >>> secondPart.startsafter -= firstPart
- __iter__
- This method is invoked implicitly by Jython when a StartsAfter object is used in a context that requires iterating over its elements. It returns an iterator over the classic virtual system pattern parts that are required to start before the original classic virtual system pattern part.
- __len__
- Returns the number of classic virtual system pattern parts
that are explicitly required to start before the classic virtual system pattern part
to which the StartsAfter object belongs.
This method is invoked implicitly by Jython when you use the len() function,
as shown in the following example:
>>> len(mypattern.parts[0].startsafter)
- __lshift__
- This method is invoked implicitly by Jython when you use the left
shift operator ('<<') on a StartsAfter object.
Its single parameter can be either a classic virtual system pattern part
or a list of classic virtual system pattern parts.
All classic virtual system pattern parts
must belong to the same classic virtual system pattern.
All parts passed as arguments are added to the set of classic virtual system pattern parts
that must start before the classic virtual system pattern part
to which the StartsAfter object belongs.
Invocation of this method is shown in the following example:
This method returns the StartsAfter to allow chained operations.>>> firstPart = mypattern.parts[0] >>> secondPart = mypattern.parts[1] >>> secondPart.startsafter << firstPart
- __repr__
- Returns a string representation of the classic virtual system pattern parts that must start before a particular classic virtual system pattern part.
- __rshift__
- This method is invoked implicitly by Jython when you use the right
shift operator ('>>') on a StartsAfter object.
Its single parameter can be either a classic virtual system pattern part
or a list of classic virtual system pattern parts.
All classic virtual system pattern parts
must belong to the same classic virtual system pattern.
All parts passed as arguments are removed from the set of classic virtual system pattern parts
that must start before the classic virtual system pattern part
to which the StartsAfter belongs. Invocation
of this method is shown in the following example:
This method returns the StartsAfter object to allow chained operations.>>> firstPart = mypattern.parts[0] >>> secondPart = mypattern.parts[1] >>> secondPart.startsafter >> firstPart
- __str__
- Returns a string representation of the classic virtual system pattern parts that must start before a particular classic virtual system pattern part.
- __unicode__
- Returns a string representation of the classic virtual system pattern parts that must start before a particular classic virtual system pattern part.
For more information about working with resource objects, see the Related concepts section.