Wizard objects on the command-line interface

The wizard object interactively prompts you for the set of information you must enter to create a resource. The class is supported by the create() method of most resource collections.

Usage

Use the wizard class as part of the create() method of a resource collection to create a resource. The wizard class presents a series of prompts for information that is used when creating a resource object.

The wizard object is supported by resource collection create methods as:
A temporary wizard object
>>> deployer.<resource_collection>.create(deployer.wizard)
A wizard object that you explicitly create
>>> w = deployer.wizard() 
>>> deployer.<resource_collection>.create(w)
After you have entered the information requested by a prompt, click enter to proceed to the next prompt. Prompts that are not required are indicated with the inclusion of (optional) in the prompt. If you do not want to enter a value for an optional prompt, click Enter to advance to the next prompt. For some other prompts, a list of possible values can be accessed. The prompt for these fields includes (* to select from list)". If you enter *, then a list of values is display. Enter the number associated with the option you would like to select.
>>> w = deployer.wizard() 
>>> deployer.virtualsystems.create(w)

Enter ?? for help using the wizard.


name: MyVirtualSystem
pattern (* to select from list): *
1. MyPattern1
2. MyPattern2
3. MyPattern3
pattern (* to select from list):1
Help is available when using the wizard class
  • Enter ?? for additional help on how to use the wizard
  • Enter ? for additional help with a specific prompt. Additional information about the information expected from this prompt is displayed.
  • Enter ! to exit the wizard
Validation logic is used to ensure that a valid value has been entered. If the entered value is not valid for a particular prompt, then an error is displayed and you are then reprompted. After the last prompt has been completed, the resource is created based on the information provided.

Examples

See the following example of the screen output when creating an user object using the wizard class.
>>> w = deployer.wizard()
>>> deployer.users.create(w)

Enter ?? for help using the wizard.

username: joeuser 
fullname: Joe User
password (optional): 
email: joe@mycompany.com
{
  "clouds": (nested object),
  "currentmessage": "RM02013",
  "currentmessage_text": "User has not logged in yet",
  "currentstatus": "RM01062",
  "currentstatus_text": "Inactive",
  "email": "joe@mycompany.com",
  "fullname": "Joe User",
  "groups": (nested object),
  "id": 2,
  "parts": (nested object),
  "password": (write-only),
  "patterns": (nested object),
  "roles": (nested object),
  "scripts": (nested object),
  "username": "joeuser",
  "virtualimages": (nested object),
  "virtualsystems": (nested object)
}

Methods

toDict
If a wizard object was explicitly constructed, use the toDict() method of the wizard class to create a dictionary (dict) object with the required keys. The following example shows how to use the toDict() method to create a dict object as a continuation of the wizard example.
>>> w.toDict()
{'fullname': u'Joe User', 'email': u'joe@mycompany.com', 'username': u'joeuser'}