Sie sind auf Seite 1von 387

Add Chef Server

Chef
This collection of workflows interacts with the Chef Server REST API.
Compatible with all three variations (Open Source, Private, Hosted).
Private keys for server authentication are stored in the
"Library\Chef\Chef Private Keys" configuration item.
All workflows that call the Chef API will read private keys (by hostname
and userid) from this configuration.
Run "Add Chef Server" to Create a REST Host and the first REST Host /
Client / Private Key relationship to the configuration item.
Run "Set Private Key" to add additional REST Host / client / private key
combinations to the configuration item.

1.

Add Chef Server

This workflow will:


- Trust the SSL certificate for your Chef server
- Setup your Chef server as as REST Host (optionally with a proxy)
- Store your chef server, chef user, and chef user pem in as a
configuration parameter
- Enable the debug flag and the open source chef server flag if you choose
to do so.

1.1. Versions
Version

Date

User

Comment

0.0.1

Feb 20, 2015

a212366999

First Release version

0.0.2

Feb 20, 2015

212366999

Added the chef icon

0.0.3

Apr 9, 2015

vCO
Administra
tor

0.0.4

Jul 6, 2015

vCO
Administra
tor

Current version:0.0.4

vCO Workflow Documentation - Jul 6, 2015

Page

Add Chef Server

1.2. Inputs
Name

Type

Description

chefServerName*

string

What is your Chef Server's FQDN?

chefUser*

string

Which Chef user (client) do you


want to connect as?

privateKey*

string

What is the Chef user's Private


Key?

isOpenSource

boolean

Is your Chef server open source?

proxyNeeded

boolean

Do you need a proxy configured to


connect to your Chef server?

proxyHost*

string

What is your proxy hostname?

proxyPort*

number

What is your proxy port?

enableDebug

boolean

Do you want to enable debugging on


this host?

*Parameter is mandatory

1.3. Attributes
Name

Type

Description

url

string

Host's base URL

authentication

string

Host's authentication type

restHost

REST:RESTHost

The created RESTHost

connectionTimeout

number

Connection timeout

operationTimeout

number

Operation timeout

ignoreWarnings

boolean

If set to true, the certificate is


accepted silently and the
certificate is added to the trusted
store

1.4. Parameter

presentation

vCO Workflow Documentation - Jul 6, 2015

Page

Add Chef Server


Parameter

chefServerName

Description

What is your Chef

Parameter Info

Mandatory input: true

Server's FQDN?
chefUser

Which Chef user

Mandatory input: true

(client) do you
want to connect as?
privateKey

What is the Chef

Mandatory input: true

user's Private Key?


enableDebug

Do you want to
enable debug
logging on this
host?

isOpenSource

Is your Chef server Default value: false


open source?

proxyNeeded

Do you need a proxy Default value: false


configured to
connect to your
chef server?

proxyHost

What is your proxy

Mandatory input: true

hostname?
proxyPort

What is your proxy

Mandatory input: true

port?

1.5. Workflow

schema

vCO Workflow Documentation - Jul 6, 2015

Page

Add Chef Server

1.6. Workflow
Name

items
Type

Next item

Description

WorkflowItemEnd
Add a REST

WorkflowItemLink

host
Create URL

WorkflowItemTask

Set Private

Adds a REST host to the plug-

Key

in's inventory.

Import a
certificate
from URL

vCO Workflow Documentation - Jul 6, 2015

Page

Add Chef Server


Name

Set Private

Type

WorkflowItemLink

Key

Next item

Description

Toggle Debug

Adds a private key as a

Logging

configuration item to "Chef/Chef


Private Keys" for authentication
purposes.
All workflows that call the Chef
API will read private keys from
this configuration.
Private keys are stored in the
Configuration item per chef host
and userid.
This workflow can also store
validator keys.

Userid of

validator keys would be:


<orgname>-validator
Is Chef open

WorkflowItemGeneri Mark as open

source

cCondition

Mark as open

WorkflowItemTask

source

source
Import a

WorkflowItemLink

certificate

Add a REST

Imports an SSL certificate into

host

the server trust store.

Is Chef open

Toggles debug logging for

source

workflows communicating to

from URL
Toggle Debug

WorkflowItemLink

Logging

particular Chef Server.


This workflow sets the value of
a custom property on the
respective RESTHost object.
The name of the custom property
is "debug"

1.7. Source

code for the used actions

1.7.1. Create URL

vCO Workflow Documentation - Jul 6, 2015

Page

Set Private Key

url="https://"+chefServerName+"/"

1.7.2. Is Chef open source


//Generated by the system, cannot be edited
return (isOpenSource == true) ;

1.7.3. Mark as open source


var host = System.getModule("com.vmware.pso.chef").getRestHostByName(chefServerName);
Server.setCustomProperty(host,"opensource",true);

2.

Set Private Key

Adds a private key as a configuration item to "Chef/Chef Private Keys" for


authentication purposes.
All workflows that call the Chef API will read private keys from this
configuration.
Private keys are stored in the Configuration item per chef host and
userid.
This workflow can also store validator keys.
would be: <orgname>-validator

Userid of validator keys

2.1. Versions
Version

Date

User

0.0.1

May 14, 2013

root

0.0.2

Oct 2, 2013

vCO

Comment

doc update

Administra
tor
0.0.3

Oct 9, 2013

vCO
Administra
tor

0.0.4

Oct 9, 2013

vCO
Administra
tor

vCO Workflow Documentation - Jul 6, 2015

Page

Set Private Key


Version

Date

0.0.5

User

Oct 9, 2013

Comment

vCO
Administra
tor

Current version:0.0.5

2.2. Inputs
Name

Type

chefHostname

string

userid

string

pem

string

Description

RSA Private Key.

PKCS#1 PEM format

2.3. Attributes
Name

Type

configItem

Description

ConfigurationElemen
t

2.4. Parameter

presentation

Parameter

Description

chefHostname

chefHostname

userid

userid

pem

pem

2.5. Workflow

Parameter Info

schema

vCO Workflow Documentation - Jul 6, 2015

Page

Toggle Debug Logging

2.6. Workflow
Name

items
Type

Next item

Description

WorkflowItemEnd
Add Private

WorkflowItemTask

Key To
Configuratio
n

2.7. Source

code for the used actions

2.7.1. Add Private Key To Configuration


configItem.setAttributeWithKey(chefHostname+':'+userid,pem);

3.

Toggle Debug Logging

Toggles debug logging for workflows communicating to particular Chef


Server.
This workflow sets the value of a custom property on the respective
RESTHost object.
The name of the custom property is "debug"

3.1. Versions
Version

Date

vCO Workflow Documentation - Jul 6, 2015

User

Comment

Page

Toggle Debug Logging


Version

Date

0.0.1

User

Feb 2, 2014

Comment

vCO
Administra
tor

0.0.2

Feb 26, 2014

vCO
Administra
tor

Current version:0.0.2

3.2. Inputs
Name

Type

chefHostname

string

enableDebug

boolean

3.3. Parameter

presentation

Parameter

Description

chefHostname

chefHostname

enableDebug

enableDebug

3.4. Workflow

schema

3.5. Workflow

items

Name

Description

Type

vCO Workflow Documentation - Jul 6, 2015

Parameter Info

Next item

Description

Page

Add New Client


Name

Type

Next item

Description

WorkflowItemEnd
Set Custom

WorkflowItemTask

Property

3.6. Source

code for the used actions

3.6.1. Set Custom Property


var host = System.getModule("com.vmware.pso.chef").getRestHostByName(chefHostname);
Server.setCustomProperty(host,"debug",enableDebug);

Clients

4.
4.1.

Add New Client

Adds a new API client to a Chef server


Returns the private and public keys for the new client.
The private key will only be returned this one time.
the server.

It is not stored on

4.1.1. Versions
Version

Date

User

Comment

0.0.1

May 13, 2013

root

works!

0.0.2

May 14, 2013

Dan

doc update

Linsley
0.1.0

May 30, 2013

vCO

add orgName input

Administra
tor
0.1.1

Oct 9, 2013

vCO
Administra
tor

0.1.2

Nov 24, 2014

vCO
Administra
tor

vCO Workflow Documentation - Jul 6, 2015

Page

10

Add New Client


Version

Date

0.1.3

User

Jan 2, 2015

Comment

vCO
Administra
tor

0.1.4

Jan 2, 2015

vCO
Administra
tor

Current version:0.1.4

4.1.2. Inputs
Name

Type

Description

chefHostname*

string

userid*

string

orgName*

string

client*

string

Name of new client

admin

boolean

Should the new client be flagged as


an admin api client?

pem

string

(Optional)

Private key for the

userid client.

The private key

will be looked up in the <b>Chef


Private Keys</b> Configuration
Element otherwise.

*Parameter is mandatory

4.1.3. Outputs
Name

Type

Description

url

string

private_key

string

RSA private key of the new client

public_key

string

RSA public key of the new client

4.1.4. Attributes

vCO Workflow Documentation - Jul 6, 2015

Page

11

Add New Client

Name

Type

Description

chefOp

REST:RESTOperation

errorCode

string

pemAttr

SecureString

configElement

ConfigurationElemen
t

4.1.5. Parameter
Parameter

presentation
Description

Parameter Info

chefHostname

chefHostname

Mandatory input: true

userid

userid

Mandatory input: true

client

client

Mandatory input: true

admin

Should the new


client be flagged
as an admin api
client?

Mandatory input:
!GetAction("com.vmware.pso.chef.hel
pers","hideOrgName").call(
#chefHostname )

orgName

orgName

pem

(Optional)

Private

key for the userid


client.

The

private key will be


looked up in the
<b>Chef Private
Keys</b>
Configuration
Element otherwise.

4.1.6. Workflow

schema

vCO Workflow Documentation - Jul 6, 2015

Page

12

Add New Client

4.1.7. Workflow
Name

items
Type

Next item

Description

WorkflowItemEnd
postClients

WorkflowItemTask

checkAndGetP
em

Scriptable

WorkflowItemTask

task
WorkflowItemEnd
System+Serve

WorkflowItemTask

Log the input text to the

r error

console and the server log with


level 'error'

System+Serve

WorkflowItemTask

Log the input text to the

r error

console and the server log with


level 'error'

checkAndGetP

WorkflowItemTask

em
System+Serve

Scriptable
task

WorkflowItemTask

r error

Log the input text to the


console and the server log with
level 'error'

vCO Workflow Documentation - Jul 6, 2015

Page

13

Add New Client

4.1.8. Source

code for the used actions

4.1.8.1. postClients
//Auto generated script, cannot be modified !
actionResult =
System.getModule("com.vmware.pso.chef.ops").postClients(chefHostname,orgName) ;

4.1.8.2. Scriptable task


var bodyJS = {};
bodyJS.name = client;
bodyJS.admin = admin;

var body = JSON.stringify(bodyJS);

var result =
System.getModule("com.vmware.pso.chef").executeRequest(chefOp,orgName,userid,pem,body,[]);

var responseJS = JSON.parse(result);

private_key = responseJS.private_key;
public_key = responseJS.public_key;
url = responseJS.uri;

Server.log("Successfully added client",client);


System.log("Successfully added client: "+client);

4.1.8.3. System+Server error


//Auto-generated script
System.error(text + " - " + object);
Server.error(text, object);

4.1.8.4. System+Server error


//Auto-generated script
System.error(text + " - " + object);
Server.error(text, object);

4.1.8.5. checkAndGetPem

vCO Workflow Documentation - Jul 6, 2015

Page

14

Delete Client

//Auto generated script, cannot be modified !


actionResult =
System.getModule("com.vmware.pso.chef").checkAndGetPem(pem,configElement,chefHostname,user
id) ;

4.1.8.6. System+Server error


//Auto-generated script
System.error(text + " - " + object);
Server.error(text, object);

4.2.

Delete Client

Deletes a chef API client.


There is no response body from the chef server for this request.

4.2.1. Versions
Version

Date

User

Comment

0.0.1

May 13, 2013

root

works!

0.0.2

May 14, 2013

Dan

Doc update

Linsley
0.0.3

May 14, 2013

Dan

doc update

Linsley
0.1.0

May 30, 2013

vCO

add orgName input

Administra
tor
0.1.1

Nov 24, 2014

vCO
Administra
tor

0.1.2

Jan 2, 2015

vCO
Administra
tor

Current version:0.1.2

4.2.2. Inputs
Name

vCO Workflow Documentation - Jul 6, 2015

Type

Description

Page

15

Delete Client
Name

Type

Description

chefHostname*

string

userid*

string

orgName*

string

client*

string

Name of API client to delete

pem

string

(Optional)

Private key for the

userid client.

The private key

will be looked up in the <b>Chef


Private Keys</b> Configuration
Element otherwise.

*Parameter is mandatory

4.2.3. Attributes
Name

Type

Description

chefOp

REST:RESTOperation

errorCode

string

pemAttr

SecureString

configElement

ConfigurationElemen
t

4.2.4. Parameter
Parameter

presentation
Description

Parameter Info

chefHostname

chefHostname

Mandatory input: true

userid

userid

Mandatory input: true

client

client

Mandatory input: true

orgName

orgName

Mandatory input:
!GetAction("com.vmware.pso.chef.hel
pers","hideOrgName").call(
#chefHostname )

vCO Workflow Documentation - Jul 6, 2015

Page

16

Delete Client
Parameter

Description

pem

(Optional)

Parameter Info

Private

key for the userid


client.

The

private key will be


looked up in the
<b>Chef Private
Keys</b>
Configuration
Element otherwise.

4.2.5. Workflow

schema

4.2.6. Workflow

items

Name

Type

Next item

Description

WorkflowItemEnd
deleteClient

WorkflowItemTask

checkAndGetP
em

Scriptable

WorkflowItemTask

task
WorkflowItemEnd
System+Serve

WorkflowItemTask

r error

Log the input text to the


console and the server log with
level 'error'

vCO Workflow Documentation - Jul 6, 2015

Page

17

Delete Client
Name

System+Serve

Type

Next item

WorkflowItemTask

Description

Log the input text to the

r error

console and the server log with


level 'error'

checkAndGetP

WorkflowItemTask

em
System+Serve

Scriptable
task

WorkflowItemTask

r error

Log the input text to the


console and the server log with
level 'error'

4.2.7. Source

code for the used actions

4.2.7.1. deleteClient
//Auto generated script, cannot be modified !
actionResult =
System.getModule("com.vmware.pso.chef.ops").deleteClient(chefHostname,orgName) ;

4.2.7.2. Scriptable task


var result =
System.getModule("com.vmware.pso.chef").executeRequest(chefOp,orgName,userid,pem,"",[clien
t]);

System.log("Successfully deleted client "+ client);


Server.log("Successfully deleted client", client);

4.2.7.3. System+Server error


//Auto-generated script
System.error(text + " - " + object);
Server.error(text, object);

4.2.7.4. System+Server error


//Auto-generated script
System.error(text + " - " + object);
Server.error(text, object);

vCO Workflow Documentation - Jul 6, 2015

Page

18

Get Client Details

4.2.7.5. checkAndGetPem
//Auto generated script, cannot be modified !
actionResult =
System.getModule("com.vmware.pso.chef").checkAndGetPem(pem,configElement,chefHostname,user
id) ;

4.2.7.6. System+Server error


//Auto-generated script
System.error(text + " - " + object);
Server.error(text, object);

4.3.

Get Client Details

Retrieves details of a particular API client in Chef.

4.3.1. Versions
Version

Date

User

Comment

0.0.1

May 13, 2013

root

works!

0.0.2

May 14, 2013

Dan

doc update

Linsley
0.0.3

May 29, 2013

vCO
Administra
tor

0.0.4

May 29, 2013

vCO
Administra
tor

0.0.5

Oct 9, 2013

vCO
Administra
tor

0.0.6

Jan 27, 2014

vCO
Administra
tor

0.0.7

Nov 24, 2014

vCO
Administra
tor

vCO Workflow Documentation - Jul 6, 2015

Page

19

Get Client Details


Version

Date

0.0.8

User

Jan 2, 2015

Comment

vCO
Administra
tor

Current version:0.0.8

4.3.2. Inputs
Name

Type

Description

chefHostname*

string

userid*

string

orgName*

string

client*

string

Name of API client

pem

string

(Optional)

Private key for the

userid client.

The private key

will be looked up in the <b>Chef


Private Keys</b> Configuration
Element otherwise.

*Parameter is mandatory

4.3.3. Outputs
Name

Type

admin

boolean

chef_type

string

json_class

string

name

string

public_key

string

validator

boolean

certificate

string

Description

4.3.4. Attributes

vCO Workflow Documentation - Jul 6, 2015

Page

20

Get Client Details

Name

Type

Description

chefOp

REST:RESTOperation

errorCode

string

pemAttr

SecureString

configElement

ConfigurationElemen
t

4.3.5. Parameter
Parameter

presentation
Description

Parameter Info

chefHostname

chefHostname

Mandatory input: true

userid

userid

Mandatory input: true

client

client

Mandatory input: true

orgName

orgName

Mandatory input:
!GetAction("com.vmware.pso.chef.hel
pers","hideOrgName").call(
#chefHostname )

pem

(Optional)

Private

key for the userid


client.

The

private key will be


looked up in the
<b>Chef Private
Keys</b>
Configuration
Element otherwise.

4.3.6. Workflow

schema

vCO Workflow Documentation - Jul 6, 2015

Page

21

Get Client Details

4.3.7. Workflow
Name

items
Type

Next item

Description

WorkflowItemEnd
getClient

WorkflowItemTask

checkAndGetP
em

Execute and

WorkflowItemTask

Parse
Response
WorkflowItemEnd
System+Serve

WorkflowItemTask

Log the input text to the

r error

console and the server log with


level 'error'

System+Serve

WorkflowItemTask

Log the input text to the

r error

console and the server log with


level 'error'

checkAndGetP

WorkflowItemTask

em

Execute and
Parse
Response

System+Serve

WorkflowItemTask

r error

Log the input text to the


console and the server log with
level 'error'

vCO Workflow Documentation - Jul 6, 2015

Page

22

Get Client Details

4.3.8. Source

code for the used actions

4.3.8.1. getClient
//Auto generated script, cannot be modified !
actionResult = System.getModule("com.vmware.pso.chef.ops").getClient(chefHostname,orgName)
;

4.3.8.2. Execute and Parse Response


var result =
System.getModule("com.vmware.pso.chef").executeRequest(chefOp,orgName,userid,pem,"",[clien
t]);

var responseJS = JSON.parse(result);

admin = responseJS.admin;
chef_type = responseJS.chef_type;
json_class = responseJS.json_class;
name = responseJS.name;
public_key = responseJS.public_key;
validator = responseJS.validator;
certificate = responseJS.certificate;

4.3.8.3. System+Server error


//Auto-generated script
System.error(text + " - " + object);
Server.error(text, object);

4.3.8.4. System+Server error


//Auto-generated script
System.error(text + " - " + object);
Server.error(text, object);

4.3.8.5. checkAndGetPem
//Auto generated script, cannot be modified !
actionResult =
System.getModule("com.vmware.pso.chef").checkAndGetPem(pem,configElement,chefHostname,user
id) ;

vCO Workflow Documentation - Jul 6, 2015

Page

23

Get Clients

4.3.8.6. System+Server error


//Auto-generated script
System.error(text + " - " + object);
Server.error(text, object);

4.4.

Get Clients

Returns a list of api clients from Chef server

4.4.1. Versions
Version

Date

User

Comment

0.0.1

May 13, 2013

root

works!

0.0.2

May 14, 2013

root

Outputs Assigned

0.0.3

May 14, 2013

Dan

doc update

Linsley
0.1.0

May 30, 2013

vCO

add orgName input

Administra
tor
0.1.1

Feb 25, 2014

vCO
Administra
tor

0.1.2

Jan 2, 2015

vCO
Administra
tor

Current version:0.1.2

4.4.2. Inputs
Name

Type

chefHostname*

string

userid*

string

orgName*

string

vCO Workflow Documentation - Jul 6, 2015

Description

Page

24

Get Clients
Name

Type

pem

Description

string

(Optional)

Private key for the

userid client.

The private key

will be looked up in the <b>Chef


Private Keys</b> Configuration
Element otherwise.

*Parameter is mandatory

4.4.3. Outputs
Name

Type

clients

Array/string

urls

Array/string

Description

Names of API clients

4.4.4. Attributes
Name

Type

Description

chefOp

REST:RESTOperation

pemAttr

SecureString

errorCode

string

configElement

ConfigurationElemen
t

4.4.5. Parameter
Parameter

presentation
Description

Parameter Info

chefHostname

chefHostname

Mandatory input: true

userid

userid

Mandatory input: true

orgName

orgName

Mandatory input:
!GetAction("com.vmware.pso.chef.hel
pers","hideOrgName").call(
#chefHostname )

vCO Workflow Documentation - Jul 6, 2015

Page

25

Get Clients
Parameter

Description

pem

(Optional)

Parameter Info

Private

key for the userid


client.

The

private key will be


looked up in the
<b>Chef Private
Keys</b>
Configuration
Element otherwise.

4.4.6. Workflow

schema

4.4.7. Workflow

items

Name

Type

Next item

Description

WorkflowItemEnd
getClients

WorkflowItemTask

checkAndGetP
em

Scriptable

WorkflowItemTask

task
checkAndGetP

WorkflowItemTask

em

vCO Workflow Documentation - Jul 6, 2015

Scriptable
task

Page

26

Get Clients
Name

System+Serve

Type

Next item

WorkflowItemTask

Description

Log the input text to the

r error

console and the server log with


level 'error'

System+Serve

WorkflowItemTask

r error

System+Serve

Log the input text to the

r error

console and the server log with


level 'error'

System+Serve

WorkflowItemTask

r error

Log the input text to the


console and the server log with
level 'error'

WorkflowItemEnd

4.4.8. Source

code for the used actions

4.4.8.1. getClients
//Auto generated script, cannot be modified !
actionResult =
System.getModule("com.vmware.pso.chef.ops").getClients(chefHostname,orgName) ;

4.4.8.2. Scriptable task


var result =
System.getModule("com.vmware.pso.chef").executeRequest(chefOp,orgName,userid,pem,"",[]);

var responseJS = JSON.parse(result);

clients = new Array();


urls = new Array();

for(var i in responseJS) {
clients.push(i);
urls.push(responseJS[i]);
}

4.4.8.3. checkAndGetPem
//Auto generated script, cannot be modified !
actionResult =
System.getModule("com.vmware.pso.chef").checkAndGetPem(pem,configElement,chefHostname,user

vCO Workflow Documentation - Jul 6, 2015

Page

27

Get Cookbooks
id) ;

4.4.8.4. System+Server error


//Auto-generated script
System.error(text + " - " + object);
Server.error(text, object);

4.4.8.5. System+Server error


//Auto-generated script
System.error(text + " - " + object);
Server.error(text, object);

4.4.8.6. System+Server error


//Auto-generated script
System.error(text + " - " + object);
Server.error(text, object);

5.

Cookbooks

Workflows for fetching Cookbooks from a Chef server

5.1.

Get Cookbooks

Returns a list of cookbooks from Chef server

5.1.1. Versions
Version

Date

User

Comment

0.0.1

May 13, 2013

root

works!

0.0.2

May 14, 2013

root

Outputs Assigned

0.0.3

May 14, 2013

Dan

doc update

Linsley
0.1.0

May 30, 2013

vCO

add orgName input

Administra
tor
0.1.1

Jun 3, 2013

Daniel
Linsley

vCO Workflow Documentation - Jul 6, 2015

Page

28

Get Cookbooks
Version

0.1.2

Date

User

Jun 20, 2013

Comment

Daniel
Linsley

0.1.3

Oct 9, 2013

vCO
Administra
tor

0.1.4

Jan 27, 2014

vCO
Administra
tor

0.1.5

Nov 24, 2014

vCO
Administra
tor

0.1.6

Jan 2, 2015

vCO
Administra
tor

Current version:0.1.6

5.1.2. Inputs
Name

Type

chefHostname*

string

userid*

string

orgName*

string

pem

string

Description

(Optional)

Private key for the

userid client.

The private key

will be looked up in the <b>Chef


Private Keys</b> Configuration
Element otherwise.

*Parameter is mandatory

5.1.3. Outputs
Name

Type

cookbooks

Array/string

urls

Array/string

vCO Workflow Documentation - Jul 6, 2015

Description

Names of API clients

Page

29

Get Cookbooks

5.1.4. Attributes
Name

Type

Description

chefOp

REST:RESTOperation

pemAttr

SecureString

errorCode

string

configElement

ConfigurationElemen
t

5.1.5. Parameter
Parameter

presentation
Description

Parameter Info

chefHostname

chefHostname

Mandatory input: true

userid

userid

Mandatory input: true

orgName

orgName

Mandatory input:
!GetAction("com.vmware.pso.chef.hel
pers","hideOrgName").call(
#chefHostname )

pem

(Optional)

Private

key for the userid


client.

The

private key will be


looked up in the
<b>Chef Private
Keys</b>
Configuration
Element otherwise.

5.1.6. Workflow

schema

vCO Workflow Documentation - Jul 6, 2015

Page

30

Get Cookbooks

5.1.7. Workflow
Name

items
Type

Next item

Description

WorkflowItemEnd
getCookbooks

WorkflowItemTask

checkAndGetP
em

Execute and

WorkflowItemTask

Parse
Response
checkAndGetP

WorkflowItemTask

em

Execute and
Parse
Response

System+Serve

WorkflowItemTask

r error

Log the input text to the


console and the server log with
level 'error'

System+Serve

WorkflowItemTask

r error

Log the input text to the


console and the server log with
level 'error'

System+Serve

WorkflowItemTask

r error

Log the input text to the


console and the server log with
level 'error'

WorkflowItemEnd

vCO Workflow Documentation - Jul 6, 2015

Page

31

Get Cookbooks

5.1.8. Source

code for the used actions

5.1.8.1. getCookbooks
//Auto generated script, cannot be modified !
actionResult =
System.getModule("com.vmware.pso.chef.ops").getCookbooks(chefHostname,orgName) ;

5.1.8.2. Execute and Parse Response


var result =
System.getModule("com.vmware.pso.chef").executeRequest(chefOp,orgName,userid,pem,"",[]);

var responseJS = JSON.parse(result);

cookbooks = new Array();


urls = new Array();

for(var i in responseJS) {
cookbooks.push(i);
urls.push(responseJS[i].url);
}

5.1.8.3. checkAndGetPem
//Auto generated script, cannot be modified !
actionResult =
System.getModule("com.vmware.pso.chef").checkAndGetPem(pem,configElement,chefHostname,user
id) ;

5.1.8.4. System+Server error


//Auto-generated script
System.error(text + " - " + object);
Server.error(text, object);

5.1.8.5. System+Server error


//Auto-generated script
System.error(text + " - " + object);
Server.error(text, object);

vCO Workflow Documentation - Jul 6, 2015

Page

32

Get Cookbook Version Details

5.1.8.6. System+Server error


//Auto-generated script
System.error(text + " - " + object);
Server.error(text, object);

5.2.

Get Cookbook Version Details

Retrieves the versions of a particular cookbook on the Chef server.

5.2.1. Versions
Version

Date

User

Comment

0.0.1

May 13, 2013

root

works!

0.0.2

May 14, 2013

Dan

doc update

Linsley
0.0.3

May 29, 2013

vCO
Administra
tor

0.0.4

May 29, 2013

vCO
Administra
tor

0.0.5

Jun 3, 2013

Daniel
Linsley

0.0.6

Jun 3, 2013

Daniel
Linsley

0.0.7

Jun 20, 2013

Daniel
Linsley

0.0.8

Jan 27, 2014

vCO
Administra
tor

0.0.9

Jan 27, 2014

vCO
Administra
tor

0.0.10

Jan 27, 2014

vCO
Administra
tor

vCO Workflow Documentation - Jul 6, 2015

Page

33

Get Cookbook Version Details


Version

0.0.11

Date

Jan 27, 2014

User

Comment

vCO
Administra
tor

0.0.12

Feb 2, 2014

vCO
Administra
tor

0.0.13

Feb 2, 2014

vCO
Administra
tor

0.0.14

Feb 2, 2014

vCO
Administra
tor

0.0.15

Feb 2, 2014

vCO
Administra
tor

0.0.16

Feb 2, 2014

vCO
Administra
tor

0.0.17

Feb 2, 2014

vCO
Administra
tor

0.0.18

Feb 2, 2014

vCO
Administra
tor

0.0.19

Feb 2, 2014

vCO
Administra
tor

0.0.20

Feb 2, 2014

vCO
Administra
tor

0.0.21

Nov 24, 2014

vCO
Administra
tor

vCO Workflow Documentation - Jul 6, 2015

Page

34

Get Cookbook Version Details


Version

Date

0.0.22

User

Jan 2, 2015

Comment

vCO
Administra
tor

Current version:0.0.22

5.2.2. Inputs
Name

Type

chefHostname*

string

userid*

string

orgName*

string

cookbook*

string

version*

string

pem

string

Description

(Optional)

Private key for the

userid client.

The private key

will be looked up in the <b>Chef


Private Keys</b> Configuration
Element otherwise.

*Parameter is mandatory

5.2.3. Outputs
Name

Type

recipes

Array/string

recipeDescriptions

Array/string

platforms

Array/string

platformVersions

Array/string

license

string

dependencies

Array/string

description

string

longDescription

string

vCO Workflow Documentation - Jul 6, 2015

Description

Page

35

Get Cookbook Version Details


Name

actualVersion

Type

Description

Type

Description

string

5.2.4. Attributes
Name

chefOp

REST:RESTOperation

errorCode

string

pemAttr

SecureString

configElement

ConfigurationElemen
t

5.2.5. Parameter
Parameter

presentation
Description

Parameter Info

chefHostname

chefHostname

Mandatory input: true

userid

userid

Mandatory input: true

orgName

orgName

Mandatory input:
!GetAction("com.vmware.pso.chef.hel
pers","hideOrgName").call(
#chefHostname )

cookbook

cookbook

Mandatory input: true

version

version

Mandatory input: true

pem

(Optional)

Private

key for the userid


client.

The

private key will be


looked up in the
<b>Chef Private
Keys</b>
Configuration
Element otherwise.

vCO Workflow Documentation - Jul 6, 2015

Page

36

Get Cookbook Version Details

5.2.6. Workflow

schema

5.2.7. Workflow

items

Name

Type

Next item

Description

WorkflowItemEnd
getCookbook

WorkflowItemTask

checkAndGetP
em

Scriptable

WorkflowItemTask

task
WorkflowItemEnd
System+Serve

WorkflowItemTask

Log the input text to the

r error

console and the server log with


level 'error'

System+Serve

WorkflowItemTask

Log the input text to the

r error

console and the server log with


level 'error'

checkAndGetP

WorkflowItemTask

em
System+Serve

Scriptable
task

WorkflowItemTask

r error

Log the input text to the


console and the server log with
level 'error'

vCO Workflow Documentation - Jul 6, 2015

Page

37

Get Cookbook Version Details

5.2.8. Source

code for the used actions

5.2.8.1. getCookbook
//Auto generated script, cannot be modified !
actionResult =
System.getModule("com.vmware.pso.chef.ops").getCookbookVersion(chefHostname,orgName) ;

5.2.8.2. Scriptable task


var result =
System.getModule("com.vmware.pso.chef").executeRequest(chefOp,orgName,userid,pem,"",[cookb
ook,version]);

var responseJS = JSON.parse(result);

versions = new Array();


urls = new Array();

license = responseJS.metadata.license;
description = responseJS.metadata.description;
longDescription = responseJS.metadata.long_description;
actualVersion = responseJS.metadata.version;

var recipesObj = responseJS.metadata.recipes;


recipes = new Array();
recipeDescriptions = new Array();
for (var key in recipesObj) {
recipes.push(key);
recipeDescriptions.push(recipesObj[key]);
}

var platformsObj = responseJS.metadata.platforms;


platforms = new Array();
platformVersions = new Array();
for (var key in platformsObj) {
platforms.push(key);
platformVersions.push(platformsObj[key]);
}

var dependenciesObj = responseJS.metadata.dependencies;


dependencies = new Array();
for (var key in dependenciesObj) {
dependencies.push(key);

vCO Workflow Documentation - Jul 6, 2015

Page

38

Get Cookbook Versions


}

5.2.8.3. System+Server error


//Auto-generated script
System.error(text + " - " + object);
Server.error(text, object);

5.2.8.4. System+Server error


//Auto-generated script
System.error(text + " - " + object);
Server.error(text, object);

5.2.8.5. checkAndGetPem
//Auto generated script, cannot be modified !
actionResult =
System.getModule("com.vmware.pso.chef").checkAndGetPem(pem,configElement,chefHostname,user
id) ;

5.2.8.6. System+Server error


//Auto-generated script
System.error(text + " - " + object);
Server.error(text, object);

5.3.

Get Cookbook Versions

Retrieves the versions of a particular cookbook on the Chef server.

5.3.1. Versions
Version

Date

User

Comment

0.0.1

May 13, 2013

root

works!

0.0.2

May 14, 2013

Dan

doc update

Linsley
0.0.3

May 29, 2013

vCO
Administra
tor

vCO Workflow Documentation - Jul 6, 2015

Page

39

Get Cookbook Versions


Version

0.0.4

Date

User

May 29, 2013

Comment

vCO
Administra
tor

0.0.5

Jun 3, 2013

Daniel
Linsley

0.0.6

Jun 3, 2013

Daniel
Linsley

0.0.7

Jun 20, 2013

Daniel
Linsley

0.0.8

Jan 27, 2014

vCO
Administra
tor

0.0.9

Jan 27, 2014

vCO
Administra
tor

0.0.10

Nov 24, 2014

vCO
Administra
tor

0.0.11

Jan 2, 2015

vCO
Administra
tor

Current version:0.0.11

5.3.2. Inputs
Name

Type

chefHostname*

string

userid*

string

orgName*

string

cookbook*

string

vCO Workflow Documentation - Jul 6, 2015

Description

Page

40

Get Cookbook Versions


Name

Type

pem

Description

string

(Optional)

Private key for the

userid client.

The private key

will be looked up in the <b>Chef


Private Keys</b> Configuration
Element otherwise.

*Parameter is mandatory

5.3.3. Outputs
Name

Type

versions

Array/string

urls

Array/string

Description

5.3.4. Attributes
Name

Type

Description

chefOp

REST:RESTOperation

errorCode

string

pemAttr

SecureString

configElement

ConfigurationElemen
t

5.3.5. Parameter
Parameter

presentation
Description

Parameter Info

chefHostname

chefHostname

Mandatory input: true

userid

userid

Mandatory input: true

orgName

orgName

Mandatory input:
!GetAction("com.vmware.pso.chef.hel
pers","hideOrgName").call(
#chefHostname )

cookbook

cookbook

Mandatory input: true

vCO Workflow Documentation - Jul 6, 2015

Page

41

Get Cookbook Versions


Parameter

Description

pem

(Optional)

Parameter Info

Private

key for the userid


client.

The

private key will be


looked up in the
<b>Chef Private
Keys</b>
Configuration
Element otherwise.

5.3.6. Workflow

schema

5.3.7. Workflow

items

Name

Type

Next item

Description

WorkflowItemEnd
getCookbook

WorkflowItemTask

checkAndGetP
em

Scriptable

WorkflowItemTask

task
WorkflowItemEnd
System+Serve

WorkflowItemTask

r error

Log the input text to the


console and the server log with
level 'error'

vCO Workflow Documentation - Jul 6, 2015

Page

42

Get Cookbook Versions


Name

System+Serve

Type

Next item

WorkflowItemTask

Description

Log the input text to the

r error

console and the server log with


level 'error'

checkAndGetP

WorkflowItemTask

em

Scriptable
task

System+Serve

WorkflowItemTask

r error

Log the input text to the


console and the server log with
level 'error'

5.3.8. Source

code for the used actions

5.3.8.1. getCookbook
//Auto generated script, cannot be modified !
actionResult =
System.getModule("com.vmware.pso.chef.ops").getCookbook(chefHostname,orgName) ;

5.3.8.2. Scriptable task


var result =
System.getModule("com.vmware.pso.chef").executeRequest(chefOp,orgName,userid,pem,"",[cookb
ook]);

var responseJS = JSON.parse(result);

versions = new Array();


urls = new Array();

for (var i in responseJS) {

//should only be one item.

Should be the name of the

cookbook.
var versionsJS = responseJS[i].versions;

for (var j in versionsJS) {


versions.push(versionsJS[j].version);
urls.push(versionsJS[j].url);
}
}

vCO Workflow Documentation - Jul 6, 2015

Page

43

Add Data Bag Item

5.3.8.3. System+Server error


//Auto-generated script
System.error(text + " - " + object);
Server.error(text, object);

5.3.8.4. System+Server error


//Auto-generated script
System.error(text + " - " + object);
Server.error(text, object);

5.3.8.5. checkAndGetPem
//Auto generated script, cannot be modified !
actionResult =
System.getModule("com.vmware.pso.chef").checkAndGetPem(pem,configElement,chefHostname,user
id) ;

5.3.8.6. System+Server error


//Auto-generated script
System.error(text + " - " + object);
Server.error(text, object);

6.

Data Bags

Workflows for manipulating Data Bags on a Chef Server

6.1.

Add Data Bag Item

Adds a new Data Bag Item to a Chef Server

6.1.1. Versions
Version

Date

User

Comment

0.0.1

May 13, 2013

root

works!

0.0.2

May 14, 2013

Dan

doc update

Linsley
0.1.0

May 30, 2013

vCO

add orgName input

Administra
tor

vCO Workflow Documentation - Jul 6, 2015

Page

44

Add Data Bag Item


Version

0.1.1

Date

Jun 25, 2013

User

Comment

vCO
Administra
tor

0.1.2

Jun 25, 2013

vCO
Administra
tor

0.1.3

Jun 25, 2013

vCO
Administra
tor

0.1.4

Jun 25, 2013

vCO
Administra
tor

0.1.5

Jun 25, 2013

vCO
Administra
tor

0.1.6

Jun 25, 2013

vCO
Administra
tor

0.1.7

Oct 9, 2013

vCO
Administra
tor

0.1.8

Oct 9, 2013

vCO
Administra
tor

0.1.9

Oct 19, 2013

vCO
Administra
tor

0.1.10

Oct 19, 2013

vCO
Administra
tor

0.1.11

Nov 8, 2013

vCO
Administra
tor

vCO Workflow Documentation - Jul 6, 2015

Page

45

Add Data Bag Item


Version

Date

0.1.12

User

Nov 8, 2013

Comment

vCO
Administra
tor

0.1.13

Nov 8, 2013

vCO
Administra
tor

0.1.14

Nov 9, 2013

vCO
Administra
tor

0.1.15

Nov 24, 2014

vCO
Administra
tor

0.1.16

Jan 2, 2015

vCO
Administra
tor

Current version:0.1.16

6.1.2. Inputs
Name

Type

Description

chefHostname*

string

userid*

string

orgName*

string

databag*

string

item*

string

Name of new data bag item

json_values*

string

Item JSON values.

Values for the

data bag item in JSON format


(optional)
pem

string

(Optional)

Private key for the

userid client.

The private key

will be looked up in the <b>Chef


Private Keys</b> Configuration
Element otherwise.

vCO Workflow Documentation - Jul 6, 2015

Page

46

Add Data Bag Item


*Parameter is mandatory

6.1.3. Outputs
Name

url

Type

Description

Type

Description

string

6.1.4. Attributes
Name

chefOp

REST:RESTOperation

errorCode

string

pemAttr

SecureString

configElement

ConfigurationElemen
t

6.1.5. Parameter
Parameter

presentation
Description

Parameter Info

chefHostname

chefHostname

Mandatory input: true

userid

userid

Mandatory input: true

orgName

orgName

Mandatory input:
!GetAction("com.vmware.pso.chef.hel
pers","hideOrgName").call(
#chefHostname )

databag

data bag

Mandatory input: true

item

Name of new data

Mandatory input: true

bag item
json_values

Item JSON values

vCO Workflow Documentation - Jul 6, 2015

Mandatory input: false

Page

47

Add Data Bag Item


Parameter

Description

pem

(Optional)

Parameter Info

Private

key for the userid


client.

The

private key will be


looked up in the
<b>Chef Private
Keys</b>
Configuration
Element otherwise.

6.1.6. Workflow

schema

6.1.7. Workflow

items

Name

Type

Next item

Description

WorkflowItemEnd
postDatabagI

WorkflowItemTask

tem
Scriptable

checkAndGetP
em

WorkflowItemTask

task
WorkflowItemEnd
System+Serve

WorkflowItemTask

r error

Log the input text to the


console and the server log with
level 'error'

vCO Workflow Documentation - Jul 6, 2015

Page

48

Add Data Bag Item


Name

System+Serve

Type

Next item

WorkflowItemTask

Description

Log the input text to the

r error

console and the server log with


level 'error'

checkAndGetP

WorkflowItemTask

em
System+Serve

Scriptable
task

WorkflowItemTask

r error

Log the input text to the


console and the server log with
level 'error'

6.1.8. Source

code for the used actions

6.1.8.1. postDatabagItem
//Auto generated script, cannot be modified !
actionResult =
System.getModule("com.vmware.pso.chef.ops").postDatabagItem(chefHostname,orgName) ;

6.1.8.2. Scriptable task


var bodyJS;

if (json_values == null || json_values.length == 0) {


System.debug("json_values was empty, creating empty databag item");
bodyJS = {};
} else {
bodyJS = JSON.parse(json_values);
}
bodyJS.id = item;

var body = JSON.stringify(bodyJS);

var result =
System.getModule("com.vmware.pso.chef").executeRequest(chefOp,orgName,userid,pem,body,[dat
abag]);

var responseJS = JSON.parse(result);

Server.log("Successfully added databag item", item);


System.log("Successfully added databag item: "+item);

vCO Workflow Documentation - Jul 6, 2015

Page

49

Add Data Bag Item Attribute

6.1.8.3. System+Server error


//Auto-generated script
System.error(text + " - " + object);
Server.error(text, object);

6.1.8.4. System+Server error


//Auto-generated script
System.error(text + " - " + object);
Server.error(text, object);

6.1.8.5. checkAndGetPem
//Auto generated script, cannot be modified !
actionResult =
System.getModule("com.vmware.pso.chef").checkAndGetPem(pem,configElement,chefHostname,user
id) ;

6.1.8.6. System+Server error


//Auto-generated script
System.error(text + " - " + object);
Server.error(text, object);

6.2.

Add Data Bag Item Attribute

Adds or replaces the value of a single of a Data Bag item attribute on a


Chef Server.

6.2.1. Versions
Version

Date

User

Comment

0.0.1

May 13, 2013

root

works!

0.0.2

May 14, 2013

Dan

doc update

Linsley
0.0.3

May 29, 2013

vCO
Administra
tor

vCO Workflow Documentation - Jul 6, 2015

Page

50

Add Data Bag Item Attribute


Version

0.0.4

Date

May 29, 2013

User

Comment

vCO
Administra
tor

0.0.5

Jun 3, 2013

Daniel
Linsley

0.0.6

Jun 3, 2013

Daniel
Linsley

0.0.7

Jun 3, 2013

Daniel
Linsley

0.0.8

Jun 3, 2013

Daniel
Linsley

0.0.9

Jun 3, 2013

Daniel
Linsley

0.0.10

Jun 3, 2013

Daniel
Linsley

0.0.11

Jun 3, 2013

Daniel
Linsley

0.0.12

Jun 20, 2013

Daniel
Linsley

0.0.13

Oct 19, 2013

vCO
Administra
tor

0.0.14

Oct 19, 2013

vCO
Administra
tor

0.0.15

Oct 19, 2013

vCO
Administra
tor

0.0.16

Oct 19, 2013

vCO
Administra
tor

vCO Workflow Documentation - Jul 6, 2015

Page

51

Add Data Bag Item Attribute


Version

0.0.17

Date

Oct 19, 2013

User

Comment

vCO
Administra
tor

0.0.18

Oct 19, 2013

vCO
Administra
tor

0.0.19

Nov 8, 2013

vCO
Administra
tor

0.0.20

Nov 8, 2013

vCO
Administra
tor

0.0.21

Nov 8, 2013

vCO
Administra
tor

0.0.22

Nov 8, 2013

vCO
Administra
tor

0.0.23

Nov 10, 2013

vCO
Administra
tor

0.0.24

Nov 12, 2013

vCO
Administra
tor

0.0.25

Nov 24, 2014

vCO
Administra
tor

0.0.26

Nov 24, 2014

vCO
Administra
tor

0.0.27

Jan 2, 2015

vCO
Administra
tor

vCO Workflow Documentation - Jul 6, 2015

Page

52

Add Data Bag Item Attribute


Version

0.0.28

Date

User

Jan 2, 2015

Comment

vCO
Administra
tor

Current version:0.0.28

6.2.2. Inputs
Name

Type

Description

chefHostname*

string

userid*

string

orgName*

string

databag*

string

item*

string

key*

string

attribute key

value

string

new value for the attribute

pem

string

(Optional)

Private key for the

userid client.

The private key

will be looked up in the <b>Chef


Private Keys</b> Configuration
Element otherwise.

*Parameter is mandatory

6.2.3. Attributes
Name

Type

errorCode

string

pemAttr

SecureString

configElement

ConfigurationElemen

Description

t
chefPutOp

REST:RESTOperation

itemJS

string

vCO Workflow Documentation - Jul 6, 2015

JSON of the Databag Item

Page

53

Add Data Bag Item Attribute

6.2.4. Parameter

presentation

Parameter

Description

Parameter Info

chefHostname

chefHostname

Mandatory input: true

userid

userid

Mandatory input: true

orgName

orgName

Mandatory input:
!GetAction("com.vmware.pso.chef.hel
pers","hideOrgName").call(
#chefHostname )

databag

databag

Mandatory input: true

item

item

Mandatory input: true

key

attribute key

Mandatory input: true

value

new value for the


attribute

pem

(Optional)

Private

key for the userid


client.

The

private key will be


looked up in the
<b>Chef Private
Keys</b>
Configuration
Element otherwise.

6.2.5. Workflow

schema

vCO Workflow Documentation - Jul 6, 2015

Page

54

Add Data Bag Item Attribute

6.2.6. Workflow
Name

items
Type

Next item

Description

WorkflowItemEnd
Scriptable

WorkflowItemTask

task
WorkflowItemEnd
System+Serve

WorkflowItemTask

Log the input text to the

r error

console and the server log with


level 'error'

System+Serve

WorkflowItemTask

Log the input text to the

r error

console and the server log with


level 'error'

checkAndGetP

WorkflowItemTask

em
System+Serve

Scriptable
task

WorkflowItemTask

Log the input text to the

r error

console and the server log with


level 'error'

putDatabagIt

WorkflowItemTask

em
Get Databag

checkAndGetP
em

WorkflowItemLink

Item

6.2.7. Source

putDatabagIt

Retrieves the keys/values of a

em

Databag item on a Chef Server.

code for the used actions

6.2.7.1. Scriptable task


var itemJSObj = JSON.parse(itemJS);
itemJSObj[key] = value;
var body = JSON.stringify(itemJSObj);
var result =
System.getModule("com.vmware.pso.chef").executeRequest(chefPutOp,orgName,userid,pem,body,[
databag,item]);
var responseJS = JSON.parse(result);

6.2.7.2. System+Server error

vCO Workflow Documentation - Jul 6, 2015

Page

55

Add New Data Bag

//Auto-generated script
System.error(text + " - " + object);
Server.error(text, object);

6.2.7.3. System+Server error


//Auto-generated script
System.error(text + " - " + object);
Server.error(text, object);

6.2.7.4. checkAndGetPem
//Auto generated script, cannot be modified !
actionResult =
System.getModule("com.vmware.pso.chef").checkAndGetPem(pem,configElement,chefHostname,user
id) ;

6.2.7.5. System+Server error


//Auto-generated script
System.error(text + " - " + object);
Server.error(text, object);

6.2.7.6. putDatabagItem
//Auto generated script, cannot be modified !
actionResult =
System.getModule("com.vmware.pso.chef.ops").putDatabagItem(chefHostname,orgName) ;

6.3.

Add New Data Bag

Adds a new Data Bag to a Chef server


Returns the url of the new Data Bag.

6.3.1. Versions
Version

Date

User

Comment

0.0.1

May 13, 2013

root

works!

0.0.2

May 14, 2013

Dan

doc update

Linsley

vCO Workflow Documentation - Jul 6, 2015

Page

56

Add New Data Bag


Version

0.1.0

Date

May 30, 2013

User

vCO

Comment

add orgName input

Administra
tor
0.1.1

Jun 25, 2013

vCO
Administra
tor

0.1.2

Jun 25, 2013

vCO
Administra
tor

0.1.3

Jun 25, 2013

vCO
Administra
tor

0.1.4

Oct 9, 2013

vCO
Administra
tor

0.1.5

Oct 9, 2013

vCO
Administra
tor

0.1.6

Nov 8, 2013

vCO
Administra
tor

0.1.7

Nov 10, 2013

vCO
Administra
tor

0.1.8

Nov 12, 2013

vCO
Administra
tor

0.1.9

Nov 16, 2013

vCO
Administra
tor

0.1.10

Jan 2, 2015

vCO
Administra
tor

Current version:0.1.10

vCO Workflow Documentation - Jul 6, 2015

Page

57

Add New Data Bag

6.3.2. Inputs
Name

Type

Description

chefHostname*

string

userid*

string

orgName*

string

databag*

string

Name of new databag

pem

string

(Optional)

Private key for the

userid client.

The private key

will be looked up in the <b>Chef


Private Keys</b> Configuration
Element otherwise.

*Parameter is mandatory

6.3.3. Outputs
Name

url

Type

Description

Type

Description

string

6.3.4. Attributes
Name

chefOp

REST:RESTOperation

errorCode

string

pemAttr

SecureString

configElement

ConfigurationElemen
t

6.3.5. Parameter
Parameter

chefHostname

presentation
Description

chefHostname

vCO Workflow Documentation - Jul 6, 2015

Parameter Info

Mandatory input: true

Page

58

Add New Data Bag


Parameter

Description

Parameter Info

userid

userid

Mandatory input: true

orgName

orgName

Mandatory input:
!GetAction("com.vmware.pso.chef.hel
pers","hideOrgName").call(
#chefHostname )

databag

Name of new databag Mandatory input: true

pem

(Optional)

Private

key for the userid


client.

The

private key will be


looked up in the
<b>Chef Private
Keys</b>
Configuration
Element otherwise.

6.3.6. Workflow

schema

6.3.7. Workflow

items

Name

Type

Next item

Description

WorkflowItemEnd
postDatabag

WorkflowItemTask

checkAndGetP
em

vCO Workflow Documentation - Jul 6, 2015

Page

59

Add New Data Bag


Name

Scriptable

Type

Next item

Description

WorkflowItemTask

task
WorkflowItemEnd
System+Serve

WorkflowItemTask

Log the input text to the

r error

console and the server log with


level 'error'

System+Serve

WorkflowItemTask

Log the input text to the

r error

console and the server log with


level 'error'

checkAndGetP

WorkflowItemTask

em
System+Serve

Scriptable
task

WorkflowItemTask

r error

Log the input text to the


console and the server log with
level 'error'

6.3.8. Source

code for the used actions

6.3.8.1. postDatabag
//Auto generated script, cannot be modified !
actionResult =
System.getModule("com.vmware.pso.chef.ops").postDatabag(chefHostname,orgName) ;

6.3.8.2. Scriptable task


var bodyJS = {};
bodyJS.name = databag;

var body = JSON.stringify(bodyJS);

var result =
System.getModule("com.vmware.pso.chef").executeRequest(chefOp,orgName,userid,pem,body,[]);

var responseJS = JSON.parse(result);

url = responseJS.uri;

Server.log("Successfully added data bag",databag);

vCO Workflow Documentation - Jul 6, 2015

Page

60

Delete Data Bag


System.log("Successfully added data bag: "+databag);

6.3.8.3. System+Server error


//Auto-generated script
System.error(text + " - " + object);
Server.error(text, object);

6.3.8.4. System+Server error


//Auto-generated script
System.error(text + " - " + object);
Server.error(text, object);

6.3.8.5. checkAndGetPem
//Auto generated script, cannot be modified !
actionResult =
System.getModule("com.vmware.pso.chef").checkAndGetPem(pem,configElement,chefHostname,user
id) ;

6.3.8.6. System+Server error


//Auto-generated script
System.error(text + " - " + object);
Server.error(text, object);

6.4.

Delete Data Bag

Deletes a data bag on a Chef Server.

6.4.1. Versions
Version

Date

User

Comment

0.0.1

May 13, 2013

root

works!

0.0.2

May 14, 2013

Dan

doc update

Linsley
0.0.3

May 29, 2013

vCO
Administra
tor

vCO Workflow Documentation - Jul 6, 2015

Page

61

Delete Data Bag


Version

0.0.4

Date

May 29, 2013

User

Comment

vCO
Administra
tor

0.0.5

Jun 3, 2013

Daniel
Linsley

0.0.6

Jun 3, 2013

Daniel
Linsley

0.0.7

Jun 3, 2013

Daniel
Linsley

0.0.8

Jun 3, 2013

Daniel
Linsley

0.0.9

Jun 20, 2013

Daniel
Linsley

0.0.10

Jun 25, 2013

vCO
Administra
tor

0.0.11

Oct 9, 2013

vCO
Administra
tor

0.0.12

Oct 9, 2013

vCO
Administra
tor

0.0.13

Nov 10, 2013

vCO
Administra
tor

0.0.14

Nov 10, 2013

vCO
Administra
tor

0.0.15

Nov 16, 2013

vCO
Administra
tor

vCO Workflow Documentation - Jul 6, 2015

Page

62

Delete Data Bag


Version

0.0.16

Date

User

Jan 2, 2015

Comment

vCO
Administra
tor

0.0.17

Jan 2, 2015

vCO
Administra
tor

Current version:0.0.17

6.4.2. Inputs
Name

Type

Description

chefHostname*

string

userid*

string

orgName*

string

databag*

string

Name of data bag to delete

pem

string

(Optional)

Private key for the

userid client.

The private key

will be looked up in the <b>Chef


Private Keys</b> Configuration
Element otherwise.

*Parameter is mandatory

6.4.3. Attributes
Name

Type

chefOp

REST:RESTOperation

errorCode

string

pemAttr

SecureString

configElement

ConfigurationElemen

Description

6.4.4. Parameter

presentation

vCO Workflow Documentation - Jul 6, 2015

Page

63

Delete Data Bag

Parameter

Description

Parameter Info

chefHostname

chefHostname

Mandatory input: true

userid

userid

Mandatory input: true

orgName

orgName

Mandatory input:
!GetAction("com.vmware.pso.chef.hel
pers","hideOrgName").call(
#chefHostname )

databag

databag

Mandatory input: true

pem

(Optional)

Private

key for the userid


client.

The

private key will be


looked up in the
<b>Chef Private
Keys</b>
Configuration
Element otherwise.

6.4.5. Workflow

schema

6.4.6. Workflow

items

Name

Type

Next item

Description

WorkflowItemEnd

vCO Workflow Documentation - Jul 6, 2015

Page

64

Delete Data Bag


Name

deleteDataba

Type

WorkflowItemTask

g
Scriptable

Next item

Description

checkAndGetP
em

WorkflowItemTask

task
WorkflowItemEnd
System+Serve

WorkflowItemTask

Log the input text to the

r error

console and the server log with


level 'error'

System+Serve

WorkflowItemTask

Log the input text to the

r error

console and the server log with


level 'error'

checkAndGetP

WorkflowItemTask

em
System+Serve

Scriptable
task

WorkflowItemTask

r error

Log the input text to the


console and the server log with
level 'error'

6.4.7. Source

code for the used actions

6.4.7.1. deleteDatabag
//Auto generated script, cannot be modified !
actionResult =
System.getModule("com.vmware.pso.chef.ops").deleteDatabag(chefHostname,orgName) ;

6.4.7.2. Scriptable task


var result =
System.getModule("com.vmware.pso.chef").executeRequest(chefOp,orgName,userid,pem,"",[datab
ag]);

var responseJS = JSON.parse(result);

Server.log("Successfully deleted data bag");


System.log("Successfully deleted data bag");

vCO Workflow Documentation - Jul 6, 2015

Page

65

Delete Data Bag Item

6.4.7.3. System+Server error


//Auto-generated script
System.error(text + " - " + object);
Server.error(text, object);

6.4.7.4. System+Server error


//Auto-generated script
System.error(text + " - " + object);
Server.error(text, object);

6.4.7.5. checkAndGetPem
//Auto generated script, cannot be modified !
actionResult =
System.getModule("com.vmware.pso.chef").checkAndGetPem(pem,configElement,chefHostname,user
id) ;

6.4.7.6. System+Server error


//Auto-generated script
System.error(text + " - " + object);
Server.error(text, object);

6.5.

Delete Data Bag Item

Deletes a Data Bag item on a Chef Server.


attributes for the databag item.

Returns the last defined

6.5.1. Versions
Version

Date

User

Comment

0.0.1

May 13, 2013

root

works!

0.0.2

May 14, 2013

Dan

doc update

Linsley
0.0.3

May 29, 2013

vCO
Administra
tor

0.0.4

May 29, 2013

vCO
Administra
tor

vCO Workflow Documentation - Jul 6, 2015

Page

66

Delete Data Bag Item


Version

0.0.5

Date

Jun 3, 2013

User

Comment

Daniel
Linsley

0.0.6

Jun 3, 2013

Daniel
Linsley

0.0.7

Jun 3, 2013

Daniel
Linsley

0.0.8

Jun 3, 2013

Daniel
Linsley

0.0.9

Jun 3, 2013

Daniel
Linsley

0.0.10

Jun 3, 2013

Daniel
Linsley

0.0.11

Jun 3, 2013

Daniel
Linsley

0.0.12

Jun 20, 2013

Daniel
Linsley

0.0.13

Oct 19, 2013

vCO
Administra
tor

0.0.14

Oct 19, 2013

vCO
Administra
tor

0.0.15

Oct 19, 2013

vCO
Administra
tor

0.0.16

Oct 19, 2013

vCO
Administra
tor

0.0.17

Oct 19, 2013

vCO
Administra
tor

vCO Workflow Documentation - Jul 6, 2015

Page

67

Delete Data Bag Item


Version

0.0.18

Date

User

Nov 11, 2013

Comment

vCO
Administra
tor

0.0.19

Jan 2, 2015

vCO
Administra
tor

Current version:0.0.19

6.5.2. Inputs
Name

Type

chefHostname*

string

userid*

string

orgName*

string

databag*

string

item*

string

pem

string

Description

(Optional)

Private key for the

userid client.

The private key

will be looked up in the <b>Chef


Private Keys</b> Configuration
Element otherwise.

*Parameter is mandatory

6.5.3. Outputs
Name

Type

keys

Array/string

values

Array/string

Description

6.5.4. Attributes
Name

chefOp

Type

Description

REST:RESTOperation

vCO Workflow Documentation - Jul 6, 2015

Page

68

Delete Data Bag Item


Name

Type

Description

errorCode

string

pemAttr

SecureString

configElement

ConfigurationElemen
t

6.5.5. Parameter

presentation

Parameter

Description

Parameter Info

chefHostname

chefHostname

Mandatory input: true

userid

userid

Mandatory input: true

orgName

orgName

Mandatory input:
!GetAction("com.vmware.pso.chef.hel
pers","hideOrgName").call(
#chefHostname )

databag

databag

Mandatory input: true

item

item

Mandatory input: true

pem

(Optional)

Private

key for the userid


client.

The

private key will be


looked up in the
<b>Chef Private
Keys</b>
Configuration
Element otherwise.

6.5.6. Workflow

schema

vCO Workflow Documentation - Jul 6, 2015

Page

69

Delete Data Bag Item

6.5.7. Workflow
Name

items
Type

Next item

Description

WorkflowItemEnd
deleteDataba

WorkflowItemTask

gItem
Scriptable

checkAndGetP
em

WorkflowItemTask

task
WorkflowItemEnd
System+Serve

WorkflowItemTask

Log the input text to the

r error

console and the server log with


level 'error'

System+Serve

WorkflowItemTask

Log the input text to the

r error

console and the server log with


level 'error'

checkAndGetP

WorkflowItemTask

em
System+Serve

Scriptable
task

WorkflowItemTask

r error

Log the input text to the


console and the server log with
level 'error'

vCO Workflow Documentation - Jul 6, 2015

Page

70

Delete Data Bag Item

6.5.8. Source

code for the used actions

6.5.8.1. deleteDatabagItem
//Auto generated script, cannot be modified !
actionResult =
System.getModule("com.vmware.pso.chef.ops").deleteDatabagItem(chefHostname,orgName) ;

6.5.8.2. Scriptable task


var result =
System.getModule("com.vmware.pso.chef").executeRequest(chefOp,orgName,userid,pem,"",[datab
ag,item]);

var responseJS = JSON.parse(result);

var raw_data = responseJS.raw_data;

keys = new Array();


values = new Array();

for (var i in raw_data) {


keys.push(i);
if (raw_data[i].cipher != null) {
System.warn("The value of "+i+" is encrypted");
values.push(null);
} else {
System.debug(i+":"+typeof raw_data[i]);
if (typeof raw_data[i] == "string") {
values.push(raw_data[i]);
} else if (raw_data[i] instanceof Boolean ||
raw_data[i] instanceof Number) {
values.push(raw_data[i].toString());
} else {
values.push(JSON.stringify(raw_data[i]));
}

values.push(raw_data[i].toString());
}
}

6.5.8.3. System+Server error

vCO Workflow Documentation - Jul 6, 2015

Page

71

Delete Data Bag Item Attribute

//Auto-generated script
System.error(text + " - " + object);
Server.error(text, object);

6.5.8.4. System+Server error


//Auto-generated script
System.error(text + " - " + object);
Server.error(text, object);

6.5.8.5. checkAndGetPem
//Auto generated script, cannot be modified !
actionResult =
System.getModule("com.vmware.pso.chef").checkAndGetPem(pem,configElement,chefHostname,user
id) ;

6.5.8.6. System+Server error


//Auto-generated script
System.error(text + " - " + object);
Server.error(text, object);

6.6.

Delete Data Bag Item Attribute

Deletes the value of a single of a Data Bag item attribute on a Chef


Server.
Returns the last value of the attribute before it is deleted.

6.6.1. Versions
Version

Date

User

Comment

0.0.1

May 13, 2013

root

works!

0.0.2

May 14, 2013

Dan

doc update

Linsley
0.0.3

May 29, 2013

vCO
Administra
tor

vCO Workflow Documentation - Jul 6, 2015

Page

72

Delete Data Bag Item Attribute


Version

0.0.4

Date

May 29, 2013

User

Comment

vCO
Administra
tor

0.0.5

Jun 3, 2013

Daniel
Linsley

0.0.6

Jun 3, 2013

Daniel
Linsley

0.0.7

Jun 3, 2013

Daniel
Linsley

0.0.8

Jun 3, 2013

Daniel
Linsley

0.0.9

Jun 3, 2013

Daniel
Linsley

0.0.10

Jun 3, 2013

Daniel
Linsley

0.0.11

Jun 3, 2013

Daniel
Linsley

0.0.12

Jun 20, 2013

Daniel
Linsley

0.0.13

Oct 19, 2013

vCO
Administra
tor

0.0.14

Oct 19, 2013

vCO
Administra
tor

0.0.15

Oct 19, 2013

vCO
Administra
tor

0.0.16

Oct 19, 2013

vCO
Administra
tor

vCO Workflow Documentation - Jul 6, 2015

Page

73

Delete Data Bag Item Attribute


Version

0.0.17

Date

User

Oct 19, 2013

Comment

vCO
Administra
tor

0.0.18

Oct 19, 2013

vCO
Administra
tor

0.0.19

Nov 8, 2013

vCO
Administra
tor

0.0.20

Nov 8, 2013

vCO
Administra
tor

0.0.21

Nov 8, 2013

vCO
Administra
tor

0.0.22

Nov 8, 2013

vCO
Administra
tor

0.0.23

Nov 8, 2013

vCO
Administra
tor

0.0.24

Nov 11, 2013

vCO
Administra
tor

0.0.25

Jul 6, 2015

vCO
Administra
tor

Current version:0.0.25

6.6.2. Inputs
Name

Type

chefHostname*

string

userid*

string

vCO Workflow Documentation - Jul 6, 2015

Description

Page

74

Delete Data Bag Item Attribute


Name

Type

Description

orgName*

string

databag*

string

item*

string

key*

string

attribute key

pem

string

(Optional) Private key for the


userid client.

This private key

will be looked up in the <b>Chef


Private Keys</b> Configuration
Element otherwise.

*Parameter is mandatory

6.6.3. Outputs
Name

Type

value

Description

string

last value of the attribute

6.6.4. Attributes
Name

Type

Description

errorCode

string

pemAttr

SecureString

configElement

ConfigurationElemen
t

chefPutOp

REST:RESTOperation

itemJS

string

6.6.5. Parameter
Parameter

JSON of the Databag Item

presentation
Description

Parameter Info

chefHostname

chefHostname

Mandatory input: true

userid

userid

Mandatory input: true

vCO Workflow Documentation - Jul 6, 2015

Page

75

Delete Data Bag Item Attribute


Parameter

Description

Parameter Info

orgName

orgName

Mandatory input: false

databag

databag

Mandatory input: true

item

item

Mandatory input: true

key

attribute key

Mandatory input: true

pem

(Optional) Private
key for the userid
client.

This

private key will be


looked up in the
<b>Chef Private
Keys</b>
Configuration
Element otherwise.

6.6.6. Workflow

schema

6.6.7. Workflow

items

Name

Type

Next item

Description

WorkflowItemEnd
Scriptable

WorkflowItemTask

task
WorkflowItemEnd

vCO Workflow Documentation - Jul 6, 2015

Page

76

Delete Data Bag Item Attribute


Name

System+Serve

Type

Next item

WorkflowItemTask

Description

Log the input text to the

r error

console and the server log with


level 'error'

System+Serve

WorkflowItemTask

Log the input text to the

r error

console and the server log with


level 'error'

checkAndGetP

WorkflowItemTask

em
System+Serve

Scriptable
task

WorkflowItemTask

Log the input text to the

r error

console and the server log with


level 'error'

putDatabagIt

WorkflowItemTask

em
Get Databag

checkAndGetP
em

WorkflowItemLink

Item

6.6.8. Source

putDatabagIt

Retrieves the keys/values of a

em

Databag item on a Chef Server.

code for the used actions

6.6.8.1. Scriptable task

var itemJSObj = JSON.parse(itemJS);

value = JSON.stringify(itemJSObj[key]);

delete itemJSObj[key];

var body = JSON.stringify(itemJSObj);

var result =
System.getModule("com.vmware.pso.chef").executeRequest(chefPutOp,orgName,userid,pem,body,[
databag,item]);

var responseJS = JSON.parse(result);

6.6.8.2. System+Server error

vCO Workflow Documentation - Jul 6, 2015

Page

77

Get Data Bag Item


//Auto-generated script
System.error(text + " - " + object);
Server.error(text, object);

6.6.8.3. System+Server error


//Auto-generated script
System.error(text + " - " + object);
Server.error(text, object);

6.6.8.4. checkAndGetPem
//Auto generated script, cannot be modified !
actionResult =
System.getModule("com.vmware.pso.chef").checkAndGetPem(pem,configElement,chefHostname,user
id) ;

6.6.8.5. System+Server error


//Auto-generated script
System.error(text + " - " + object);
Server.error(text, object);

6.6.8.6. putDatabagItem
//Auto generated script, cannot be modified !
actionResult =
System.getModule("com.vmware.pso.chef.ops").putDatabagItem(chefHostname,orgName) ;

6.7.

Get Data Bag Item

Retrieves the keys/values of a data bag item on a Chef Server.

6.7.1. Versions
Version

Date

User

Comment

0.0.1

May 13, 2013

root

works!

0.0.2

May 14, 2013

Dan

doc update

Linsley
0.0.3

May 29, 2013

vCO
Administra
tor

vCO Workflow Documentation - Jul 6, 2015

Page

78

Get Data Bag Item


Version

0.0.4

Date

May 29, 2013

User

Comment

vCO
Administra
tor

0.0.5

Jun 3, 2013

Daniel
Linsley

0.0.6

Jun 3, 2013

Daniel
Linsley

0.0.7

Jun 3, 2013

Daniel
Linsley

0.0.8

Jun 3, 2013

Daniel
Linsley

0.0.9

Jun 3, 2013

Daniel
Linsley

0.0.10

Jun 3, 2013

Daniel
Linsley

0.0.11

Jun 3, 2013

Daniel
Linsley

0.0.12

Jun 20, 2013

Daniel
Linsley

0.0.13

Oct 19, 2013

vCO

Convert all values to strings

Administra
tor
0.0.14

Oct 19, 2013

vCO
Administra
tor

0.0.15

Oct 19, 2013

vCO
Administra
tor

0.0.16

Oct 19, 2013

vCO
Administra
tor

vCO Workflow Documentation - Jul 6, 2015

Page

79

Get Data Bag Item


Version

0.0.17

Date

User

Nov 7, 2013

Comment

vCO
Administra
tor

0.0.18

Nov 7, 2013

vCO
Administra
tor

0.0.19

Nov 9, 2013

vCO
Administra
tor

0.0.20

Nov 11, 2013

vCO
Administra
tor

0.0.21

Jan 2, 2015

vCO
Administra
tor

Current version:0.0.21

6.7.2. Inputs
Name

Type

chefHostname*

string

userid*

string

orgName*

string

databag*

string

item*

string

pem

string

Description

(Optional)

Private key for the

userid client.

The private key

will be looked up in the <b>Chef


Private Keys</b> Configuration
Element otherwise.

*Parameter is mandatory

6.7.3. Outputs

vCO Workflow Documentation - Jul 6, 2015

Page

80

Get Data Bag Item

Name

Type

Description

keys

Array/string

Data bag item attribute keys

values

Array/string

Respective data bag item attribute


values

itemJS

string

JSON of the Databag Item

6.7.4. Attributes
Name

Type

Description

chefOp

REST:RESTOperation

errorCode

string

pemAttr

SecureString

configElement

ConfigurationElemen
t

6.7.5. Parameter

presentation

Parameter

Description

Parameter Info

chefHostname

chefHostname

Mandatory input: true

userid

userid

Mandatory input: true

orgName

orgName

Mandatory input:
GetAction("com.vmware.pso.chef.help
ers","hideOrgName").call(
#chefHostname )

databag

databag

Mandatory input: true

item

item

Mandatory input: true

vCO Workflow Documentation - Jul 6, 2015

Page

81

Get Data Bag Item


Parameter

Description

pem

(Optional)

Parameter Info

Private

key for the userid


client.

The

private key will be


looked up in the
<b>Chef Private
Keys</b>
Configuration
Element otherwise.

6.7.6. Workflow

schema

6.7.7. Workflow

items

Name

Type

Next item

Description

WorkflowItemEnd
getDatabagIt

WorkflowItemTask

em
Scriptable

checkAndGetP
em

WorkflowItemTask

task
WorkflowItemEnd
System+Serve

WorkflowItemTask

r error

Log the input text to the


console and the server log with
level 'error'

vCO Workflow Documentation - Jul 6, 2015

Page

82

Get Data Bag Item


Name

System+Serve

Type

Next item

WorkflowItemTask

Description

Log the input text to the

r error

console and the server log with


level 'error'

checkAndGetP

WorkflowItemTask

em

Scriptable
task

System+Serve

WorkflowItemTask

r error

Log the input text to the


console and the server log with
level 'error'

6.7.8. Source

code for the used actions

6.7.8.1. getDatabagItem
//Auto generated script, cannot be modified !
actionResult =
System.getModule("com.vmware.pso.chef.ops").getDatabagItem(chefHostname,orgName) ;

6.7.8.2. Scriptable task


var result =
System.getModule("com.vmware.pso.chef").executeRequest(chefOp,orgName,userid,pem,"",[datab
ag,item]);

var responseJS = JSON.parse(result);


// it was successfully parsed so it is valid JSON
itemJS = result;

keys = new Array();


values = new Array();

for (var i in responseJS) {


keys.push(i);
if (responseJS[i].cipher != null) {
System.warn("The value of "+i+" is encrypted");
values.push(null);
} else {
System.debug(i+":"+typeof responseJS[i]);
if (typeof responseJS[i] == "string") {
values.push(responseJS[i]);
} else if (responseJS[i] instanceof Boolean ||

vCO Workflow Documentation - Jul 6, 2015

Page

83

Get Data Bag Item Attribute


responseJS[i] instanceof Number) {
values.push(responseJS[i].toString());
} else {
values.push(JSON.stringify(responseJS[i]));
}
}
}

6.7.8.3. System+Server error


//Auto-generated script
System.error(text + " - " + object);
Server.error(text, object);

6.7.8.4. System+Server error


//Auto-generated script
System.error(text + " - " + object);
Server.error(text, object);

6.7.8.5. checkAndGetPem
//Auto generated script, cannot be modified !
actionResult =
System.getModule("com.vmware.pso.chef").checkAndGetPem(pem,configElement,chefHostname,user
id) ;

6.7.8.6. System+Server error


//Auto-generated script
System.error(text + " - " + object);
Server.error(text, object);

6.8.

Get Data Bag Item Attribute

Retrieves the value of a single of a Data Bag item attribute on a Chef


Server.

6.8.1. Versions
Version

Date

vCO Workflow Documentation - Jul 6, 2015

User

Comment

Page

84

Get Data Bag Item Attribute


Version

Date

User

Comment

0.0.1

May 13, 2013

root

works!

0.0.2

May 14, 2013

Dan

doc update

Linsley
0.0.3

May 29, 2013

vCO
Administra
tor

0.0.4

May 29, 2013

vCO
Administra
tor

0.0.5

Jun 3, 2013

Daniel
Linsley

0.0.6

Jun 3, 2013

Daniel
Linsley

0.0.7

Jun 3, 2013

Daniel
Linsley

0.0.8

Jun 3, 2013

Daniel
Linsley

0.0.9

Jun 3, 2013

Daniel
Linsley

0.0.10

Jun 3, 2013

Daniel
Linsley

0.0.11

Jun 3, 2013

Daniel
Linsley

0.0.12

Jun 20, 2013

Daniel
Linsley

0.0.13

Oct 19, 2013

vCO
Administra
tor

0.0.14

Oct 19, 2013

vCO
Administra
tor

vCO Workflow Documentation - Jul 6, 2015

Page

85

Get Data Bag Item Attribute


Version

0.0.15

Date

User

Oct 19, 2013

Comment

vCO
Administra
tor

0.0.16

Oct 19, 2013

vCO
Administra
tor

0.0.17

Oct 19, 2013

vCO
Administra
tor

0.0.18

Oct 19, 2013

vCO
Administra
tor

0.0.19

Nov 8, 2013

vCO
Administra
tor

0.0.20

Nov 8, 2013

vCO
Administra
tor

0.0.21

Nov 8, 2013

vCO
Administra
tor

0.0.22

Nov 8, 2013

vCO
Administra
tor

0.0.23

Jan 2, 2015

vCO
Administra
tor

Current version:0.0.23

6.8.2. Inputs
Name

Type

chefHostname*

string

userid*

string

vCO Workflow Documentation - Jul 6, 2015

Description

Page

86

Get Data Bag Item Attribute


Name

Type

Description

orgName*

string

databag*

string

item*

string

key*

string

attribute key

pem

string

(Optional)

Private key for the

userid client.

The private key

will be looked up in the <b>Chef


Private Keys</b> Configuration
Element otherwise.

*Parameter is mandatory

6.8.3. Outputs
Name

Type

value

string

encrypted

boolean

Description

If the attribute is encrypted, use


complementary workflow to read an
encrypted databag item attribute

6.8.4. Attributes
Name

Type

Description

chefOp

REST:RESTOperation

errorCode

string

pemAttr

SecureString

configElement

ConfigurationElemen
t

6.8.5. Parameter
Parameter

chefHostname

presentation
Description

chefHostname

vCO Workflow Documentation - Jul 6, 2015

Parameter Info

Mandatory input: true

Page

87

Get Data Bag Item Attribute


Parameter

Description

Parameter Info

userid

userid

Mandatory input: true

orgName

orgName

Mandatory input:
!GetAction("com.vmware.pso.chef.hel
pers","hideOrgName").call(
#chefHostname )

databag

databag

Mandatory input: true

item

item

Mandatory input: true

key

attribute key

Mandatory input: true

pem

(Optional)

Private

key for the userid


client.

The

private key will be


looked up in the
<b>Chef Private
Keys</b>
Configuration
Element otherwise.

6.8.6. Workflow

schema

6.8.7. Workflow

items

Name

Type

vCO Workflow Documentation - Jul 6, 2015

Next item

Description

Page

88

Get Data Bag Item Attribute


Name

Type

Next item

Description

WorkflowItemEnd
getDatabagIt

WorkflowItemTask

em
Scriptable

checkAndGetP
em

WorkflowItemTask

task
WorkflowItemEnd
System+Serve

WorkflowItemTask

Log the input text to the

r error

console and the server log with


level 'error'

System+Serve

WorkflowItemTask

Log the input text to the

r error

console and the server log with


level 'error'

checkAndGetP

WorkflowItemTask

em
System+Serve

Scriptable
task

WorkflowItemTask

r error

Log the input text to the


console and the server log with
level 'error'

6.8.8. Source

code for the used actions

6.8.8.1. getDatabagItem
//Auto generated script, cannot be modified !
actionResult =
System.getModule("com.vmware.pso.chef.ops").getDatabagItem(chefHostname,orgName) ;

6.8.8.2. Scriptable task


var result =
System.getModule("com.vmware.pso.chef").executeRequest(chefOp,orgName,userid,pem,"",[datab
ag,item]);

var responseJS = JSON.parse(result);

if (responseJS[key] !== undefined) {


if (responseJS[key].cipher != null) {

vCO Workflow Documentation - Jul 6, 2015

Page

89

Get Data Bag Item Attribute


System.warn("The value of "+key+" is encrypted");
encrypted = true;
value = null;
} else {
encrypted = false;
System.debug(key+":"+typeof responseJS[key]);
if (typeof responseJS[key] == "string") {
value = responseJS[key];
} else if (responseJS[key] instanceof Boolean ||
responseJS[key] instanceof Number) {
value = responseJS[key].toString();
} else {
value = JSON.stringify(responseJS[key]);
}
}
} else {
throw ("Could not find attribute "+key);
}

6.8.8.3. System+Server error


//Auto-generated script
System.error(text + " - " + object);
Server.error(text, object);

6.8.8.4. System+Server error


//Auto-generated script
System.error(text + " - " + object);
Server.error(text, object);

6.8.8.5. checkAndGetPem
//Auto generated script, cannot be modified !
actionResult =
System.getModule("com.vmware.pso.chef").checkAndGetPem(pem,configElement,chefHostname,user
id) ;

6.8.8.6. System+Server error


//Auto-generated script
System.error(text + " - " + object);
Server.error(text, object);

vCO Workflow Documentation - Jul 6, 2015

Page

90

Get Data Bag Items

6.9.

Get Data Bag Items

Retrieves a list of items from a data bag on a Chef Server.

6.9.1. Versions
Version

Date

User

Comment

0.0.1

May 13, 2013

root

works!

0.0.2

May 14, 2013

Dan

doc update

Linsley
0.0.3

May 29, 2013

vCO
Administra
tor

0.0.4

May 29, 2013

vCO
Administra
tor

0.0.5

Jun 3, 2013

Daniel
Linsley

0.0.6

Jun 3, 2013

Daniel
Linsley

0.0.7

Jun 3, 2013

Daniel
Linsley

0.0.8

Jun 3, 2013

Daniel
Linsley

0.0.9

Jun 20, 2013

Daniel
Linsley

0.0.10

Oct 9, 2013

vCO
Administra
tor

0.0.11

Nov 9, 2013

vCO
Administra
tor

0.0.12

Nov 11, 2013

vCO
Administra
tor

vCO Workflow Documentation - Jul 6, 2015

Page

91

Get Data Bag Items


Version

0.0.13

Date

User

Jan 2, 2015

Comment

vCO
Administra
tor

Current version:0.0.13

6.9.2. Inputs
Name

chefHostname*

string

userid*

string

orgName*

string

databag*

string

pem

string

Type

Description

Type

Description

*Parameter is mandatory

6.9.3. Outputs
Name

items

Array/string

urls

Array/string

Databag items

6.9.4. Attributes
Name

Type

chefOp

REST:RESTOperation

errorCode

string

pemAttr

SecureString

configElement

ConfigurationElemen

Description

6.9.5. Parameter

presentation

vCO Workflow Documentation - Jul 6, 2015

Page

92

Get Data Bag Items

Parameter

Description

Parameter Info

chefHostname

chefHostname

Mandatory input: true

userid

userid

Mandatory input: true

orgName

orgName

Mandatory input: false

databag

databag

Mandatory input: true

pem

pem

6.9.6. Workflow

schema

6.9.7. Workflow

items

Name

Type

Next item

Description

WorkflowItemEnd
getDatabag

WorkflowItemTask

checkAndGetP
em

Scriptable

WorkflowItemTask

task
WorkflowItemEnd
System+Serve

WorkflowItemTask

r error

Log the input text to the


console and the server log with
level 'error'

vCO Workflow Documentation - Jul 6, 2015

Page

93

Get Data Bag Items


Name

System+Serve

Type

Next item

WorkflowItemTask

Description

Log the input text to the

r error

console and the server log with


level 'error'

checkAndGetP

WorkflowItemTask

em
System+Serve

Scriptable
task

WorkflowItemTask

r error

Log the input text to the


console and the server log with
level 'error'

6.9.8. Source

code for the used actions

6.9.8.1. getDatabag
//Auto generated script, cannot be modified !
actionResult =
System.getModule("com.vmware.pso.chef.ops").getDatabag(chefHostname,orgName) ;

6.9.8.2. Scriptable task


var result =
System.getModule("com.vmware.pso.chef").executeRequest(chefOp,orgName,userid,pem,"",[clien
t]);

var responseJS = JSON.parse(result);

items = new Array();


urls = new Array();

for (var i in responseJS) {


items.push(i);
urls.push(responseJS[i]);
}

6.9.8.3. System+Server error

vCO Workflow Documentation - Jul 6, 2015

Page

94

Get Data Bags


//Auto-generated script
System.error(text + " - " + object);
Server.error(text, object);

6.9.8.4. System+Server error


//Auto-generated script
System.error(text + " - " + object);
Server.error(text, object);

6.9.8.5. checkAndGetPem
//Auto generated script, cannot be modified !
actionResult =
System.getModule("com.vmware.pso.chef").checkAndGetPem(pem,configElement,chefHostname,user
id) ;

6.9.8.6. System+Server error


//Auto-generated script
System.error(text + " - " + object);
Server.error(text, object);

6.10.

Get Data Bags

Returns a list of data bags from a Chef server

6.10.1. Versions
Version

Date

User

Comment

0.0.1

May 13, 2013

root

works!

0.0.2

May 14, 2013

root

Outputs Assigned

0.0.3

May 14, 2013

Dan

doc update

Linsley
0.1.0

May 30, 2013

vCO

add orgName input

Administra
tor
0.1.1

Jun 3, 2013

Daniel
Linsley

0.1.2

Jun 20, 2013

Daniel
Linsley

vCO Workflow Documentation - Jul 6, 2015

Page

95

Get Data Bags


Version

0.1.3

Date

User

Oct 9, 2013

Comment

vCO
Administra
tor

0.1.4

Nov 11, 2013

vCO
Administra
tor

0.1.5

Jan 2, 2015

vCO
Administra
tor

Current version:0.1.5

6.10.2. Inputs
Name

Type

chefHostname*

string

userid*

string

orgName*

string

pem

string

Description

(Optional)

Private key for the

userid client.

The private key

will be looked up in the <b>Chef


Private Keys</b> Configuration
Element otherwise.

*Parameter is mandatory

6.10.3. Outputs
Name

Type

databags

Array/string

urls

Array/string

Description

Names of Databags

6.10.4. Attributes
Name

chefOp

Type

Description

REST:RESTOperation

vCO Workflow Documentation - Jul 6, 2015

Page

96

Get Data Bags


Name

Type

Description

pemAttr

SecureString

errorCode

string

configElement

ConfigurationElemen
t

6.10.5. Parameter
Parameter

presentation
Description

Parameter Info

chefHostname

chefHostname

Mandatory input: true

userid

userid

Mandatory input: true

orgName

orgName

Mandatory input:
!GetAction("com.vmware.pso.chef.hel
pers","hideOrgName").call(
#chefHostname )

pem

(Optional)

Private

key for the userid


client.

The

private key will be


looked up in the
<b>Chef Private
Keys</b>
Configuration
Element otherwise.

6.10.6. Workflow

schema

vCO Workflow Documentation - Jul 6, 2015

Page

97

Get Data Bags

6.10.7. Workflow
Name

items
Type

Next item

Description

WorkflowItemEnd
getDatabags

WorkflowItemTask

checkAndGetP
em

Scriptable

WorkflowItemTask

task
checkAndGetP

WorkflowItemTask

em
System+Serve

Scriptable
task

WorkflowItemTask

Log the input text to the

r error

console and the server log with


level 'error'

System+Serve

WorkflowItemTask

r error

System+Serve

Log the input text to the

r error

console and the server log with


level 'error'

System+Serve

WorkflowItemTask

r error

Log the input text to the


console and the server log with
level 'error'

WorkflowItemEnd

vCO Workflow Documentation - Jul 6, 2015

Page

98

Get Data Bags

6.10.8. Source

code for the used actions

6.10.8.1. getDatabags
//Auto generated script, cannot be modified !
actionResult =
System.getModule("com.vmware.pso.chef.ops").getDatabags(chefHostname,orgName) ;

6.10.8.2. Scriptable task


var result =
System.getModule("com.vmware.pso.chef").executeRequest(chefOp,orgName,userid,pem,"",[]);

var responseJS = JSON.parse(result);

databags = new Array();


urls = new Array();

for(var i in responseJS) {
databags.push(i);
urls.push(responseJS[i]);
}

6.10.8.3. checkAndGetPem
//Auto generated script, cannot be modified !
actionResult =
System.getModule("com.vmware.pso.chef").checkAndGetPem(pem,configElement,chefHostname,user
id) ;

6.10.8.4. System+Server error


//Auto-generated script
System.error(text + " - " + object);
Server.error(text, object);

6.10.8.5. System+Server error


//Auto-generated script
System.error(text + " - " + object);
Server.error(text, object);

vCO Workflow Documentation - Jul 6, 2015

Page

99

Add Encrypted Data Bag Item Attribute

6.10.8.6. System+Server error


//Auto-generated script
System.error(text + " - " + object);
Server.error(text, object);

6.11.

Encryption

Workflows for manipulating encrypted Data Bags on a Chef Server

6.11.1.

Add Encrypted Data Bag Item Attribute

Adds or replaces an encrypted Data Bag Item value to a Chef Server

6.11.1.1. Versions
Version

Date

User

Comment

0.0.1

May 13, 2013

root

works!

0.0.2

May 14, 2013

Dan

doc update

Linsley
0.1.0

May 30, 2013

vCO

add orgName input

Administra
tor
0.1.1

Jun 25, 2013

vCO
Administra
tor

0.1.2

Jun 25, 2013

vCO
Administra
tor

0.1.3

Jun 25, 2013

vCO
Administra
tor

0.1.4

Jun 25, 2013

vCO
Administra
tor

0.1.5

Jun 25, 2013

vCO
Administra
tor

vCO Workflow Documentation - Jul 6, 2015

Page

100

Add Encrypted Data Bag Item Attribute


Version

0.1.6

Date

Jun 25, 2013

User

Comment

vCO
Administra
tor

0.1.7

Oct 9, 2013

vCO
Administra
tor

0.1.8

Oct 9, 2013

vCO
Administra
tor

0.1.9

Oct 19, 2013

vCO
Administra
tor

0.1.10

Oct 19, 2013

vCO
Administra
tor

0.1.11

Oct 19, 2013

vCO
Administra
tor

0.1.12

Oct 30, 2013

vCO
Administra
tor

0.1.13

Oct 30, 2013

vCO
Administra
tor

0.1.14

Nov 8, 2013

vCO
Administra
tor

0.1.15

Nov 8, 2013

vCO
Administra
tor

0.1.16

Nov 8, 2013

vCO
Administra
tor

vCO Workflow Documentation - Jul 6, 2015

Page

101

Add Encrypted Data Bag Item Attribute


Version

0.1.17

Date

User

Nov 9, 2013

Comment

vCO
Administra
tor

0.1.18

Nov 9, 2013

vCO
Administra
tor

0.1.19

Jan 2, 2015

vCO
Administra
tor

Current version:0.1.19

6.11.1.2. Inputs
Name

Type

Description

chefHostname*

string

userid*

string

orgName*

string

databag*

string

Data Bag to add item

item*

string

Name of new data bag item

key*

string

The data bag item attribute key

value*

string

The data bag item attribute value


to be encrypted

encryptionKey*

string

Encryption Key

pem

string

(Optional)

Private key for the

userid client.

The private key

will be looked up in the <b>Chef


Private Keys</b> Configuration
Element otherwise.

*Parameter is mandatory

6.11.1.3. Outputs
Name

vCO Workflow Documentation - Jul 6, 2015

Type

Description

Page

102

Add Encrypted Data Bag Item Attribute


Name

url

Type

Description

Type

Description

string

6.11.1.4. Attributes
Name

chefOp

REST:RESTOperation

errorCode

string

pemAttr

SecureString

configElement

ConfigurationElemen
t

iv

string

encrypted

string

wrappedMessage

string

itemJS

string

6.11.1.5. Parameter
Parameter

JSON of the Databag Item

presentation
Description

Parameter Info

chefHostname

chefHostname

Mandatory input: true

userid

userid

Mandatory input: true

orgName

orgName

Mandatory input:
!GetAction("com.vmware.pso.chef.hel
pers","hideOrgName").call(
#chefHostname )

databag

Data Bag to add

Mandatory input: true

item
item

Name of new data

Mandatory input: true

bag item
key

The data bag item

Mandatory input: true

attribute key

vCO Workflow Documentation - Jul 6, 2015

Page

103

Add Encrypted Data Bag Item Attribute


Parameter

value

Description

Parameter Info

The data bag item

Mandatory input: false

attribute value to
be encrypted
encryptionKey

Encryption Key

pem

(Optional)

Mandatory input: true

Private

key for the userid


client.

The

private key will be


looked up in the
<b>Chef Private
Keys</b>
Configuration
Element otherwise.

6.11.1.6. Workflow

schema

6.11.1.7. Workflow

items

Name

Type

Next item

Description

WorkflowItemEnd
putDatabagIt

WorkflowItemTask

em

vCO Workflow Documentation - Jul 6, 2015

checkAndGetP
em

Page

104

Add Encrypted Data Bag Item Attribute


Name

Put

Type

Next item

Description

WorkflowItemTask

encrypted
value to
Databag
WorkflowItemEnd
System+Serve

WorkflowItemTask

Log the input text to the

r error

console and the server log with


level 'error'

System+Serve

WorkflowItemTask

Log the input text to the

r error

console and the server log with


level 'error'

checkAndGetP

WorkflowItemTask

em
System+Serve

generateRand
omIV

WorkflowItemTask

Log the input text to the

r error

console and the server log with


level 'error'

generateRand

WorkflowItemTask

Wrap Value

omIV
databagEncry

Creates a random initialization


vector encoded in Base64

WorkflowItemTask

ptV1

Put

Encrypts a message for V1 Chef

encrypted

Encrypted Databags.

value to
Databag

Result is the Base64 encoded


encrypted message.

Wrap Value

WorkflowItemTask

databagEncry
ptV1

Get Databag

WorkflowItemLink

Item

6.11.1.8. Source

putDatabagIt

Retrieves the keys/values of a

em

Databag item on a Chef Server.

code for the used actions

6.11.1.8.1. putDatabagItem
//Auto generated script, cannot be modified !
actionResult =
System.getModule("com.vmware.pso.chef.ops").putDatabagItem(chefHostname,orgName) ;

vCO Workflow Documentation - Jul 6, 2015

Page

105

Add Encrypted Data Bag Item Attribute

6.11.1.8.2. Put encrypted value to Databag


var bodyJS = JSON.parse(itemJS);
bodyJS[key] = {};
bodyJS[key].encrypted_data = encrypted;
bodyJS[key].iv = iv;
bodyJS[key].version = 1;
bodyJS[key].cipher = "aes-256-cbc";

var body = JSON.stringify(bodyJS);

var result =
System.getModule("com.vmware.pso.chef").executeRequest(chefOp,orgName,userid,pem,body,[dat
abag,item]);

var responseJS = JSON.parse(result);

Server.log("Successfully updated data bag item", item);


System.log("Successfully updated data bag item: "+item);

6.11.1.8.3. System+Server error


//Auto-generated script
System.error(text + " - " + object);
Server.error(text, object);

6.11.1.8.4. System+Server error


//Auto-generated script
System.error(text + " - " + object);
Server.error(text, object);

6.11.1.8.5. checkAndGetPem
//Auto generated script, cannot be modified !
actionResult =
System.getModule("com.vmware.pso.chef").checkAndGetPem(pem,configElement,chefHostname,user
id) ;

6.11.1.8.6. System+Server error

vCO Workflow Documentation - Jul 6, 2015

Page

106

Decrypt Data Bag Item


//Auto-generated script
System.error(text + " - " + object);
Server.error(text, object);

6.11.1.8.7. generateRandomIV
//Auto generated script, cannot be modified !
actionResult = System.getModule("com.vmware.pso.cryptojs").generateRandomIV() ;

6.11.1.8.8. databagEncryptV1
//Auto generated script, cannot be modified !
actionResult =
System.getModule("com.vmware.pso.chef").databagEncryptV1(message,keyIn,ivIn) ;

6.11.1.8.9. Wrap Value


var obj = {};
obj.json_wrapper = value;
wrappedMessage = JSON.stringify(obj);

6.11.2.

Decrypt Data Bag Item

Converts all of the attributes of an encrypted data bag item to cleartext


on the Chef Server

6.11.2.1. Versions
Version

Date

User

Comment

0.0.1

May 13, 2013

root

works!

0.0.2

May 14, 2013

Dan

doc update

Linsley
0.0.3

May 29, 2013

vCO
Administra
tor

0.0.4

May 29, 2013

vCO
Administra
tor

0.0.5

Jun 3, 2013

Daniel
Linsley

vCO Workflow Documentation - Jul 6, 2015

Page

107

Decrypt Data Bag Item


Version

0.0.6

Date

Jun 3, 2013

User

Comment

Daniel
Linsley

0.0.7

Jun 3, 2013

Daniel
Linsley

0.0.8

Jun 3, 2013

Daniel
Linsley

0.0.9

Jun 3, 2013

Daniel
Linsley

0.0.10

Jun 3, 2013

Daniel
Linsley

0.0.11

Jun 3, 2013

Daniel
Linsley

0.0.12

Jun 20, 2013

Daniel
Linsley

0.0.13

Oct 19, 2013

vCO
Administra
tor

0.0.14

Oct 19, 2013

vCO
Administra
tor

0.0.15

Oct 19, 2013

vCO
Administra
tor

0.0.16

Oct 19, 2013

vCO
Administra
tor

0.0.17

Oct 19, 2013

vCO
Administra
tor

0.0.18

Oct 19, 2013

vCO
Administra
tor

vCO Workflow Documentation - Jul 6, 2015

Page

108

Decrypt Data Bag Item


Version

0.0.19

Date

Nov 8, 2013

User

Comment

vCO
Administra
tor

0.0.20

Nov 8, 2013

vCO
Administra
tor

0.0.21

Nov 8, 2013

vCO
Administra
tor

0.0.22

Nov 8, 2013

vCO
Administra
tor

0.0.23

Nov 9, 2013

vCO
Administra
tor

0.0.24

Nov 9, 2013

vCO
Administra
tor

0.0.25

Nov 9, 2013

vCO
Administra
tor

0.0.26

Nov 9, 2013

vCO
Administra
tor

0.0.27

Nov 16, 2013

vCO
Administra
tor

0.0.28

Nov 16, 2013

vCO
Administra
tor

0.0.29

Nov 16, 2013

vCO
Administra
tor

vCO Workflow Documentation - Jul 6, 2015

Page

109

Decrypt Data Bag Item


Version

0.0.30

Date

User

Nov 16, 2013

Comment

vCO
Administra
tor

0.0.31

Nov 17, 2013

vCO
Administra
tor

0.0.32

Jan 2, 2015

vCO
Administra
tor

Current version:0.0.32

6.11.2.2. Inputs
Name

Type

chefHostname*

string

userid*

string

orgName*

string

databag*

string

item*

string

encryptionKey*

string

pem

string

Description

(Optional)

Private key for the

userid client.

The private key

will be looked up in the <b>Chef


Private Keys</b> Configuration
Element otherwise.

*Parameter is mandatory

6.11.2.3. Attributes
Name

Type

errorCode

string

configElement

ConfigurationElemen

Description

vCO Workflow Documentation - Jul 6, 2015

Page

110

Decrypt Data Bag Item


Name

Type

itemJS

string

counter

number

numberOfAttr

number

key

string

Description

JSON of the Databag Item

Databag Item Attribute Key to get


encrypted value of

keys

Array/string

6.11.2.4. Parameter

presentation

Parameter

Description

Parameter Info

encryptionKey

encryptionKey

Mandatory input: true

chefHostname

chefHostname

Mandatory input: true

userid

userid

Mandatory input: true

orgName

orgName

Mandatory input:
GetAction("com.vmware.pso.chef.help
ers","hideOrgName").call(
#chefHostname )

databag

databag

Mandatory input: true

item

item

Mandatory input: true

pem

(Optional)

Private

key for the userid


client.

The

private key will be


looked up in the
<b>Chef Private
Keys</b>
Configuration
Element otherwise.

6.11.2.5. Workflow

schema

vCO Workflow Documentation - Jul 6, 2015

Page

111

Decrypt Data Bag Item

6.11.2.6. Workflow
Name

Get Data Bag

items

Type

WorkflowItemLink

Item

Next item

Description

Get

Retrieves the keys/values of a

Encrypted

data bag item on a Chef Server.

Attr Keys
Get

WorkflowItemTask

Get next key

Encrypted
Attr Keys
Any More?

WorkflowItemCustom Get next key


Condition
WorkflowItemEnd

Get next key

WorkflowItemTask

Decrypt Data
Bag Item
Attribute

Decrypt Data

WorkflowItemLink

Any More?

Converts a encrypted data bag

Bag Item

item attribute to cleartext on

Attribute

the Chef Server

6.11.2.7. Source

code for the used actions

6.11.2.7.1. Get Encrypted Attr Keys


keys = [];
counter = 0;

vCO Workflow Documentation - Jul 6, 2015

Page

112

Decrypt Data Bag Item Attribute


var item = JSON.parse(itemJS);

for (var i in item) {


if (item[i].cipher != null) {
keys.push(i);
}
}

numberOfAttr = keys.length;

6.11.2.7.2. Any More?


return counter < numberOfAttr;

6.11.2.7.3. Get next key


key = keys[counter];
counter++;

6.11.3.

Decrypt Data Bag Item Attribute

Converts a encrypted data bag item attribute to cleartext on the Chef


Server

6.11.3.1. Versions
Version

Date

User

Comment

0.0.1

May 13, 2013

root

works!

0.0.2

May 14, 2013

Dan

doc update

Linsley
0.0.3

May 29, 2013

vCO
Administra
tor

0.0.4

May 29, 2013

vCO
Administra
tor

0.0.5

Jun 3, 2013

Daniel
Linsley

0.0.6

Jun 3, 2013

Daniel
Linsley

vCO Workflow Documentation - Jul 6, 2015

Page

113

Decrypt Data Bag Item Attribute


Version

0.0.7

Date

Jun 3, 2013

User

Comment

Daniel
Linsley

0.0.8

Jun 3, 2013

Daniel
Linsley

0.0.9

Jun 3, 2013

Daniel
Linsley

0.0.10

Jun 3, 2013

Daniel
Linsley

0.0.11

Jun 3, 2013

Daniel
Linsley

0.0.12

Jun 20, 2013

Daniel
Linsley

0.0.13

Oct 19, 2013

vCO
Administra
tor

0.0.14

Oct 19, 2013

vCO
Administra
tor

0.0.15

Oct 19, 2013

vCO
Administra
tor

0.0.16

Oct 19, 2013

vCO
Administra
tor

0.0.17

Oct 19, 2013

vCO
Administra
tor

0.0.18

Oct 19, 2013

vCO
Administra
tor

0.0.19

Nov 8, 2013

vCO
Administra
tor

vCO Workflow Documentation - Jul 6, 2015

Page

114

Decrypt Data Bag Item Attribute


Version

0.0.20

Date

User

Nov 8, 2013

Comment

vCO
Administra
tor

0.0.21

Nov 8, 2013

vCO
Administra
tor

0.0.22

Nov 8, 2013

vCO
Administra
tor

0.0.23

Nov 9, 2013

vCO
Administra
tor

0.0.24

Nov 9, 2013

vCO
Administra
tor

0.0.25

Nov 9, 2013

vCO
Administra
tor

0.0.26

Nov 9, 2013

vCO
Administra
tor

0.0.27

Jan 2, 2015

vCO
Administra
tor

Current version:0.0.27

6.11.3.2. Inputs
Name

Type

chefHostname*

string

userid*

string

orgName*

string

databag*

string

vCO Workflow Documentation - Jul 6, 2015

Description

Page

115

Decrypt Data Bag Item Attribute


Name

Type

item*

string

key*

string

encryptionKey*

string

pem

string

Description

attribute key

(Optional)

Private key for the

userid client.

The private key

will be looked up in the <b>Chef


Private Keys</b> Configuration
Element otherwise.

*Parameter is mandatory

6.11.3.3. Attributes
Name

Type

Description

errorCode

string

value

string

configElement

ConfigurationElemen
t

6.11.3.4. Parameter
Parameter

presentation
Description

Parameter Info

chefHostname

chefHostname

Mandatory input: true

userid

userid

Mandatory input: true

orgName

orgName

Mandatory input:
!GetAction("com.vmware.pso.chef.hel
pers","hideOrgName").call(
#chefHostname )

databag

databag

Mandatory input: true

item

item

Mandatory input: true

vCO Workflow Documentation - Jul 6, 2015

Page

116

Decrypt Data Bag Item Attribute


Parameter

key

Description

Parameter Info

Mandatory input: true

Data bag Item


Attribute Key to
get encrypted value
of. Only encrypted
data bag item
attributes are
listed.

If the

presentation is
empty the data bag
item does not have
any encrypted
attributes.
encryptionKey

Encryption key to

Mandatory input: true

decrypt encrypted
items.
pem

(Optional)

Private

key for the userid


client.

The

private key will be


looked up in the
<b>Chef Private
Keys</b>
Configuration
Element otherwise.

6.11.3.5. Workflow

schema

6.11.3.6. Workflow

items

Name

Type

vCO Workflow Documentation - Jul 6, 2015

Next item

Description

Page

117

Encrypt Data Bag Item


Name

Get

Type

WorkflowItemLink

Next item

Description

Update

Retrieves the value of an

Encrypted

Databag Item

encrypted databag item

Databag Item

Attribute

attribute.

Value
Currently this workflow only
supports version 1 encrypted
databags.
Update

WorkflowItemLink

Retrieves the value of a single

Databag Item

of a Databag item attribute on a

Attribute

Chef Server.
WorkflowItemEnd

6.11.3.7. Source
6.11.4.

code for the used actions

Encrypt Data Bag Item

Encrypts all attributes of a cleartext data bag item on the Chef Server.
Converts the data bag item from cleartext to encrypted.

6.11.4.1. Versions
Version

Date

User

Comment

0.0.1

May 13, 2013

root

works!

0.0.2

May 14, 2013

Dan

doc update

Linsley
0.0.3

May 29, 2013

vCO
Administra
tor

0.0.4

May 29, 2013

vCO
Administra
tor

0.0.5

Jun 3, 2013

Daniel
Linsley

0.0.6

Jun 3, 2013

Daniel
Linsley

vCO Workflow Documentation - Jul 6, 2015

Page

118

Encrypt Data Bag Item


Version

0.0.7

Date

Jun 3, 2013

User

Comment

Daniel
Linsley

0.0.8

Jun 3, 2013

Daniel
Linsley

0.0.9

Jun 3, 2013

Daniel
Linsley

0.0.10

Jun 3, 2013

Daniel
Linsley

0.0.11

Jun 3, 2013

Daniel
Linsley

0.0.12

Jun 20, 2013

Daniel
Linsley

0.0.13

Oct 19, 2013

vCO
Administra
tor

0.0.14

Oct 19, 2013

vCO
Administra
tor

0.0.15

Oct 19, 2013

vCO
Administra
tor

0.0.16

Oct 19, 2013

vCO
Administra
tor

0.0.17

Oct 19, 2013

vCO
Administra
tor

0.0.18

Oct 19, 2013

vCO
Administra
tor

0.0.19

Nov 8, 2013

vCO
Administra
tor

vCO Workflow Documentation - Jul 6, 2015

Page

119

Encrypt Data Bag Item


Version

0.0.20

Date

Nov 8, 2013

User

Comment

vCO
Administra
tor

0.0.21

Nov 8, 2013

vCO
Administra
tor

0.0.22

Nov 8, 2013

vCO
Administra
tor

0.0.23

Nov 9, 2013

vCO
Administra
tor

0.0.24

Nov 9, 2013

vCO
Administra
tor

0.0.25

Nov 9, 2013

vCO
Administra
tor

0.0.26

Nov 9, 2013

vCO
Administra
tor

0.0.27

Nov 16, 2013

vCO
Administra
tor

0.0.28

Nov 16, 2013

vCO
Administra
tor

0.0.29

Nov 16, 2013

vCO
Administra
tor

0.0.30

Nov 16, 2013

vCO
Administra
tor

vCO Workflow Documentation - Jul 6, 2015

Page

120

Encrypt Data Bag Item


Version

0.0.31

Date

User

Nov 16, 2013

Comment

vCO
Administra
tor

0.0.32

Nov 16, 2013

vCO
Administra
tor

0.0.33

Nov 16, 2013

vCO
Administra
tor

0.0.34

Jan 2, 2015

vCO
Administra
tor

Current version:0.0.34

6.11.4.2. Inputs
Name

Type

chefHostname*

string

userid*

string

orgName*

string

databag*

string

item*

string

encryptionKey*

string

pem

string

Description

(Optional)

Private key for the

userid client.

The private key

will be looked up in the <b>Chef


Private Keys</b> Configuration
Element otherwise.

*Parameter is mandatory

6.11.4.3. Attributes
Name

vCO Workflow Documentation - Jul 6, 2015

Type

Description

Page

121

Encrypt Data Bag Item


Name

Type

configElement

Description

ConfigurationElemen
t

itemJS

string

counter

number

numberOfAttr

number

key

string

JSON of the Databag Item

Databag Item Attribute Key to get


encrypted value of

keys

Array/string

6.11.4.4. Parameter

presentation

Parameter

Description

Parameter Info

chefHostname

chefHostname

Mandatory input: true

userid

userid

Mandatory input: true

orgName

orgName

Mandatory input: false

databag

databag

Mandatory input: true

item

item

Mandatory input: true

encryptionKey

encryptionKey

Mandatory input: true

pem

(Optional)

Private

key for the userid


client.

The

private key will be


looked up in the
<b>Chef Private
Keys</b>
Configuration
Element otherwise.

6.11.4.5. Workflow

schema

vCO Workflow Documentation - Jul 6, 2015

Page

122

Encrypt Data Bag Item

6.11.4.6. Workflow
Name

Get Data Bag

items

Type

WorkflowItemLink

Item
Get Attr

WorkflowItemTask

Next item

Description

Get Attr

Retrieves the keys/values of a

Keys

data bag item on a Chef Server.

Get next key

Keys
Any More?

WorkflowItemCustom Get next key


Condition
WorkflowItemEnd

Get next key

WorkflowItemTask

Encrypt Data
Bag Item
Attribute

Encrypt Data

WorkflowItemLink

Any More?

Converts a cleartext data bag

Bag Item

item attribute to encrypted (v1)

Attribute

on the Chef Server

6.11.4.7. Source

code for the used actions

6.11.4.7.1. Get Attr Keys

vCO Workflow Documentation - Jul 6, 2015

Page

123

Encrypt Data Bag Item Attribute


keys = [];
counter = 0;

var item = JSON.parse(itemJS);

for (var i in item) {


if (i == "id") {
continue;
}
if (item[i].cipher == null) {
keys.push(i);
}
}

numberOfAttr = keys.length;

6.11.4.7.2. Any More?


return counter < numberOfAttr;

6.11.4.7.3. Get next key


key = keys[counter];
counter++;

6.11.5.

Encrypt Data Bag Item Attribute

Converts a cleartext data bag item attribute to encrypted (v1) on the Chef
Server

6.11.5.1. Versions
Version

Date

User

Comment

0.0.1

May 13, 2013

root

works!

0.0.2

May 14, 2013

Dan

doc update

Linsley
0.0.3

May 29, 2013

vCO
Administra
tor

0.0.4

May 29, 2013

vCO
Administra
tor

vCO Workflow Documentation - Jul 6, 2015

Page

124

Encrypt Data Bag Item Attribute


Version

0.0.5

Date

Jun 3, 2013

User

Comment

Daniel
Linsley

0.0.6

Jun 3, 2013

Daniel
Linsley

0.0.7

Jun 3, 2013

Daniel
Linsley

0.0.8

Jun 3, 2013

Daniel
Linsley

0.0.9

Jun 3, 2013

Daniel
Linsley

0.0.10

Jun 3, 2013

Daniel
Linsley

0.0.11

Jun 3, 2013

Daniel
Linsley

0.0.12

Jun 20, 2013

Daniel
Linsley

0.0.13

Oct 19, 2013

vCO
Administra
tor

0.0.14

Oct 19, 2013

vCO
Administra
tor

0.0.15

Oct 19, 2013

vCO
Administra
tor

0.0.16

Oct 19, 2013

vCO
Administra
tor

0.0.17

Oct 19, 2013

vCO
Administra
tor

vCO Workflow Documentation - Jul 6, 2015

Page

125

Encrypt Data Bag Item Attribute


Version

0.0.18

Date

User

Oct 19, 2013

Comment

vCO
Administra
tor

0.0.19

Nov 8, 2013

vCO
Administra
tor

0.0.20

Nov 8, 2013

vCO
Administra
tor

0.0.21

Nov 8, 2013

vCO
Administra
tor

0.0.22

Nov 8, 2013

vCO
Administra
tor

0.0.23

Nov 9, 2013

vCO
Administra
tor

0.0.24

Nov 9, 2013

vCO
Administra
tor

0.0.25

Jan 2, 2015

vCO
Administra
tor

Current version:0.0.25

6.11.5.2. Inputs
Name

Type

chefHostname*

string

userid*

string

orgName*

string

databag*

string

vCO Workflow Documentation - Jul 6, 2015

Description

Page

126

Encrypt Data Bag Item Attribute


Name

Type

item*

string

key*

string

encryptionKey*

string

pem

string

Description

attribute key

(Optional)

Private key for the

userid client.

The private key

will be looked up in the <b>Chef


Private Keys</b> Configuration
Element otherwise.

*Parameter is mandatory

6.11.5.3. Attributes
Name

Type

Description

errorCode

string

value

string

encrypted

boolean

configElement

ConfigurationElemen
t

6.11.5.4. Parameter
Parameter

presentation
Description

Parameter Info

encryptionKey

encryptionKey

Mandatory input: true

chefHostname

chefHostname

Mandatory input: true

userid

userid

Mandatory input: true

orgName

orgName

Mandatory input:
!GetAction("com.vmware.pso.chef.hel
pers","hideOrgName").call(
#chefHostname )

databag

databag

Mandatory input: true

item

item

Mandatory input: true

vCO Workflow Documentation - Jul 6, 2015

Page

127

Encrypt Data Bag Item Attribute


Parameter

Description

key

attribute key

pem

(Optional)

Parameter Info

Mandatory input: true

Private

key for the userid


client.

The

private key will be


looked up in the
<b>Chef Private
Keys</b>
Configuration
Element otherwise.

6.11.5.5. Workflow

schema

6.11.5.6. Workflow

items

Name

Type

Next item

Description

WorkflowItemEnd
Get Databag

WorkflowItemLink

Item
Attribute
Add

Not

Retrieves the value of a single

Encrypted?

of a Databag item attribute on a


Chef Server.

WorkflowItemLink

Encrypted

Adds a new encrypted Databag


Item value to a Chef Server

Databag Item
Attribute

vCO Workflow Documentation - Jul 6, 2015

Page

128

Get Encrypted Data Bag Item Attribute


Name

Type

Next item

Not

WorkflowItemGeneri Add

Encrypted?

cCondition

Description

Encrypted
Databag Item
Attribute

WorkflowItemEnd
Throw Error

WorkflowItemTask

6.11.5.7. Source

code for the used actions

6.11.5.7.1. Not Encrypted?


//Generated by the system, cannot be edited
return (encrypted == false) ;

6.11.5.7.2. Throw Error


throw("Data Bag Item Attribute is already encrypted");

6.11.6.

Get Encrypted Data Bag Item Attribute

Retrieves the value of an encrypted data bag item attribute.


Currently this workflow only supports version 1 encrypted data bags.

6.11.6.1. Versions
Version

Date

User

Comment

0.0.1

May 13, 2013

root

works!

0.0.2

May 14, 2013

Dan

doc update

Linsley
0.0.3

May 29, 2013

vCO
Administra
tor

0.0.4

May 29, 2013

vCO
Administra
tor

0.0.5

Jun 3, 2013

Daniel
Linsley

vCO Workflow Documentation - Jul 6, 2015

Page

129

Get Encrypted Data Bag Item Attribute


Version

0.0.6

Date

Jun 3, 2013

User

Comment

Daniel
Linsley

0.0.7

Jun 3, 2013

Daniel
Linsley

0.0.8

Jun 3, 2013

Daniel
Linsley

0.0.9

Jun 3, 2013

Daniel
Linsley

0.0.10

Jun 3, 2013

Daniel
Linsley

0.0.11

Jun 3, 2013

Daniel
Linsley

0.0.12

Jun 3, 2013

Daniel
Linsley

0.0.13

Jun 3, 2013

Daniel
Linsley

0.0.14

Jun 3, 2013

Daniel
Linsley

0.0.15

Jun 17, 2013

Daniel
Linsley

0.0.16

Jun 24, 2013

vCO
Administra
tor

0.0.17

Jun 24, 2013

vCO
Administra
tor

0.0.18

Jun 24, 2013

vCO
Administra
tor

0.0.19

Jun 24, 2013

vCO
Administra
tor

vCO Workflow Documentation - Jul 6, 2015

Page

130

Get Encrypted Data Bag Item Attribute


Version

0.0.20

Date

User

Aug 25, 2013

Comment

vCO
Administra
tor

0.0.21

Nov 8, 2013

vCO
Administra
tor

0.0.22

Nov 8, 2013

vCO
Administra
tor

0.0.23

Nov 9, 2013

vCO
Administra
tor

0.0.24

Nov 10, 2013

vCO
Administra
tor

0.0.25

Nov 10, 2013

vCO
Administra
tor

0.0.26

Jan 2, 2015

vCO
Administra
tor

Current version:0.0.26

6.11.6.2. Inputs
Name

Type

chefHostname*

string

userid*

string

orgName*

string

databag*

string

item*

string

key*

string

Description

Data Bag Item Attribute Key to get


encrypted value of

vCO Workflow Documentation - Jul 6, 2015

Page

131

Get Encrypted Data Bag Item Attribute


Name

Type

encryptionKey*

Description

string

Encryption key to decrypt encrypted


items.

pem

string

(Optional)

Private key for the

userid client.

The private key

will be looked up in the <b>Chef


Private Keys</b> Configuration
Element otherwise.

*Parameter is mandatory

6.11.6.3. Outputs
Name

value

Type

Description

Type

Description

string

6.11.6.4. Attributes
Name

chefOp

REST:RESTOperation

errorCode

string

pemAttr

SecureString

configElement

ConfigurationElemen
t

encValue

string

iv

string

6.11.6.5. Parameter
Parameter

presentation
Description

Parameter Info

chefHostname

chefHostname

Mandatory input: true

userid

userid

Mandatory input: true

vCO Workflow Documentation - Jul 6, 2015

Page

132

Get Encrypted Data Bag Item Attribute


Parameter

Description

Parameter Info

orgName

orgName

Mandatory input:
!GetAction("com.vmware.pso.chef.hel
pers","hideOrgName").call(
#chefHostname )

databag

databag

Mandatory input: true

item

item

Mandatory input: true

key

Data bag Item

Mandatory input: true

Attribute Key to
get encrypted value
of. Only encrypted
data bag item
attributes are
listed.

If the

presentation is
empty the data bag
item does not have
any encrypted
attributes.
encryptionKey

Encryption key to

Mandatory input: true

decrypt encrypted
items.
pem

(Optional)

Private

key for the userid


client.

The

private key will be


looked up in the
<b>Chef Private
Keys</b>
Configuration
Element otherwise.

6.11.6.6. Workflow

schema

vCO Workflow Documentation - Jul 6, 2015

Page

133

Get Encrypted Data Bag Item Attribute

6.11.6.7. Workflow
Name

items

Type

Next item

Description

WorkflowItemEnd
getDatabagIt

WorkflowItemTask

em
Get

checkAndGetP
em

WorkflowItemTask

Encrypted

databagDecry
ptV1

value
WorkflowItemEnd
System+Serve

WorkflowItemTask

Log the input text to the

r error

console and the server log with


level 'error'

System+Serve

WorkflowItemTask

Log the input text to the

r error

console and the server log with


level 'error'

checkAndGetP

WorkflowItemTask

em

Get
Encrypted
value

vCO Workflow Documentation - Jul 6, 2015

Page

134

Get Encrypted Data Bag Item Attribute


Name

System+Serve

Type

Next item

WorkflowItemTask

r error

Description

Log the input text to the


console and the server log with
level 'error'

databagDecry

WorkflowItemTask

ptV1
System+Serve

WorkflowItemTask

r error

Log the input text to the


console and the server log with
level 'error'

6.11.6.8. Source

code for the used actions

6.11.6.8.1. getDatabagItem
//Auto generated script, cannot be modified !
actionResult =
System.getModule("com.vmware.pso.chef.ops").getDatabagItem(chefHostname,orgName) ;

6.11.6.8.2. Get Encrypted value


var result =
System.getModule("com.vmware.pso.chef").executeRequest(chefOp,orgName,userid,pem,"",[datab
ag,item]);

var responseJS = JSON.parse(result);

if (responseJS[key] == null) {
throw(key + " is not an attribute key in "+databag+"/"+item);
}

if (responseJS[key].cipher == null) {
throw("The value of "+key +" is not encrypted");

} else if (responseJS[key].version === 1) {


encValue = responseJS[key].encrypted_data;
iv = responseJS[key].iv;
} else {
throw ("Unsupported encryption version: "+responseJS[key].version);
}

vCO Workflow Documentation - Jul 6, 2015

Page

135

Get Encrypted Data Bag Item Attribute

6.11.6.8.3. System+Server error


//Auto-generated script
System.error(text + " - " + object);
Server.error(text, object);

6.11.6.8.4. System+Server error


//Auto-generated script
System.error(text + " - " + object);
Server.error(text, object);

6.11.6.8.5. checkAndGetPem
//Auto generated script, cannot be modified !
actionResult =
System.getModule("com.vmware.pso.chef").checkAndGetPem(pem,configElement,chefHostname,user
id) ;

6.11.6.8.6. System+Server error


//Auto-generated script
System.error(text + " - " + object);
Server.error(text, object);

6.11.6.8.7. databagDecryptV1
//Auto generated script, cannot be modified !
actionResult =
System.getModule("com.vmware.pso.chef").databagDecryptV1(encryptedMessage,keyIn,ivIn) ;

6.11.6.8.8. System+Server error


//Auto-generated script
System.error(text + " - " + object);
Server.error(text, object);

7.

Environments

Workflows for manipulating Enviroments on a Chef Server

vCO Workflow Documentation - Jul 6, 2015

Page

136

Add New Environment

7.1.

Add New Environment

Simply adds a new environment to a Chef Server.

7.1.1. Versions
Version

Date

User

Comment

0.0.1

May 13, 2013

root

works!

0.0.2

May 14, 2013

Dan

doc update

Linsley
0.1.0

May 30, 2013

vCO

added orgName input

Administra
tor
0.1.1

Jun 20, 2013

Daniel
Linsley

0.1.2

Jun 20, 2013

Daniel
Linsley

0.1.3

Oct 9, 2013

vCO
Administra
tor

0.1.4

Oct 9, 2013

vCO
Administra
tor

0.1.5

Jan 2, 2015

vCO
Administra
tor

Current version:0.1.5

7.1.2. Inputs
Name

Type

chefHostname*

string

userid*

string

orgName*

string

vCO Workflow Documentation - Jul 6, 2015

Description

Page

137

Add New Environment


Name

Type

environment*

string

description

string

pem

string

Description

Name of new environment

(Optional)

Private key for the

userid client.

The private key

will be looked up in the <b>Chef


Private Keys</b> Configuration
Element otherwise.

*Parameter is mandatory

7.1.3. Outputs
Name

url

Type

Description

Type

Description

string

7.1.4. Attributes
Name

chefOp

REST:RESTOperation

errorCode

string

pemAttr

SecureString

configElement

ConfigurationElemen
t

7.1.5. Parameter
Parameter

presentation
Description

Parameter Info

chefHostname

chefHostname

Mandatory input: true

userid

userid

Mandatory input: true

orgName

orgName

Mandatory input:
!GetAction("com.vmware.pso.chef.hel
pers","hideOrgName").call(
#chefHostname )

vCO Workflow Documentation - Jul 6, 2015

Page

138

Add New Environment


Parameter

Description

environment

Parameter Info

Mandatory input: true

Name of new
environment

description

description

pem

(Optional)

Private

key for the userid


client.

The

private key will be


looked up in the
<b>Chef Private
Keys</b>
Configuration
Element otherwise.

7.1.6. Workflow

schema

7.1.7. Workflow

items

Name

Type

Next item

Description

WorkflowItemEnd
postEnvironm

WorkflowItemTask

ent
Scriptable

checkAndGetP
em

WorkflowItemTask

task

vCO Workflow Documentation - Jul 6, 2015

Page

139

Add New Environment


Name

Type

Next item

Description

WorkflowItemEnd
System+Serve

WorkflowItemTask

Log the input text to the

r error

console and the server log with


level 'error'

System+Serve

WorkflowItemTask

Log the input text to the

r error

console and the server log with


level 'error'

checkAndGetP

WorkflowItemTask

em
System+Serve

Scriptable
task

WorkflowItemTask

r error

Log the input text to the


console and the server log with
level 'error'

7.1.8. Source

code for the used actions

7.1.8.1. postEnvironment
//Auto generated script, cannot be modified !
actionResult =
System.getModule("com.vmware.pso.chef.ops").postEnvironment(chefHostname,orgName) ;

7.1.8.2. Scriptable task


var bodyJS = {};
bodyJS.name = environment;
bodyJS.description = description;

var body = JSON.stringify(bodyJS);

var result =
System.getModule("com.vmware.pso.chef").executeRequest(chefOp,orgName,userid,pem,body,[]);

var responseJS = JSON.parse(result);

url = responseJS.uri;
Server.log("Successfully added environment",environment);
System.log("Successfully added environment: "+environment);

vCO Workflow Documentation - Jul 6, 2015

Page

140

Get Environment Details

7.1.8.3. System+Server error


//Auto-generated script
System.error(text + " - " + object);
Server.error(text, object);

7.1.8.4. System+Server error


//Auto-generated script
System.error(text + " - " + object);
Server.error(text, object);

7.1.8.5. checkAndGetPem
//Auto generated script, cannot be modified !
actionResult =
System.getModule("com.vmware.pso.chef").checkAndGetPem(pem,configElement,chefHostname,user
id) ;

7.1.8.6. System+Server error


//Auto-generated script
System.error(text + " - " + object);
Server.error(text, object);

7.2.

Get Environment Details

Retrieves details of a particular environment on a Chef Server.

7.2.1. Versions
Version

Date

User

Comment

0.0.1

May 13, 2013

root

works!

0.0.2

May 14, 2013

Dan

doc update

Linsley
0.0.3

May 29, 2013

vCO
Administra
tor

0.0.4

May 29, 2013

vCO
Administra
tor

vCO Workflow Documentation - Jul 6, 2015

Page

141

Get Environment Details


Version

Date

0.0.5

User

May 31, 2013

Comment

Daniel
Linsley

0.0.6

May 31, 2013

Daniel
Linsley

0.0.7

May 31, 2013

Daniel
Linsley

0.0.8

Jun 3, 2013

Daniel
Linsley

0.0.9

Jun 3, 2013

Daniel
Linsley

0.0.10

Jun 20, 2013

Daniel
Linsley

0.0.11

Oct 9, 2013

vCO
Administra
tor

0.0.12

Jan 2, 2015

vCO
Administra
tor

Current version:0.0.12

7.2.2. Inputs
Name

Type

Description

chefHostname*

string

userid*

string

orgName*

string

environment*

string

Name of Environment

pem

string

(Optional)

Private key for the

userid client.

The private key

will be looked up in the <b>Chef


Private Keys</b> Configuration
Element otherwise.

vCO Workflow Documentation - Jul 6, 2015

Page

142

Get Environment Details


*Parameter is mandatory

7.2.3. Outputs
Name

chef_type

string

json_class

string

name

string

cookbook_versions

string

default_attributes

string

override_attributes

string

description

string

Type

Description

Type

Description

7.2.4. Attributes
Name

chefOp

REST:RESTOperation

errorCode

string

pemAttr

SecureString

configElement

ConfigurationElemen
t

7.2.5. Parameter
Parameter

presentation
Description

Parameter Info

chefHostname

chefHostname

Mandatory input: true

userid

userid

Mandatory input: true

orgName

orgName

Mandatory input:
!GetAction("com.vmware.pso.chef.hel
pers","hideOrgName").call(
#chefHostname )

vCO Workflow Documentation - Jul 6, 2015

Page

143

Get Environment Details


Parameter

Description

Parameter Info

environment

Name of Environment Mandatory input: true

pem

(Optional)

Private

key for the userid


client.

The

private key will be


looked up in the
<b>Chef Private
Keys</b>
Configuration
Element otherwise.

7.2.6. Workflow

schema

7.2.7. Workflow

items

Name

Type

Next item

Description

WorkflowItemEnd
getEnvironme

WorkflowItemTask

nt
Scriptable

checkAndGetP
em

WorkflowItemTask

task
WorkflowItemEnd

vCO Workflow Documentation - Jul 6, 2015

Page

144

Get Environment Details


Name

System+Serve

Type

Next item

WorkflowItemTask

Description

Log the input text to the

r error

console and the server log with


level 'error'

System+Serve

WorkflowItemTask

Log the input text to the

r error

console and the server log with


level 'error'

checkAndGetP

WorkflowItemTask

em
System+Serve

Scriptable
task

WorkflowItemTask

r error

Log the input text to the


console and the server log with
level 'error'

7.2.8. Source

code for the used actions

7.2.8.1. getEnvironment
//Auto generated script, cannot be modified !
actionResult =
System.getModule("com.vmware.pso.chef.ops").getEnvironment(chefHostname,orgName) ;

7.2.8.2. Scriptable task


var result =
System.getModule("com.vmware.pso.chef").executeRequest(chefOp,orgName,userid,pem,"",[envir
onment]);

var responseJS = JSON.parse(result);

chef_type = responseJS.chef_type;
json_class = responseJS.json_class;
name = responseJS.name;
description = responseJS.description;
cookbook_versions = JSON.stringify(responseJS.cookbook_versions);
default_attributes = JSON.stringify(responseJS.default_attributes);
override_attributes = JSON.stringify(responseJS.override_attributes);

vCO Workflow Documentation - Jul 6, 2015

Page

145

Get Environments

7.2.8.3. System+Server error


//Auto-generated script
System.error(text + " - " + object);
Server.error(text, object);

7.2.8.4. System+Server error


//Auto-generated script
System.error(text + " - " + object);
Server.error(text, object);

7.2.8.5. checkAndGetPem
//Auto generated script, cannot be modified !
actionResult =
System.getModule("com.vmware.pso.chef").checkAndGetPem(pem,configElement,chefHostname,user
id) ;

7.2.8.6. System+Server error


//Auto-generated script
System.error(text + " - " + object);
Server.error(text, object);

7.3.

Get Environments

Returns a list of environments from Chef server

7.3.1. Versions
Version

Date

User

Comment

0.0.1

May 13, 2013

root

works!

0.0.2

May 14, 2013

root

Outputs Assigned

0.0.3

May 14, 2013

Dan

doc update

Linsley
0.1.0

May 30, 2013

vCO

add orgName input

Administra
tor
0.1.1

May 31, 2013

Daniel
Linsley

vCO Workflow Documentation - Jul 6, 2015

Page

146

Get Environments
Version

Date

0.1.2

User

Jun 3, 2013

Comment

Daniel
Linsley

0.1.3

Jan 2, 2015

vCO
Administra
tor

Current version:0.1.3

7.3.2. Inputs
Name

Type

chefHostname*

string

userid*

string

orgName*

string

pem

string

Description

(Optional)

Private key for the

userid client.

The private key

will be looked up in the <b>Chef


Private Keys</b> Configuration
Element otherwise.

*Parameter is mandatory

7.3.3. Outputs
Name

Type

environments

Array/string

urls

Array/string

Description

7.3.4. Attributes
Name

Type

chefOp

REST:RESTOperation

pemAttr

SecureString

errorCode

string

vCO Workflow Documentation - Jul 6, 2015

Description

Page

147

Get Environments
Name

Type

configElement

Description

ConfigurationElemen
t

7.3.5. Parameter
Parameter

presentation
Description

Parameter Info

chefHostname

chefHostname

Mandatory input: true

userid

userid

Mandatory input: true

orgName

orgName

Mandatory input:
!GetAction("com.vmware.pso.chef.hel
pers","hideOrgName").call(
#chefHostname )

pem

(Optional)

Private

key for the userid


client.

The

private key will be


looked up in the
<b>Chef Private
Keys</b>
Configuration
Element otherwise.

7.3.6. Workflow

schema

vCO Workflow Documentation - Jul 6, 2015

Page

148

Get Environments

7.3.7. Workflow
Name

items
Type

Next item

Description

WorkflowItemEnd
getEnvironme

WorkflowItemTask

nts
Scriptable

checkAndGetP
em

WorkflowItemTask

task
checkAndGetP

WorkflowItemTask

em
System+Serve

Scriptable
task

WorkflowItemTask

Log the input text to the

r error

console and the server log with


level 'error'

System+Serve

WorkflowItemTask

r error

System+Serve

Log the input text to the

r error

console and the server log with


level 'error'

System+Serve

WorkflowItemTask

r error

Log the input text to the


console and the server log with
level 'error'

WorkflowItemEnd

7.3.8. Source

code for the used actions

7.3.8.1. getEnvironments
//Auto generated script, cannot be modified !
actionResult =
System.getModule("com.vmware.pso.chef.ops").getEnvironments(chefHostname,orgName) ;

7.3.8.2. Scriptable task


var result =
System.getModule("com.vmware.pso.chef").executeRequest(chefOp,orgName,userid,pem,"",[]);

var responseJS = JSON.parse(result);

environments = new Array();

vCO Workflow Documentation - Jul 6, 2015

Page

149

Get Environments
urls = new Array();

for(var i in responseJS) {
environments.push(i);
urls.push(responseJS[i]);
}

7.3.8.3. checkAndGetPem
//Auto generated script, cannot be modified !
actionResult =
System.getModule("com.vmware.pso.chef").checkAndGetPem(pem,configElement,chefHostname,user
id) ;

7.3.8.4. System+Server error


//Auto-generated script
System.error(text + " - " + object);
Server.error(text, object);

7.3.8.5. System+Server error


//Auto-generated script
System.error(text + " - " + object);
Server.error(text, object);

7.3.8.6. System+Server error


//Auto-generated script
System.error(text + " - " + object);
Server.error(text, object);

8.

Global

Workflows for creating / deleting / managing Organizations and Users for


non opensource chef servers.
All of these workflows run as the pivotal user. As such, the pem of the
pivotal user of the server needs to be add to the Chef Private Keys config
item or supplied as a workflow input.
The pivotal.pem file is typically found in the /etc/opscode folder of the
Chef server.

vCO Workflow Documentation - Jul 6, 2015

Page

150

Add Organization

Organizations

8.1.
8.1.1.

Add Organization

Adds a new API client to a Chef server


Returns the private and public keys for the new client.
The private key will only be returned this one time.
the server.

It is not stored on

8.1.1.1. Versions
Version

0.0.1

Date

User

Apr 9, 2015

Comment

vCO
Administra
tor

0.0.2

Apr 9, 2015

vCO
Administra
tor

0.0.3

Apr 9, 2015

vCO
Administra
tor

0.0.4

Apr 9, 2015

vCO
Administra
tor

Current version:0.0.4

8.1.1.2. Inputs
Name

Type

chefHostname*

string

pem

string

Description

(Optional)

Private key for the

pivotal client.

The private key

will be looked up in the <b>Chef


Private Keys</b> Configuration
Element otherwise.

vCO Workflow Documentation - Jul 6, 2015

Page

151

Add Organization
Name

orgName*

Type

string

Description

The organization name used by the


api.

Must begin with a lower-case

letter or digit, may only contain


lower-case letters, digits,
hyphens, and underscores, and must
be between 1 and 255 characters
fullName*

string

Full descriptive name for new


Organization

addValidatorConfig

boolean

Add Validator Key to Chef Private


Keys config item?

*Parameter is mandatory

8.1.1.3. Outputs
Name

url

string

validatorClient

string

validatorPem

string

Type

Description

Type

Description

8.1.1.4. Attributes
Name

chefOp

REST:RESTOperation

errorCode

string

pemAttr

SecureString

configElement

ConfigurationElemen
t

userid

8.1.1.5. Parameter
Parameter

string

presentation
Description

vCO Workflow Documentation - Jul 6, 2015

Parameter Info

Page

152

Add Organization
Parameter

Description

Parameter Info

chefHostname

pem

(Optional)

Mandatory input: true

chefHostname

Private

key for the userid


client.

The

private key will be


looked up in the
<b>Chef Private
Keys</b>
Configuration
Element otherwise.
orgName

orgName

Mandatory input: true

fullName

Full descriptive

Mandatory input: true

name for new


Organization
addValidatorConfig

Add Validator Key


to <b>Chef Private
Keys</b> config
item?

8.1.1.6. Workflow

schema

8.1.1.7. Workflow

items

Name

Type

vCO Workflow Documentation - Jul 6, 2015

Next item

Description

Page

153

Add Organization
Name

Type

Next item

Description

WorkflowItemEnd
postOrganiza

WorkflowItemTask

tions
Create Org

checkAndGetP
em

WorkflowItemTask
WorkflowItemEnd

System+Serve

WorkflowItemTask

Log the input text to the

r error

console and the server log with


level 'error'

System+Serve

WorkflowItemTask

Log the input text to the

r error

console and the server log with


level 'error'

checkAndGetP

WorkflowItemTask

Create Org

em
System+Serve

WorkflowItemTask

r error

Log the input text to the


console and the server log with
level 'error'

8.1.1.8. Source

code for the used actions

8.1.1.8.1. postOrganizations
//Auto generated script, cannot be modified !
actionResult = System.getModule("com.vmware.pso.chef.ops").postOrganizations(chefHostname)
;

8.1.1.8.2. Create Org


var bodyJS = {};
bodyJS.name = orgName;
bodyJS.full_name = fullName;

var body = JSON.stringify(bodyJS);

var result =
System.getModule("com.vmware.pso.chef").executeRequest(chefOp,null,userid,pem,body,[]);

vCO Workflow Documentation - Jul 6, 2015

Page

154

Delete Organization
var responseJS = JSON.parse(result);

url = responseJS.uri;
validatorClient = responseJS.clientname;
validatorPem = responseJS.private_key;

Server.log("Successfully added org",orgName);


System.log("Successfully added org: "+orgName);

if (addValidatorConfig) {
configElement.setAttributeWithKey(chefHostname+':'+validatorClient,validatorPem);
System.log("Succesfully set private key to config",validatorClient);
Server.log("Succesfully set private key to config for "+validatorClient);
}

8.1.1.8.3. System+Server error


//Auto-generated script
System.error(text + " - " + object);
Server.error(text, object);

8.1.1.8.4. System+Server error


//Auto-generated script
System.error(text + " - " + object);
Server.error(text, object);

8.1.1.8.5. checkAndGetPem
//Auto generated script, cannot be modified !
actionResult =
System.getModule("com.vmware.pso.chef").checkAndGetPem(pem,configElement,chefHostname,user
id) ;

8.1.1.8.6. System+Server error


//Auto-generated script
System.error(text + " - " + object);
Server.error(text, object);

8.1.2.

Delete Organization

Adds a new API client to a Chef server


Returns the private and public keys for the new client.

vCO Workflow Documentation - Jul 6, 2015

Page

155

Delete Organization
The private key will only be returned this one time.
the server.

It is not stored on

8.1.2.1. Versions
Version

0.0.1

Date

User

Apr 9, 2015

Comment

vCO
Administra
tor

0.0.2

Apr 9, 2015

vCO
Administra
tor

Current version:0.0.2

8.1.2.2. Inputs
Name

Type

chefHostname*

string

pem

string

Description

(Optional)

Private key for the

pivotal client.

The private key

will be looked up in the <b>Chef


Private Keys</b> Configuration
Element otherwise.
orgName*

string

The organization name used by the


api.

Must begin with a lower-case

letter or digit, may only contain


lower-case letters, digits,
hyphens, and underscores, and must
be between 1 and 255 characters

*Parameter is mandatory

8.1.2.3. Attributes
Name

Type

chefOp

REST:RESTOperation

errorCode

string

pemAttr

SecureString

vCO Workflow Documentation - Jul 6, 2015

Description

Page

156

Delete Organization
Name

Type

configElement

Description

ConfigurationElemen
t

userid

string

8.1.2.4. Parameter

presentation

Parameter

Description

Parameter Info

chefHostname

pem

(Optional)

Mandatory input: true

chefHostname

Private

key for the userid


client.

The

private key will be


looked up in the
<b>Chef Private
Keys</b>
Configuration
Element otherwise.
orgName

orgName

8.1.2.5. Workflow

schema

8.1.2.6. Workflow

items

Name

Type

vCO Workflow Documentation - Jul 6, 2015

Mandatory input: true

Next item

Description

Page

157

Delete Organization
Name

Type

Next item

Description

WorkflowItemEnd
deleteOrgani

WorkflowItemTask

zation
Delete Org

checkAndGetP
em

WorkflowItemTask
WorkflowItemEnd

System+Serve

WorkflowItemTask

Log the input text to the

r error

console and the server log with


level 'error'

System+Serve

WorkflowItemTask

Log the input text to the

r error

console and the server log with


level 'error'

checkAndGetP

WorkflowItemTask

Delete Org

em
System+Serve

WorkflowItemTask

r error

Log the input text to the


console and the server log with
level 'error'

8.1.2.7. Source

code for the used actions

8.1.2.7.1. deleteOrganization
//Auto generated script, cannot be modified !
actionResult =
System.getModule("com.vmware.pso.chef.ops").deleteOrganization(chefHostname) ;

8.1.2.7.2. Delete Org


var result =
System.getModule("com.vmware.pso.chef").executeRequest(chefOp,null,userid,pem,"",[orgName]
);

var responseJS = JSON.parse(result);

Server.log("Successfully deleted org",orgName);


System.log("Successfully deleted org: "+orgName);

vCO Workflow Documentation - Jul 6, 2015

Page

158

Get Organization Details

8.1.2.7.3. System+Server error


//Auto-generated script
System.error(text + " - " + object);
Server.error(text, object);

8.1.2.7.4. System+Server error


//Auto-generated script
System.error(text + " - " + object);
Server.error(text, object);

8.1.2.7.5. checkAndGetPem
//Auto generated script, cannot be modified !
actionResult =
System.getModule("com.vmware.pso.chef").checkAndGetPem(pem,configElement,chefHostname,user
id) ;

8.1.2.7.6. System+Server error


//Auto-generated script
System.error(text + " - " + object);
Server.error(text, object);

8.1.3.

Get Organization Details

Adds a new API client to a Chef server


Returns the private and public keys for the new client.
The private key will only be returned this one time.
the server.

It is not stored on

8.1.3.1. Versions
Version

0.0.1

Date

Apr 10, 2015

User

Comment

vCO
Administra
tor

Current version:0.0.1

vCO Workflow Documentation - Jul 6, 2015

Page

159

Get Organization Details

8.1.3.2. Inputs
Name

Type

chefHostname*

string

pem

string

Description

(Optional)

Private key for the

pivotal client.

The private key

will be looked up in the <b>Chef


Private Keys</b> Configuration
Element otherwise.
orgName*

string

The organization name used by the


api.

Must begin with a lower-case

letter or digit, may only contain


lower-case letters, digits,
hyphens, and underscores, and must
be between 1 and 255 characters

*Parameter is mandatory

8.1.3.3. Attributes
Name

Type

Description

chefOp

REST:RESTOperation

errorCode

string

pemAttr

SecureString

configElement

ConfigurationElemen
t

userid

string

8.1.3.4. Parameter
Parameter

chefHostname

presentation
Description

chefHostname

vCO Workflow Documentation - Jul 6, 2015

Parameter Info

Mandatory input: true

Page

160

Get Organization Details


Parameter

pem

Description

(Optional)

Parameter Info

Private

key for the userid


client.

The

private key will be


looked up in the
<b>Chef Private
Keys</b>
Configuration
Element otherwise.
orgName

Mandatory input: true

orgName

8.1.3.5. Workflow

schema

8.1.3.6. Workflow

items

Name

Type

Next item

Description

WorkflowItemEnd
getOrganizat

WorkflowItemTask

ion
Get Org

checkAndGetP
em

WorkflowItemTask
WorkflowItemEnd

vCO Workflow Documentation - Jul 6, 2015

Page

161

Get Organization Details


Name

System+Serve

Type

Next item

WorkflowItemTask

Description

Log the input text to the

r error

console and the server log with


level 'error'

System+Serve

WorkflowItemTask

Log the input text to the

r error

console and the server log with


level 'error'

checkAndGetP

WorkflowItemTask

Get Org

em
System+Serve

WorkflowItemTask

r error

Log the input text to the


console and the server log with
level 'error'

8.1.3.7. Source

code for the used actions

8.1.3.7.1. getOrganization
//Auto generated script, cannot be modified !
actionResult = System.getModule("com.vmware.pso.chef.ops").getOrganization(chefHostname) ;

8.1.3.7.2. Get Org


var result =
System.getModule("com.vmware.pso.chef").executeRequest(chefOp,null,userid,pem,"",[orgName]
);

var responseJS = JSON.parse(result);

8.1.3.7.3. System+Server error


//Auto-generated script
System.error(text + " - " + object);
Server.error(text, object);

8.1.3.7.4. System+Server error


//Auto-generated script
System.error(text + " - " + object);
Server.error(text, object);

vCO Workflow Documentation - Jul 6, 2015

Page

162

Get Organizations

8.1.3.7.5. checkAndGetPem
//Auto generated script, cannot be modified !
actionResult =
System.getModule("com.vmware.pso.chef").checkAndGetPem(pem,configElement,chefHostname,user
id) ;

8.1.3.7.6. System+Server error


//Auto-generated script
System.error(text + " - " + object);
Server.error(text, object);

8.1.4.

Get Organizations

Returns a list of nodes from Chef server

8.1.4.1. Versions
Version

0.0.1

Date

User

Apr 4, 2015

Comment

vCO
Administra
tor

0.0.2

Apr 4, 2015

vCO
Administra
tor

0.0.3

Apr 9, 2015

vCO
Administra
tor

Current version:0.0.3

8.1.4.2. Inputs
Name

Type

chefHostname*

string

pem

string

Description

(Optional)

Private key for the

pivotal user.

The private key will

be looked up in the <b>Chef Private


Keys</b> Configuration Element
otherwise.

vCO Workflow Documentation - Jul 6, 2015

Page

163

Get Organizations
*Parameter is mandatory

8.1.4.3. Outputs
Name

Type

urls

Array/string

orgs

Array/string

Description

Node URLs

8.1.4.4. Attributes
Name

Type

Description

chefOp

REST:RESTOperation

errorCode

string

configElement

ConfigurationElemen
t

pemAttr

SecureString

userid

string

8.1.4.5. Parameter
Parameter

presentation
Description

Parameter Info

chefHostname

pem

(Optional)

Mandatory input: true

chefHostname

Private

key for the pivotal


user.

The private

key will be looked


up in the <b>Chef
Private Keys</b>
Configuration
Element otherwise.

8.1.4.6. Workflow

schema

vCO Workflow Documentation - Jul 6, 2015

Page

164

Get Organizations

8.1.4.7. Workflow
Name

items
Type

Next item

Description

WorkflowItemEnd
getOrganizat

WorkflowItemTask

ions
Scriptable

checkAndGetP
em

WorkflowItemTask

task
checkAndGetP

WorkflowItemTask

em
System+Serve

Scriptable
task

WorkflowItemTask

r error

Log the input text to the


console and the server log with
level 'error'

System+Serve

WorkflowItemTask

r error

Log the input text to the


console and the server log with
level 'error'

System+Serve

WorkflowItemTask

r error

Log the input text to the


console and the server log with
level 'error'

WorkflowItemEnd

8.1.4.8. Source

code for the used actions

vCO Workflow Documentation - Jul 6, 2015

Page

165

Get Organizations

8.1.4.8.1. getOrganizations
//Auto generated script, cannot be modified !
actionResult = System.getModule("com.vmware.pso.chef.ops").getOrganizations(chefHostname)
;

8.1.4.8.2. Scriptable task


var result =
System.getModule("com.vmware.pso.chef").executeRequest(chefOp,null,userid,pem,"",[]);

System.log(result);
var responseJS = JSON.parse(result);

orgs = new Array();


urls = new Array();

for(var i in responseJS) {
orgs.push(i);
urls.push(responseJS[i]);
}

8.1.4.8.3. checkAndGetPem
//Auto generated script, cannot be modified !
actionResult =
System.getModule("com.vmware.pso.chef").checkAndGetPem(pem,configElement,chefHostname,user
id) ;

8.1.4.8.4. System+Server error


//Auto-generated script
System.error(text + " - " + object);
Server.error(text, object);

8.1.4.8.5. System+Server error


//Auto-generated script
System.error(text + " - " + object);
Server.error(text, object);

vCO Workflow Documentation - Jul 6, 2015

Page

166

Add User

8.1.4.8.6. System+Server error


//Auto-generated script
System.error(text + " - " + object);
Server.error(text, object);

Users

8.2.
8.2.1.

Add User

Adds a new API client to a Chef server


Returns the private and public keys for the new client.
The private key will only be returned this one time.
the server.

It is not stored on

8.2.1.1. Versions
Version

0.0.1

Date

User

Apr 10, 2015

Comment

vCO
Administra
tor

0.0.2

Apr 10, 2015

vCO
Administra
tor

0.0.3

Apr 10, 2015

vCO
Administra
tor

Current version:0.0.3

8.2.1.2. Inputs
Name

Type

chefHostname*

string

pem

string

Description

(Optional)

Private key for the

pivotal client.

The private key

will be looked up in the <b>Chef


Private Keys</b> Configuration
Element otherwise.

vCO Workflow Documentation - Jul 6, 2015

Page

167

Add User
Name

userName*

Type

string

Description

The organization name used by the


api.

Must begin with a lower-case

letter or digit, may only contain


lower-case letters, digits,
hyphens, and underscores, and must
be between 1 and 255 characters
firstName*

string

Full descriptive name for new


Organization

lastName*

string

email*

string

password*

SecureString

*Parameter is mandatory

8.2.1.3. Outputs
Name

url

string

userPem

string

Type

Description

Type

Description

8.2.1.4. Attributes
Name

chefOp

REST:RESTOperation

errorCode

string

pemAttr

SecureString

configElement

ConfigurationElemen
t

userid

8.2.1.5. Parameter
Parameter

string

presentation
Description

vCO Workflow Documentation - Jul 6, 2015

Parameter Info

Page

168

Add User
Parameter

Description

Parameter Info

chefHostname

pem

(Optional)

Mandatory input: true

chefHostname

Private

key for the userid


client.

The

private key will be


looked up in the
<b>Chef Private
Keys</b>
Configuration
Element otherwise.
userName

Username

Mandatory input: true

firstName

First Name

Mandatory input: true

lastName

Last Name

Mandatory input: true

email

email

Mandatory input: true

password

password

Mandatory input: true

8.2.1.6. Workflow

schema

8.2.1.7. Workflow

items

Name

Type

Next item

Description

WorkflowItemEnd

vCO Workflow Documentation - Jul 6, 2015

Page

169

Add User
Name

postUsers

Type

WorkflowItemTask

Next item

Description

checkAndGetP
em

Add User

WorkflowItemTask
WorkflowItemEnd

System+Serve

WorkflowItemTask

Log the input text to the

r error

console and the server log with


level 'error'

System+Serve

WorkflowItemTask

Log the input text to the

r error

console and the server log with


level 'error'

checkAndGetP

WorkflowItemTask

Add User

em
System+Serve

WorkflowItemTask

r error

Log the input text to the


console and the server log with
level 'error'

8.2.1.8. Source

code for the used actions

8.2.1.8.1. postUsers
//Auto generated script, cannot be modified !
actionResult = System.getModule("com.vmware.pso.chef.ops").postUsers(chefHostname) ;

8.2.1.8.2. Add User


var bodyJS = {};
bodyJS.username = userName;
bodyJS.first_name = firstName;
bodyJS.middle_name = "";
bodyJS.last_name = lastName;
bodyJS.display_name = [firstName,lastName].join(' ');
bodyJS.email = email;
bodyJS.password = password;

var body = JSON.stringify(bodyJS);

var result =

vCO Workflow Documentation - Jul 6, 2015

Page

170

Delete User
System.getModule("com.vmware.pso.chef").executeRequest(chefOp,null,userid,pem,body,[]);

var responseJS = JSON.parse(result);

url = responseJS.uri;
userPem = responseJS.private_key;

Server.log("Successfully added user",userName);


System.log("Successfully added user: "+userName);

8.2.1.8.3. System+Server error


//Auto-generated script
System.error(text + " - " + object);
Server.error(text, object);

8.2.1.8.4. System+Server error


//Auto-generated script
System.error(text + " - " + object);
Server.error(text, object);

8.2.1.8.5. checkAndGetPem
//Auto generated script, cannot be modified !
actionResult =
System.getModule("com.vmware.pso.chef").checkAndGetPem(pem,configElement,chefHostname,user
id) ;

8.2.1.8.6. System+Server error


//Auto-generated script
System.error(text + " - " + object);
Server.error(text, object);

8.2.2.

Delete User

Adds a new API client to a Chef server


Returns the private and public keys for the new client.
The private key will only be returned this one time.
the server.

vCO Workflow Documentation - Jul 6, 2015

It is not stored on

Page

171

Delete User

8.2.2.1. Versions
Version

Date

0.0.1

User

Apr 10, 2015

Comment

vCO
Administra
tor

Current version:0.0.1

8.2.2.2. Inputs
Name

Type

chefHostname*

string

pem

string

Description

(Optional)

Private key for the

pivotal client.

The private key

will be looked up in the <b>Chef


Private Keys</b> Configuration
Element otherwise.
userName*

string

The organization name used by the


api.

Must begin with a lower-case

letter or digit, may only contain


lower-case letters, digits,
hyphens, and underscores, and must
be between 1 and 255 characters

*Parameter is mandatory

8.2.2.3. Outputs
Name

firstName

string

lastName

string

displayName

string

email

string

Type

Description

Type

Description

8.2.2.4. Attributes
Name

vCO Workflow Documentation - Jul 6, 2015

Page

172

Delete User
Name

Type

Description

chefOp

REST:RESTOperation

errorCode

string

pemAttr

SecureString

configElement

ConfigurationElemen
t

userid

string

8.2.2.5. Parameter
Parameter

presentation
Description

Parameter Info

chefHostname

pem

(Optional)

Mandatory input: true

chefHostname

Private

key for the userid


client.

The

private key will be


looked up in the
<b>Chef Private
Keys</b>
Configuration
Element otherwise.
userName

Username

8.2.2.6. Workflow

Mandatory input: true

schema

vCO Workflow Documentation - Jul 6, 2015

Page

173

Delete User

8.2.2.7. Workflow
Name

items
Type

Next item

Description

WorkflowItemEnd
deleteUser

WorkflowItemTask

checkAndGetP
em

Delete User

WorkflowItemTask
WorkflowItemEnd

System+Serve

WorkflowItemTask

Log the input text to the

r error

console and the server log with


level 'error'

System+Serve

WorkflowItemTask

Log the input text to the

r error

console and the server log with


level 'error'

checkAndGetP

WorkflowItemTask

Delete User

em
System+Serve

WorkflowItemTask

r error

Log the input text to the


console and the server log with
level 'error'

8.2.2.8. Source

code for the used actions

vCO Workflow Documentation - Jul 6, 2015

Page

174

Delete User

8.2.2.8.1. deleteUser
//Auto generated script, cannot be modified !
actionResult = System.getModule("com.vmware.pso.chef.ops").deleteUser(chefHostname) ;

8.2.2.8.2. Delete User


var result =
System.getModule("com.vmware.pso.chef").executeRequest(chefOp,null,userid,pem,"",[userName
]);

var responseJS = JSON.parse(result);

firstName = responseJS.first_name;
lastName = responseJS.last_name;
displayName = responseJS.display_name;
email = responseJS.email;

System.log("Successfully deleted user: "+userName);


Server.log("Successfully deleted user",userName);

8.2.2.8.3. System+Server error


//Auto-generated script
System.error(text + " - " + object);
Server.error(text, object);

8.2.2.8.4. System+Server error


//Auto-generated script
System.error(text + " - " + object);
Server.error(text, object);

8.2.2.8.5. checkAndGetPem
//Auto generated script, cannot be modified !
actionResult =
System.getModule("com.vmware.pso.chef").checkAndGetPem(pem,configElement,chefHostname,user
id) ;

8.2.2.8.6. System+Server error

vCO Workflow Documentation - Jul 6, 2015

Page

175

Get User Details

//Auto-generated script
System.error(text + " - " + object);
Server.error(text, object);

8.2.3.

Get User Details

Adds a new API client to a Chef server


Returns the private and public keys for the new client.
The private key will only be returned this one time.
the server.

It is not stored on

8.2.3.1. Versions
Version

0.0.1

Date

User

Apr 10, 2015

Comment

vCO
Administra
tor

0.0.2

Apr 10, 2015

vCO
Administra
tor

0.0.3

Apr 10, 2015

vCO
Administra
tor

Current version:0.0.3

8.2.3.2. Inputs
Name

Type

chefHostname*

string

pem

string

Description

(Optional)

Private key for the

pivotal client.

The private key

will be looked up in the <b>Chef


Private Keys</b> Configuration
Element otherwise.

vCO Workflow Documentation - Jul 6, 2015

Page

176

Get User Details


Name

Type

userName*

Description

string

The organization name used by the


api.

Must begin with a lower-case

letter or digit, may only contain


lower-case letters, digits,
hyphens, and underscores, and must
be between 1 and 255 characters

*Parameter is mandatory

8.2.3.3. Outputs
Name

userPublicKey

string

firstName

string

lastName

string

displayName

string

email

string

Type

Description

Type

Description

8.2.3.4. Attributes
Name

chefOp

REST:RESTOperation

errorCode

string

pemAttr

SecureString

configElement

ConfigurationElemen
t

userid

string

8.2.3.5. Parameter
Parameter

chefHostname

presentation
Description

chefHostname

vCO Workflow Documentation - Jul 6, 2015

Parameter Info

Mandatory input: true

Page

177

Get User Details


Parameter

pem

Description

(Optional)

Parameter Info

Private

key for the userid


client.

The

private key will be


looked up in the
<b>Chef Private
Keys</b>
Configuration
Element otherwise.
userName

Mandatory input: true

Username

8.2.3.6. Workflow

schema

8.2.3.7. Workflow

items

Name

Type

Next item

Description

WorkflowItemEnd
getUser

WorkflowItemTask

checkAndGetP
em

Get User

WorkflowItemTask
WorkflowItemEnd

vCO Workflow Documentation - Jul 6, 2015

Page

178

Get User Details


Name

System+Serve

Type

Next item

WorkflowItemTask

Description

Log the input text to the

r error

console and the server log with


level 'error'

System+Serve

WorkflowItemTask

Log the input text to the

r error

console and the server log with


level 'error'

checkAndGetP

WorkflowItemTask

Get User

em
System+Serve

WorkflowItemTask

r error

Log the input text to the


console and the server log with
level 'error'

8.2.3.8. Source

code for the used actions

8.2.3.8.1. getUser
//Auto generated script, cannot be modified !
actionResult = System.getModule("com.vmware.pso.chef.ops").getUser(chefHostname) ;

8.2.3.8.2. Get User


var result =
System.getModule("com.vmware.pso.chef").executeRequest(chefOp,null,userid,pem,"",[userName
]);

var responseJS = JSON.parse(result);

userPublicKey = responseJS.public_key;
firstName = responseJS.first_name;
lastName = responseJS.last_name;
displayName = responseJS.display_name;
email = responseJS.email;

8.2.3.8.3. System+Server error


//Auto-generated script
System.error(text + " - " + object);
Server.error(text, object);

vCO Workflow Documentation - Jul 6, 2015

Page

179

Get Users

8.2.3.8.4. System+Server error


//Auto-generated script
System.error(text + " - " + object);
Server.error(text, object);

8.2.3.8.5. checkAndGetPem
//Auto generated script, cannot be modified !
actionResult =
System.getModule("com.vmware.pso.chef").checkAndGetPem(pem,configElement,chefHostname,user
id) ;

8.2.3.8.6. System+Server error


//Auto-generated script
System.error(text + " - " + object);
Server.error(text, object);

8.2.4.

Get Users

Returns a list of nodes from Chef server

8.2.4.1. Versions
Version

0.0.1

Date

User

Apr 4, 2015

Comment

vCO
Administra
tor

Current version:0.0.1

8.2.4.2. Inputs
Name

Type

chefHostname*

string

pem

string

Description

(Optional)

Private key for the

pivotal user.

The private key will

be looked up in the <b>Chef Private


Keys</b> Configuration Element
otherwise.

vCO Workflow Documentation - Jul 6, 2015

Page

180

Get Users
*Parameter is mandatory

8.2.4.3. Outputs
Name

Type

urls

Array/string

users

Array/string

Description

Node URLs

8.2.4.4. Attributes
Name

Type

Description

chefOp

REST:RESTOperation

errorCode

string

configElement

ConfigurationElemen
t

pemAttr

SecureString

userid

string

8.2.4.5. Parameter
Parameter

presentation
Description

Parameter Info

chefHostname

pem

(Optional)

Mandatory input: true

chefHostname

Private

key for the pivotal


user.

The private

key will be looked


up in the <b>Chef
Private Keys</b>
Configuration
Element otherwise.

8.2.4.6. Workflow

schema

vCO Workflow Documentation - Jul 6, 2015

Page

181

Get Users

8.2.4.7. Workflow
Name

items
Type

Next item

Description

WorkflowItemEnd
getUsers

WorkflowItemTask

checkAndGetP
em

Scriptable

WorkflowItemTask

task
checkAndGetP

WorkflowItemTask

em
System+Serve

Scriptable
task

WorkflowItemTask

r error

Log the input text to the


console and the server log with
level 'error'

System+Serve

WorkflowItemTask

r error

Log the input text to the


console and the server log with
level 'error'

System+Serve

WorkflowItemTask

r error

Log the input text to the


console and the server log with
level 'error'

WorkflowItemEnd

8.2.4.8. Source

code for the used actions

vCO Workflow Documentation - Jul 6, 2015

Page

182

Get Users

8.2.4.8.1. getUsers
//Auto generated script, cannot be modified !
actionResult = System.getModule("com.vmware.pso.chef.ops").getUsers(chefHostname) ;

8.2.4.8.2. Scriptable task


var result =
System.getModule("com.vmware.pso.chef").executeRequest(chefOp,null,userid,pem,"",[]);

var responseJS = JSON.parse(result);

users = new Array();


urls = new Array();

for(var i in responseJS) {
users.push(i);
urls.push(responseJS[i]);
}

8.2.4.8.3. checkAndGetPem
//Auto generated script, cannot be modified !
actionResult =
System.getModule("com.vmware.pso.chef").checkAndGetPem(pem,configElement,chefHostname,user
id) ;

8.2.4.8.4. System+Server error


//Auto-generated script
System.error(text + " - " + object);
Server.error(text, object);

8.2.4.8.5. System+Server error


//Auto-generated script
System.error(text + " - " + object);
Server.error(text, object);

8.2.4.8.6. System+Server error

vCO Workflow Documentation - Jul 6, 2015

Page

183

Update User
//Auto-generated script
System.error(text + " - " + object);
Server.error(text, object);

8.2.5.

Update User

Adds a new API client to a Chef server


Returns the private and public keys for the new client.
The private key will only be returned this one time.
the server.

It is not stored on

8.2.5.1. Versions
Version

0.0.1

Date

User

Apr 10, 2015

Comment

vCO
Administra
tor

0.0.2

Apr 10, 2015

vCO
Administra
tor

0.0.3

Apr 10, 2015

vCO
Administra
tor

0.0.4

Apr 10, 2015

vCO
Administra
tor

Current version:0.0.4

8.2.5.2. Inputs
Name

Type

chefHostname*

string

pem

string

Description

(Optional)

Private key for the

pivotal client.

The private key

will be looked up in the <b>Chef


Private Keys</b> Configuration
Element otherwise.
userName*

string

vCO Workflow Documentation - Jul 6, 2015

Username

Page

184

Update User
Name

Type

Description

firstName*

string

First name of user

lastName*

string

Last name of user

email*

string

Email of user

password*

SecureString

Password of user

resetKey

boolean

Reset user's Private Key?

*Parameter is mandatory

8.2.5.3. Outputs
Name

url

string

userPem

string

Type

Description

Type

Description

8.2.5.4. Attributes
Name

chefOp

REST:RESTOperation

errorCode

string

pemAttr

SecureString

configElement

ConfigurationElemen
t

userid

string

firstNameAttr

string

lastNameAttr

string

displayNameAttr

string

emailAttr

string

8.2.5.5. Parameter

presentation

vCO Workflow Documentation - Jul 6, 2015

Page

185

Update User
Parameter

Description

Parameter Info

chefHostname

pem

(Optional)

Mandatory input: true

chefHostname

Private

key for the userid


client.

The

private key will be


looked up in the
<b>Chef Private
Keys</b>
Configuration
Element otherwise.
userName

Username

Mandatory input: true

firstName

First Name

Mandatory input: false

lastName

Last Name

Mandatory input: false

email

email

Mandatory input: false

password

password

Mandatory input: false

resetKey

Reset user's
Private Key?

8.2.5.6. Workflow

schema

8.2.5.7. Workflow

items

Name

Type

vCO Workflow Documentation - Jul 6, 2015

Next item

Description

Page

186

Update User
Name

Type

Next item

Description

WorkflowItemEnd
putUser

WorkflowItemTask

checkAndGetP
em

Change User

WorkflowItemTask
WorkflowItemEnd

System+Serve

WorkflowItemTask

Log the input text to the

r error

console and the server log with


level 'error'

System+Serve

WorkflowItemTask

Log the input text to the

r error

console and the server log with


level 'error'

checkAndGetP

WorkflowItemTask

Change User

em
System+Serve

WorkflowItemTask

Log the input text to the

r error

console and the server log with


level 'error'

Get User

WorkflowItemLink

putUser

Details

Adds a new API client to a Chef


server
Returns the private and public
keys for the new client.
The private key will only be
returned this one time.

It is

not stored on the server.

8.2.5.8. Source

code for the used actions

8.2.5.8.1. putUser
//Auto generated script, cannot be modified !
actionResult = System.getModule("com.vmware.pso.chef.ops").putUser(chefHostname) ;

8.2.5.8.2. Change User

vCO Workflow Documentation - Jul 6, 2015

Page

187

Update User
var bodyJS = {};
bodyJS.username = userName;
if (firstName != null && firstName.length > 0) {
firstNameAttr = firstName;
}
bodyJS.first_name = firstNameAttr;
if (lastName != null && lastName.length > 0) {
lastNameAttr = lastName;
}
bodyJS.last_name = lastNameAttr;
bodyJS.display_name = [firstNameAttr,lastNameAttr].join(' ');

if (email != null && email.length > 0) {


emailAttr = email;
}
bodyJS.email = emailAttr;

if (password != null && password.length > 0) {


bodyJS.password = password;
}
if (resetKey) {
bodyJS.private_key = true;
}
var body = JSON.stringify(bodyJS);
var result =
System.getModule("com.vmware.pso.chef").executeRequest(chefOp,null,userid,pem,body,[userNa
me]);

var responseJS = JSON.parse(result);

url = responseJS.uri;
userPem = responseJS.private_key;

Server.log("Successfully updated user",userName);


System.log("Successfully updated user: "+userName);

8.2.5.8.3. System+Server error


//Auto-generated script
System.error(text + " - " + object);
Server.error(text, object);

8.2.5.8.4. System+Server error

vCO Workflow Documentation - Jul 6, 2015

Page

188

Run Multiple Commands in Guest

//Auto-generated script
System.error(text + " - " + object);
Server.error(text, object);

8.2.5.8.5. checkAndGetPem
//Auto generated script, cannot be modified !
actionResult =
System.getModule("com.vmware.pso.chef").checkAndGetPem(pem,configElement,chefHostname,user
id) ;

8.2.5.8.6. System+Server error


//Auto-generated script
System.error(text + " - " + object);
Server.error(text, object);

Helpers

9.
9.1.

Run Multiple Commands in Guest

9.1.1. Versions
Version

Date

0.0.1

User

Dec 12, 2014

Comment

vCO
Administra
tor

Current version:0.0.1

9.1.2. Inputs
Name

Type

Description

commands

Array/string

scriptType

string

bash / bat / powershell

password

SecureString

Guest OS password

username

string

Guest OS username

vm

VC:VirtualMachine

Virtual Machine (VC)

vCO Workflow Documentation - Jul 6, 2015

Page

189

Run Multiple Commands in Guest

9.1.3. Outputs
Name

Type

scriptOutputTexts

Array/string

scriptExitCodes

Array/number

Description

9.1.4. Attributes
Name

Type

Description

scriptOutputText

string

Output of the script

scriptExitCode

number

Exit code of the script

outputTexts

Array/string

exitCodes

Array/number

commandCounter

number

command

string

interactiveSession

boolean

Script context interactivity

scriptRefreshTime

number

(default) Time (in seconds) where a


check of script status occurs

scriptTimeout

number

Timeout for the running script (in


second)

toolsReady

boolean

retries

number

retryLimit

number

sleepTime

number

errorCode

string

9.1.5. Parameter
Parameter

commands

presentation
Description

Parameter Info

commands

vCO Workflow Documentation - Jul 6, 2015

Page

190

Run Multiple Commands in Guest


Parameter

scriptType

Description

Parameter Info

bash / bat /
powershell

password

Guest OS password

username

Guest OS username

vm

Virtual Machine
(VC)

9.1.6. Workflow

schema

9.1.7. Workflow

items

Name

Type

vCO Workflow Documentation - Jul 6, 2015

Next item

Description

Page

191

Run Multiple Commands in Guest


Name

Run Script

Type

WorkflowItemLink

In Guest

Next item

Description

Append

Run a script inside the VM and

Outputs

wait until it returns his


result.
Retrieve the output of the
script and returns it as output
in the workflow
Inspired by implementation done
in PowerCLI in the following
.NET class :
VMware.VimAutomation.ViCore.Impl
.V1.RunScriptInGuestHelper
VMware.VimAutomation.ViCore.Impl
.V1.Service.VmGuestServiceImpl
Requires running VMwareTools
instance in the GuestOS.
Leverages the vSphere 5.x
GuestOperationsManager object
and is not backwards compatible
with previous versions of
vSphere.

testVmToolsF

WorkflowItemTask

Tools Ready?

orGuestOps
Tools Ready?

WorkflowItemGeneri Any More?


cCondition

Retry?

WorkflowItemTask

testVmToolsF
orGuestOps

WorkflowItemEnd
Get Next

WorkflowItemTask

Command
Any More?

Run Script
In Guest

WorkflowItemCustom Get Next


Condition

Command

WorkflowItemEnd

vCO Workflow Documentation - Jul 6, 2015

Page

192

Run Multiple Commands in Guest


Name

Append

Type

WorkflowItemTask

Outputs
Increase

Next item

Description

Increase
counter

WorkflowItemTask

Any More?

Increment a counter by one

counter
Set Outputs

WorkflowItemTask

9.1.8. Source

code for the used actions

9.1.8.1. testVmToolsForGuestOps
//Auto generated script, cannot be modified !
actionResult = System.getModule("com.vmware.pso.GuestOps").testVmToolsForGuestOps(vm) ;

9.1.8.2. Tools Ready?


//Generated by the system, cannot be edited
return (toolsReady == true) ;

9.1.8.3. Retry?
if (retries < retryLimit) {
System.sleep(sleepTime);
retries = retries + 1;
} else {
throw("Retries exceeded retry limit");
}

9.1.8.4. Get Next Command


command = commands[commandCounter];

9.1.8.5. Any More?


return (commandCounter < commands.length);

9.1.8.6. Append Outputs


if (outputTexts == null) {
outputTexts = [];

vCO Workflow Documentation - Jul 6, 2015

Page

193

Write Many Files to Guest


}
if (exitCodes == null) {
exitCodes = [];
}
outputTexts.push(scriptOutputText);
exitCodes.push(scriptExitCode);

9.1.8.7. Increase counter


//Auto-generated script
counter = counter+1;

9.1.8.8. Set Outputs


scriptOutputTexts = outputTexts;
scriptExitCodes = exitCodes;

9.2.

Write Many Files to Guest

9.2.1. Versions
Version

Date

0.0.1

User

Dec 12, 2014

Comment

vCO
Administra
tor

0.0.2

Dec 12, 2014

vCO
Administra
tor

Current version:0.0.2

9.2.2. Inputs
Name

Type

Description

vm

VC:VirtualMachine

Virtual machine

vmUsername

string

Username for the virtual machine

vmPassword

SecureString

Password for the virtual machine

vcoPath

Array/string

guestFilePath

Array/string

vCO Workflow Documentation - Jul 6, 2015

Page

194

Write Many Files to Guest


Name

Type

overwrite

boolean

Description

Overwrite file if exists

9.2.3. Attributes
Name

Type

results

Array/boolean

9.2.4. Parameter
Parameter

Description

presentation
Description

vcoPath

vcoPath

guestFilePath

guestFilePath

overwrite

Overwrite file if

Parameter Info

exists
vm

Virtual machine

vmPassword

Password for the


virtual machine

vmUsername

Username for the


virtual machine

9.2.5. Workflow

schema

9.2.6. Workflow

items

vCO Workflow Documentation - Jul 6, 2015

Page

195

Bootstrap Node

Name

Type

Next item

Description

WorkflowItemEnd
Foreach

WorkflowItemForeac

Copies the specified file from

(Copy file

the vCO server to the guest file

from vCO to

system.

guest)

9.2.7. Source
10.

code for the used actions

Knife Bootstrap

Workflows for performing Knife Bootstrap on new nodes.

10.1.

Bootstrap Node

Performs a Knife bootstrap on a new Node.


linux host with chef knife.

Depends on an intermediary

This workflow calls knife bootstrap over ssh, which would make ssh calls
to the new node to install chef client and register the node with the Chef
Server.
To perform a bootstrap of a linux node without Knife, use "Install Omnibus
Chef Client" and "Chef client first run with JSON First Boot" in the
Chef/SSH/Linux folder.

10.1.1. Versions
Version

0.0.1

Date

May 30, 2013

User

Comment

Daniel
Linsley

0.0.2

May 30, 2013

Daniel
Linsley

0.0.3

May 30, 2013

Daniel
Linsley

0.0.4

May 30, 2013

Daniel
Linsley

0.0.5

May 30, 2013

Daniel
Linsley

vCO Workflow Documentation - Jul 6, 2015

Page

196

Bootstrap Node
Version

0.0.6

Date

May 30, 2013

User

Comment

Daniel
Linsley

0.0.7

May 30, 2013

Daniel
Linsley

0.0.8

May 30, 2013

Daniel
Linsley

0.0.9

May 30, 2013

Daniel
Linsley

0.0.10

May 31, 2013

Daniel
Linsley

0.0.11

May 31, 2013

Daniel
Linsley

0.0.12

May 31, 2013

Daniel
Linsley

0.0.13

Jun 20, 2013

Daniel
Linsley

0.0.14

Feb 24, 2014

vCO
Administra
tor

0.0.15

Feb 24, 2014

vCO
Administra
tor

0.0.16

Feb 24, 2014

vCO
Administra
tor

0.0.17

Feb 24, 2014

vCO
Administra
tor

0.0.18

Feb 24, 2014

vCO
Administra
tor

vCO Workflow Documentation - Jul 6, 2015

Page

197

Bootstrap Node
Version

Date

0.0.19

User

Mar 20, 2014

Comment

vCO
Administra
tor

0.0.20

Apr 30, 2015

vCO
Administra
tor

Current version:0.0.20

10.1.2. Inputs
Name

Type

chefHostname

string

orgName

string

ipaddress

string

nodename

string

Description

fqdn to be used as the chef node


name

username

string

ssh username of target node

password

SecureString

ssh password of target node

runlist

Array/string

environment

string

10.1.3. Attributes
Name

configElement

Type

Description

ConfigurationElemen
t

validatorid

string

validatorPem

SecureString

knifeConfig

string

knifeRunnerHostname

string

vCO Workflow Documentation - Jul 6, 2015

Page

198

Bootstrap Node
Name

Type

knifeRunnerUsername

string

knifeRunnerPassword

SecureString

knifeConfigCommand

string

validatorPemCommand

string

bootstrapCommand

string

passwordAuthentication

boolean

Description

Sets authentication to password or


key file

result

number

0 = OK, Negative = Error, Positive


= Number of values returned, after
error text

errorText

string

Error text, if any

outputText

string

Result of running the SSH command

opensourceValidatorClie string
ntName

10.1.4. Parameter
Parameter

presentation
Description

chefHostname

chefHostname

orgName

orgName

ipaddress

ipaddress

nodename

fqdn to be used as

Parameter Info

the chef node name


username

ssh username of
target node

password

ssh password of
target node

runlist

runlist

environment

environment

vCO Workflow Documentation - Jul 6, 2015

Page

199

Bootstrap Node

10.1.5. Workflow

schema

10.1.6. Workflow

items

Name

Type

Next item

Description

WorkflowItemEnd
getPrivateKe

WorkflowItemTask

yFromConfig
Create knife

config
WorkflowItemTask

config
Write Config

Create knife

Create
Commands

WorkflowItemLink

Write

Runs an SSH command.

Validator
Create

WorkflowItemTask

Write Config

WorkflowItemLink

Bootstrap!

Commands
Write

Runs an SSH command.

Validator
Bootstrap!

WorkflowItemLink

createValida

WorkflowItemTask

torId

vCO Workflow Documentation - Jul 6, 2015

Runs an SSH command.


getPrivateKe
yFromConfig

Page

200

Bootstrap Node with JSON First Boot

10.1.7. Source

code for the used actions

10.1.7.1. getPrivateKeyFromConfig
//Auto generated script, cannot be modified !
actionResult =
System.getModule("com.vmware.pso.chef").getPrivateKeyFromConfig(configElement,chefHostname
,userid) ;

10.1.7.2. Create knife config


knifeConfig =

"validation_client_name

"validation_key

'"+validatorid+"'\n" +

'/etc/chef/"+validatorid+".pem'\n"+

"chef_server_url

'https://"+chefHostname;

if (orgName != null && orgName.length > 0) {


knifeConfig = knifeConfig + "/organizations/"+orgName+"'";
} else {
knifeConfig = knifeConfig + "'";
}

10.1.7.3. Create Commands


knifeConfigCommand = "echo \""+knifeConfig+"\" > knife-"+orgName+".rb";
validatorPemCommand = "mkdir -p /etc/chef; echo \""+validatorPem+"\" >
/etc/chef/"+validatorid+".pem";
bootstrapCommand = "knife bootstrap "+ipaddress+" -c knife-"+orgName+".rb -N "+nodename+"
-x "+username+" -P "+password;

if (environment != null && environment.length > 0) {


bootstrapCommand += " -E "+environment;
}
if (runlist !=null && runlist.length > 0){
bootstrapCommand += " -r "+runlist.join(',');
}

10.1.7.4. createValidatorId
//Auto generated script, cannot be modified !
actionResult =
System.getModule("com.vmware.pso.chef").createValidatorId(orgName,opensourceValidatorClien
tName) ;

10.2.

Bootstrap Node with JSON First Boot

vCO Workflow Documentation - Jul 6, 2015

Page

201

Bootstrap Node with JSON First Boot


Performs a Knife bootstrap on a new Node.
linux host with chef knife.

Depends on an intermediary

This workflow calls knife bootstrap over ssh, which would make ssh calls
to the new node to install chef client and register the node with the Chef
Server.
To perform a bootstrap of a linux node without Knife, use "Install Omnibus
Chef Client" and "Chef client first run with JSON First Boot" in the
Chef/SSH/Linux folder.

10.2.1. Versions
Version

0.0.1

Date

May 30, 2013

User

Comment

Daniel
Linsley

0.0.2

May 30, 2013

Daniel
Linsley

0.0.3

May 30, 2013

Daniel
Linsley

0.0.4

May 30, 2013

Daniel
Linsley

0.0.5

May 30, 2013

Daniel
Linsley

0.0.6

May 30, 2013

Daniel
Linsley

0.0.7

May 30, 2013

Daniel
Linsley

0.0.8

May 30, 2013

Daniel
Linsley

0.0.9

May 30, 2013

Daniel
Linsley

0.0.10

May 31, 2013

Daniel
Linsley

0.0.11

May 31, 2013

Daniel
Linsley

vCO Workflow Documentation - Jul 6, 2015

Page

202

Bootstrap Node with JSON First Boot


Version

Date

0.0.12

User

May 31, 2013

Comment

Daniel
Linsley

0.0.13

May 31, 2013

Daniel
Linsley

0.0.14

Oct 2, 2013

vCO
Administra
tor

0.0.15

Mar 20, 2014

vCO
Administra
tor

0.0.16

Apr 30, 2015

vCO
Administra
tor

Current version:0.0.16

10.2.2. Inputs
Name

Type

chefHostname

string

orgName

string

ipaddress

string

nodename

string

Description

fqdn to be used as the chef node


name

username

string

ssh username of target node

password

SecureString

ssh password of target node

jsonFirstBoot

string

10.2.3. Attributes
Name

configElement

Type

Description

ConfigurationElemen
t

vCO Workflow Documentation - Jul 6, 2015

Page

203

Bootstrap Node with JSON First Boot


Name

Type

validatorid

string

validatorPem

SecureString

knifeConfig

string

knifeRunnerHostname

string

knifeRunnerUsername

string

knifeRunnerPassword

SecureString

knifeConfigCommand

string

validatorPemCommand

string

bootstrapCommand

string

passwordAuthentication

boolean

Description

Sets authentication to password or


key file

result

number

0 = OK, Negative = Error, Positive


= Number of values returned, after
error text

errorText

string

Error text, if any

outputText

string

Result of running the SSH command

opensourceValidatorClie string
ntName

10.2.4. Parameter
Parameter

presentation
Description

chefHostname

chefHostname

orgName

orgName

ipaddress

ipaddress

nodename

fqdn to be used as

Parameter Info

the chef node name

vCO Workflow Documentation - Jul 6, 2015

Page

204

Bootstrap Node with JSON First Boot


Parameter

Description

username

Parameter Info

ssh username of
target node

password

ssh password of
target node

jsonFirstBoot

jsonFirstBoot

10.2.5. Workflow

schema

10.2.6. Workflow

items

Name

Type

Next item

Description

WorkflowItemEnd
getPrivateKe

WorkflowItemTask

yFromConfig
Create knife

config
WorkflowItemTask

config
Write Config

Create knife

Create
Commands

WorkflowItemLink

Write

Runs an SSH command.

Validator

vCO Workflow Documentation - Jul 6, 2015

Page

205

Bootstrap Node with JSON First Boot


Name

Type

Create

Next item

WorkflowItemTask

Write Config

WorkflowItemLink

Bootstrap!

Description

Commands
Write

Runs an SSH command.

Validator
Bootstrap!

WorkflowItemLink

createValida

WorkflowItemTask

torId

Runs an SSH command.


getPrivateKe
yFromConfig

10.2.7. Source

code for the used actions

10.2.7.1. getPrivateKeyFromConfig
//Auto generated script, cannot be modified !
actionResult =
System.getModule("com.vmware.pso.chef").getPrivateKeyFromConfig(configElement,chefHostname
,userid) ;

10.2.7.2. Create knife config


knifeConfig =

"validation_client_name

"validation_key

'"+validatorid+"'\n" +

'/etc/chef/"+validatorid+".pem'\n"+

"chef_server_url

'https://"+chefHostname+"/organizations/"+orgName+"'";

10.2.7.3. Create Commands


knifeConfigCommand = "echo \""+knifeConfig+"\" > knife-"+orgName+".rb";
validatorPemCommand = "mkdir -p /etc/chef; echo \""+validatorPem+"\" >
/etc/chef/"+validatorid+".pem";
bootstrapCommand = "knife bootstrap "+ipaddress+" -c knife-"+orgName+".rb -N "+nodename+"
-x "+username+" -P "+password;

if (jsonFirstBoot !=null && jsonFirstBoot.length > 0){


bootstrapCommand += " -j '"+jsonFirstBoot+"'";
}

10.2.7.4. createValidatorId
//Auto generated script, cannot be modified !
actionResult =

vCO Workflow Documentation - Jul 6, 2015

Page

206

Install Omnibus Chef Client


System.getModule("com.vmware.pso.chef").createValidatorId(orgName,opensourceValidatorClien
tName) ;

Linux
SSH

11.
11.1.
11.1.1.

Install Omnibus Chef Client

Installs the latest version of the Chef client by using the Omnibus
Installer via SSH.
For more details about the Omnibus installer see:
https://docs.chef.io/install_omnibus.html

11.1.1.1. Versions
Version

0.0.1

Date

Feb 26, 2014

User

Comment

vCO
Administra
tor

0.0.2

Feb 26, 2014

vCO
Administra
tor

0.0.3

Feb 26, 2014

vCO
Administra
tor

0.0.4

Feb 26, 2014

vCO
Administra
tor

0.0.5

Feb 26, 2014

vCO
Administra
tor

0.0.6

Feb 26, 2014

vCO
Administra
tor

0.0.7

Feb 26, 2014

vCO
Administra
tor

0.0.8

Feb 26, 2014

vCO
Administra
tor

vCO Workflow Documentation - Jul 6, 2015

Page

207

Install Omnibus Chef Client


Version

0.0.9

Date

Feb 26, 2014

User

Comment

vCO
Administra
tor

0.0.10

Feb 26, 2014

vCO
Administra
tor

0.0.11

Feb 26, 2014

vCO
Administra
tor

0.0.12

Feb 26, 2014

vCO
Administra
tor

0.0.13

Feb 26, 2014

vCO
Administra
tor

0.0.14

Feb 26, 2014

vCO
Administra
tor

0.0.15

Feb 26, 2014

vCO
Administra
tor

0.0.16

Feb 26, 2014

vCO
Administra
tor

0.0.17

Feb 26, 2014

vCO
Administra
tor

0.0.18

Feb 27, 2014

vCO
Administra
tor

0.0.19

Mar 4, 2014

vCO
Administra
tor

vCO Workflow Documentation - Jul 6, 2015

Page

208

Install Omnibus Chef Client


Version

Date

0.0.20

User

Mar 5, 2014

Comment

vCO
Administra
tor

0.0.21

Dec 4, 2014

vCO
Administra
tor

0.0.22

May 18, 2015

vCO
Administra
tor

0.0.23

May 18, 2015

vCO
Administra
tor

0.0.24

May 18, 2015

vCO
Administra
tor

Current version:0.0.24

11.1.1.2. Inputs
Name

hostNameOrIP

Type

string

Description

Hostname or IP address of the SSH


host

passwordAuthentication

boolean

Sets authentication to password or


key file

password

SecureString

Password

username

string

Username

path

Path

Path to the private key

passphrase

SecureString

Private key pass-phrase

webProxy

string

11.1.1.3. Attributes
Name

vCO Workflow Documentation - Jul 6, 2015

Type

Description

Page

209

Install Omnibus Chef Client


Name

Type

Description

cmd

string

The SSH command to run

result

number

0 = OK, Negative = Error, Positive


= Number of values returned, after
error text

errorText

string

Error text, if any

outputText

string

Result of running the SSH command

errorCode

string

11.1.1.4. Parameter

presentation

Parameter

hostNameOrIP

Description

Parameter Info

Hostname or IP
address of the SSH
host

passwordAuthenticat Sets authentication Default value: true


ion

to password (Yes)
or key file (No)

username

Username

password

Password

path

Path to the private


key

passphrase

Private key passphrase

webProxy

webProxy

11.1.1.5. Workflow

schema

vCO Workflow Documentation - Jul 6, 2015

Page

210

Install Omnibus Chef Client

11.1.1.6. Workflow
Name

items

Type

Next item

Description

WorkflowItemEnd
Run SSH

WorkflowItemLink

Check Output

Runs an SSH command.

command
Check Output

WorkflowItemTask
WorkflowItemEnd

Build

WorkflowItemTask

Command

11.1.1.7. Source

Run SSH
command

code for the used actions

11.1.1.7.1. Check Output


if (outputText.toLowerCase().indexOf('error') > -1 ||
outputText.toLowerCase().indexOf('failed') > -1) {
System.error(outputText);
throw outputText;
} else if (outputText.toLowerCase().indexOf('warning') > -1) {
System.warn(outputText);
//Success
System.log("Successfully installed Omnibus Client with warning");

vCO Workflow Documentation - Jul 6, 2015

Page

211

Linux SSH Chef-client first run


Server.log("Successfully installed Omnibus Client with warning");
} else {
//Success
System.log("Successfully installed Omnibus Client");
Server.log("Successfully installed Omnibus Client");
}

11.1.1.7.2. Build Command


if (webProxy != null && webProxy.length > 0){
cmd = "export https_proxy="+webProxy+";"+cmd;
}

11.1.2.

Linux SSH Chef-client first run

Before running this workflow make sure you have run "Set Private Key" for
the validator client of your Chef organization (<orgName>-validator).
This workflow creates the following files on the target system via SSH:
- /etc/chef/client.rb
- /etc/chef/<orgName>-validator.pem
- /etc/chef/first-boot.json (if specified)
The workflow then executes the first chef-client run. This will:
- Register the node with the Chef Server
- Save the respective private key for the node as /etc/chef/client.pem
Note: If /etc/chef/client.pem already exists when this workflow is run,
it will not register as a new node. It may fail if that is your purpose.

11.1.2.1. Versions
Version

0.0.1

Date

May 30, 2013

User

Comment

Daniel
Linsley

0.0.2

May 30, 2013

Daniel
Linsley

0.0.3

May 30, 2013

Daniel
Linsley

0.0.4

May 30, 2013

Daniel
Linsley

vCO Workflow Documentation - Jul 6, 2015

Page

212

Linux SSH Chef-client first run


Version

0.0.5

Date

May 30, 2013

User

Comment

Daniel
Linsley

0.0.6

May 30, 2013

Daniel
Linsley

0.0.7

May 30, 2013

Daniel
Linsley

0.0.8

May 30, 2013

Daniel
Linsley

0.0.9

May 30, 2013

Daniel
Linsley

0.0.10

May 31, 2013

Daniel
Linsley

0.0.11

May 31, 2013

Daniel
Linsley

0.0.12

May 31, 2013

Daniel
Linsley

0.0.13

May 31, 2013

Daniel
Linsley

0.0.14

Oct 2, 2013

vCO
Administra
tor

0.0.15

Feb 26, 2014

vCO
Administra
tor

0.0.16

Feb 26, 2014

vCO
Administra
tor

0.0.17

Feb 27, 2014

vCO
Administra
tor

0.0.18

Feb 27, 2014

vCO
Administra
tor

vCO Workflow Documentation - Jul 6, 2015

Page

213

Linux SSH Chef-client first run


Version

0.0.19

Date

User

Feb 27, 2014

Comment

vCO
Administra
tor

0.0.20

Feb 27, 2014

vCO
Administra
tor

0.0.21

Feb 27, 2014

vCO
Administra
tor

0.0.22

Feb 27, 2014

vCO
Administra
tor

0.0.23

Feb 27, 2014

vCO
Administra
tor

0.0.24

Mar 5, 2014

vCO
Administra
tor

0.0.25

Dec 4, 2014

vCO
Administra
tor

0.0.26

Apr 30, 2015

vCO
Administra
tor

0.0.27

Apr 30, 2015

vCO
Administra
tor

Current version:0.0.27

11.1.2.2. Inputs
Name

Type

Description

chefHostname*

string

Chef Server hostname

orgName

string

Chef organization name

vCO Workflow Documentation - Jul 6, 2015

Page

214

Linux SSH Chef-client first run


Name

Type

environment

string

jsonFirstBoot

string

nodeName

string

Description

Chef environment

Optionally specify the name of this


new node

ipaddress*

string

ipaddress of the new node

passwordAuthentication

boolean

Sets authentication to password


(yes) or key file (no)

username*

string

ssh username of target node

password

SecureString

ssh password of target node

path

Path

Path to the private key

passphrase

SecureString

Private key pass-phrase

sslVerifyNone

boolean

Disable verification of Chef Server


SSL Cert

*Parameter is mandatory

11.1.2.3. Attributes
Name

configElement

Type

Description

ConfigurationElemen
t

validatorid

string

validatorPem

SecureString

validatorPemCommand

string

result

number

0 = OK, Negative = Error, Positive


= Number of values returned, after
error text

errorText

string

Error text, if any

outputText

string

Result of running the SSH command

chefClientConfig

string

vCO Workflow Documentation - Jul 6, 2015

Page

215

Linux SSH Chef-client first run


Name

Type

Description

chefClientConfigCommand string
firstRunCommand

string

opensourceValidatorClie string
ntName

11.1.2.4. Parameter
Parameter

presentation
Description

chefHostname

chefHostname

orgName

orgName

environment

Chef environment

nodeName

Optionally specify

Parameter Info

Mandatory input: true

the name of this


new node
jsonFirstBoot

jsonFirstBoot

sslVerifyNone

Disable
verification of
Chef Server SSL
Cert

ipaddress

ipaddress of the

Mandatory input: true

new node
passwordAuthenticat Sets authentication
ion

to password (yes)
or key file (no)

username

ssh username of

Mandatory input: true

target node
password

ssh password of
target node

path

Path to the private


key

vCO Workflow Documentation - Jul 6, 2015

Page

216

Linux SSH Chef-client first run


Parameter

passphrase

Description

Parameter Info

Private key passphrase

11.1.2.5. Workflow

schema

11.1.2.6. Workflow

items

Name

Type

Next item

Description

WorkflowItemEnd
getPrivateKe

WorkflowItemTask

yFromConfig
Write Config

createChefCl
ientConfig

WorkflowItemLink

Write

Runs an SSH command.

Validator
Create

WorkflowItemTask

Write Config

WorkflowItemLink

chef-client

Commands
Write
Validator

vCO Workflow Documentation - Jul 6, 2015

Runs an SSH command.

first run

Page

217

Linux SSH Chef-client first run


Name

chef-client

Type

Next item

WorkflowItemLink

Description

Runs an SSH command.

first run
createValida

WorkflowItemTask

torId
createChefCl

getPrivateKe
yFromConfig

WorkflowItemTask

ientConfig

11.1.2.7. Source

Create
Commands

code for the used actions

11.1.2.7.1. getPrivateKeyFromConfig
//Auto generated script, cannot be modified !
actionResult =
System.getModule("com.vmware.pso.chef").getPrivateKeyFromConfig(configElement,chefHostname
,userid) ;

11.1.2.7.2. Create Commands


chefClientConfigCommand = "mkdir -p /etc/chef; echo \""+chefClientConfig+"\" >
/etc/chef/client.rb";
validatorPemCommand = "echo \""+validatorPem+"\" > /etc/chef/"+validatorid+".pem";
firstRunCommand = "chef-client";

if (jsonFirstBoot !=null && jsonFirstBoot.length > 0){


chefClientConfigCommand = chefClientConfigCommand + "; echo '"+jsonFirstBoot+"' >
/etc/chef/first-boot.json";
firstRunCommand += " -j /etc/chef/first-boot.json";
}

if (environment != null && environment.length > 0) {


firstRunCommand += " -E "+environment;
}

11.1.2.7.3. createValidatorId
//Auto generated script, cannot be modified !
actionResult =
System.getModule("com.vmware.pso.chef").createValidatorId(orgName,opensourceValidatorClien
tName) ;

vCO Workflow Documentation - Jul 6, 2015

Page

218

Linux SSH Configure Knife for user

11.1.2.7.4. createChefClientConfig
//Auto generated script, cannot be modified !
actionResult =
System.getModule("com.vmware.pso.chef").createChefClientConfig(validatorid,chefHostname,or
gName,nodeName,sslVerifyNone) ;

11.1.3.

Linux SSH Configure Knife for user

Configures knife on a remote Linux host.


Builds a Knife config (knife.rb) and places it along with your .pem in
~/.chef/
Builds the .pem from the "Chef Private Keys" configuration.

11.1.3.1. Versions
Version

0.0.1

Date

Feb 26, 2014

User

Comment

vCO
Administra
tor

0.0.2

Feb 26, 2014

vCO
Administra
tor

0.0.3

Feb 26, 2014

vCO
Administra
tor

0.0.4

Feb 26, 2014

vCO
Administra
tor

0.0.5

Feb 26, 2014

vCO
Administra
tor

0.0.6

Feb 26, 2014

vCO
Administra
tor

0.0.7

Feb 27, 2014

vCO
Administra
tor

vCO Workflow Documentation - Jul 6, 2015

Page

219

Linux SSH Configure Knife for user


Version

Date

0.0.8

User

Mar 20, 2014

Comment

vCO
Administra
tor

0.0.9

Apr 30, 2015

vCO
Administra
tor

0.0.10

Apr 30, 2015

vCO
Administra
tor

Current version:0.0.10

11.1.3.2. Inputs
Name

Type

Description

chefHostname*

string

Chef host to configure knife to use

userid*

string

Chef user id to configure knife to


use

orgName

string

Chef org to configure knife to use

hostNameOrIP*

string

Hostname or IP address of the SSH


host

passwordAuthentication

boolean

Sets authentication to password or


key file

password

SecureString

Password

username*

string

Username

path

Path

Path to the private key

passphrase

SecureString

Private key pass-phrase

sslVerifyNone

boolean

Disable verification of Chef Server


SSL Cert

*Parameter is mandatory

11.1.3.3. Attributes

vCO Workflow Documentation - Jul 6, 2015

Page

220

Linux SSH Configure Knife for user


Name

Type

result

Description

number

0 = OK, Negative = Error, Positive


= Number of values returned, after
error text

errorText

string

Error text, if any

outputText

string

Result of running the SSH command

configElement

ConfigurationElemen
t

pem

SecureString

sshCommand

string

11.1.3.4. Parameter
Parameter

presentation
Description

Parameter Info

chefHostname

chefHostname

Mandatory input: true

userid

userid

Mandatory input: true

orgName

orgName

sslVerifyNone

Disable
verification of
Chef Server SSL
Cert

hostNameOrIP

Hostname or IP

Mandatory input: true

address of the SSH


host
passwordAuthenticat Sets authentication Default value: true
ion

to password (Yes)
or key file (No)

username

Username

password

Password

path

Path to the private

Mandatory input: true

key

vCO Workflow Documentation - Jul 6, 2015

Page

221

Linux SSH Configure Knife for user


Parameter

Description

passphrase

Parameter Info

Private key passphrase

11.1.3.5. Workflow

schema

11.1.3.6. Workflow

items

Name

Type

Next item

Description

WorkflowItemEnd
Run SSH

WorkflowItemLink

Runs an SSH command.

command
Build

WorkflowItemTask

command
getPrivateKe

Run SSH
command

WorkflowItemTask

yFromConfig

11.1.3.7. Source

Build
command

code for the used actions

11.1.3.7.1. Build command


var knifeConfig = "chef_server_url 'https://"+chefHostname;
if (orgName != null && orgName.length > 0) {
knifeConfig = knifeConfig+"/organizations/"+orgName+"'";
} else {
knifeConfig = knifeConfig+"'";
}
knifeConfig = knifeConfig+ "\nclient_key '~/.chef/"+userid+".pem'\nnode_name
'"+userid+"'";

if (sslVerifyNone) {
knifeConfig = knifeConfig+"\nssl_verify_mode

:verify_none";

vCO Workflow Documentation - Jul 6, 2015

Page

222

Linux SSH get client.pem

var mkdirCommand = "mkdir -p ~/.chef";


var knifeConfigCommand = "echo \""+knifeConfig+"\" > ~/.chef/knife.rb";
var pemConfigCommand = "echo \""+pem+"\" > ~/.chef/"+userid+".pem";

sshCommand = [mkdirCommand, knifeConfigCommand, pemConfigCommand].join("; ");

11.1.3.7.2. getPrivateKeyFromConfig
//Auto generated script, cannot be modified !
actionResult =
System.getModule("com.vmware.pso.chef").getPrivateKeyFromConfig(configElement,chefHostname
,userid) ;

11.1.4.

Linux SSH get client.pem

Retrieves the contents of /etc/chef/client.pem via SSH.

11.1.4.1. Versions
Version

Date

0.0.1

User

Jan 2, 2015

Comment

vCO
Administra
tor

0.0.2

Jan 2, 2015

vCO
Administra
tor

Current version:0.0.2

11.1.4.2. Inputs
Name

hostNameOrIP

Type

string

Description

Hostname or IP address of the SSH


host

passwordAuthentication

boolean

Sets authentication to password or


key file

password

SecureString

Password

username

string

Username

path

Path

Path to the private key

vCO Workflow Documentation - Jul 6, 2015

Page

223

Linux SSH get client.pem


Name

Type

passphrase

SecureString

Description

Private key pass-phrase

11.1.4.3. Outputs
Name

pem

Type

Description

Type

Description

string

11.1.4.4. Attributes
Name

cmd

string

The SSH command to run

result

number

0 = OK, Negative = Error, Positive


= Number of values returned, after
error text

errorText

string

Error text, if any

outputText

string

Result of running the SSH command

errorCode

string

11.1.4.5. Parameter
Parameter

hostNameOrIP

presentation
Description

Parameter Info

Hostname or IP
address of the SSH
host

passwordAuthenticat Sets authentication Default value: true


ion

to password (Yes)
or key file (No)

username

Username

password

Password

path

Path to the private


key

vCO Workflow Documentation - Jul 6, 2015

Page

224

Linux SSH get client.pem


Parameter

Description

passphrase

Parameter Info

Private key passphrase

11.1.4.6. Workflow

schema

11.1.4.7. Workflow

items

Name

Type

Next item

Description

WorkflowItemEnd
Run SSH

WorkflowItemLink

Check Output

Runs an SSH command.

command
Check Output

WorkflowItemTask
WorkflowItemEnd

11.1.4.8. Source

code for the used actions

11.1.4.8.1. Check Output

vCO Workflow Documentation - Jul 6, 2015

Page

225

Run Chef-Client via SSH


if (outputText.indexOf("-----BEGIN RSA PRIVATE KEY-----") > -1) {
pem = outputText;
System.log("Successfully found client.pem");
} else {
throw("Could not find client.pem: "+outputText);
}

11.1.5.

Run Chef-Client via SSH

Simply executes 'chef-client' via SSH

11.1.5.1. Versions
Version

0.0.1

Date

Feb 26, 2014

User

Comment

vCO
Administra
tor

0.0.2

Feb 26, 2014

vCO
Administra
tor

0.0.3

Feb 26, 2014

vCO
Administra
tor

0.0.4

Feb 26, 2014

vCO
Administra
tor

0.0.5

Feb 26, 2014

vCO
Administra
tor

0.0.6

Feb 26, 2014

vCO
Administra
tor

0.0.7

Feb 26, 2014

vCO
Administra
tor

0.0.8

Feb 26, 2014

vCO
Administra
tor

vCO Workflow Documentation - Jul 6, 2015

Page

226

Run Chef-Client via SSH


Version

0.0.9

Date

Feb 26, 2014

User

Comment

vCO
Administra
tor

0.0.10

Feb 26, 2014

vCO
Administra
tor

0.0.11

Feb 26, 2014

vCO
Administra
tor

0.0.12

Feb 26, 2014

vCO
Administra
tor

0.0.13

Feb 26, 2014

vCO
Administra
tor

0.0.14

Feb 26, 2014

vCO
Administra
tor

0.0.15

Feb 26, 2014

vCO
Administra
tor

0.0.16

Feb 26, 2014

vCO
Administra
tor

0.0.17

Feb 26, 2014

vCO
Administra
tor

0.0.18

Feb 27, 2014

vCO
Administra
tor

0.0.19

Feb 27, 2014

vCO
Administra
tor

vCO Workflow Documentation - Jul 6, 2015

Page

227

Run Chef-Client via SSH


Version

Date

0.0.20

User

Feb 27, 2014

Comment

vCO
Administra
tor

Current version:0.0.20

11.1.5.2. Inputs
Name

hostNameOrIP

Type

string

Description

Hostname or IP address of the SSH


host

passwordAuthentication

boolean

Sets authentication to password or


key file

password

SecureString

Password

username

string

Username

path

Path

Path to the private key

passphrase

SecureString

Private key pass-phrase

11.1.5.3. Attributes
Name

Type

Description

cmd

string

The SSH command to run

result

number

0 = OK, Negative = Error, Positive


= Number of values returned, after
error text

errorText

string

Error text, if any

outputText

string

Result of running the SSH command

errorCode

string

11.1.5.4. Parameter
Parameter

presentation
Description

vCO Workflow Documentation - Jul 6, 2015

Parameter Info

Page

228

Run Chef-Client via SSH


Parameter

hostNameOrIP

Description

Parameter Info

Hostname or IP
address of the SSH
host

passwordAuthenticat Sets authentication Default value: true


ion

to password (Yes)
or key file (No)

username

Username

password

Password

path

Path to the private


key

passphrase

Private key passphrase

11.1.5.5. Workflow

schema

11.1.5.6. Workflow

items

Name

Type

vCO Workflow Documentation - Jul 6, 2015

Next item

Description

Page

229

Linux VMtools Chef-client first run


Name

Type

Next item

Description

WorkflowItemEnd
Run SSH

WorkflowItemLink

Check Output

Runs an SSH command.

command
Check Output

WorkflowItemTask
WorkflowItemEnd

11.1.5.7. Source

code for the used actions

11.1.5.7.1. Check Output


if (outputText.toLowerCase().indexOf('error') > -1) {
throw outputText;
} else if (outputText.toLowerCase().indexOf('warning') > -1) {
System.warn(outputText);
//Success
System.log("Successfully ran chef-client with warning");
Server.log("Successfully ran chef-client with warning");
} else {
//Success
System.log("Successfully ran chef-client");
Server.log("Successfully ran chef-client");
}

VMtools

11.2.
11.2.1.

Linux VMtools Chef-client first run

Before running this workflow make sure you have run "Set Private Key" for
the validator client of your Chef organization (<orgName>-validator).
This workflow creates the following files on the target system via
VMtools:
- /etc/chef/client.rb
- /etc/chef/<orgName>-validator.pem
- /etc/chef/first-boot.json (if specified)
The workflow then executes the first chef-client run. This will:
- Register the node with the Chef Server
- Save the respective private key for the node as /etc/chef/client.pem
Note: If /etc/chef/client.pem already exists when this workflow is run,
it will not register as a new node. It may fail if that is your purpose.

vCO Workflow Documentation - Jul 6, 2015

Page

230

Linux VMtools Chef-client first run

11.2.1.1. Versions
Version

0.0.3

Date

Dec 5, 2014

User

svc.soi_vm

Comment

Imported from content from package

ware
0.0.4

Dec 6, 2014

svc.soi_vm
ware

0.0.5

Dec 6, 2014

svc.soi_vm
ware

0.0.6

Dec 9, 2014

vCO
Administra
tor

0.0.7

Dec 9, 2014

vCO
Administra
tor

0.0.8

Dec 12, 2014

vCO
Administra
tor

0.0.9

Dec 15, 2014

vCO
Administra
tor

0.0.10

Dec 15, 2014

vCO
Administra
tor

0.0.11

Dec 15, 2014

vCO
Administra
tor

0.0.12

Dec 15, 2014

vCO
Administra
tor

0.0.13

Apr 30, 2015

vCO
Administra
tor

vCO Workflow Documentation - Jul 6, 2015

Page

231

Linux VMtools Chef-client first run


Version

Date

0.0.14

User

Apr 30, 2015

Comment

vCO
Administra
tor

0.0.15

Apr 30, 2015

vCO
Administra
tor

Current version:0.0.15

11.2.1.2. Inputs
Name

Type

Description

chefHostname*

string

Chef Server hostname

orgName

string

Chef organization name

environment

string

jsonFirstBoot

string

nodeName

string

Optionally specify the name of this


new node

vm*

VC:VirtualMachine

Virtual Machine (VC)

username*

string

Guest username

password*

SecureString

Guest password

sslVerifyNone

boolean

Disable verification of Chef Server


SSL Cert

*Parameter is mandatory

11.2.1.3. Attributes
Name

configElement

Type

Description

ConfigurationElemen
t

validatorid

string

validatorPem

SecureString

vCO Workflow Documentation - Jul 6, 2015

Page

232

Linux VMtools Chef-client first run


Name

Type

chefClientConfig

string

commands

Array/string

scriptType

string

errorCode

string

scriptOutputTexts

Array/string

scriptExitCodes

Array/number

Description

bash / bat / powershell

opensourceValidatorClie string
ntName

11.2.1.4. Parameter

presentation

Parameter

Description

chefHostname

chefHostname

orgName

orgName

environment

environment

jsonFirstBoot

jsonFirstBoot

nodeName

Optionally specify

Parameter Info

Mandatory input: true

the name of this


new node
sslVerifyNone

Disable
verification of
Chef Server SSL
Cert

vm

Virtual Machine

Mandatory input: true

(VC)
username

Guest Username

Mandatory input: true

password

Guest Password

Mandatory input: true

11.2.1.5. Workflow

schema

vCO Workflow Documentation - Jul 6, 2015

Page

233

Linux VMtools Chef-client first run

11.2.1.6. Workflow
Name

getPrivateKe

items

Type

WorkflowItemTask

yFromConfig
Create

Next item

Description

createChefCl
ientConfig

WorkflowItemTask

Commands

Run Multiple
Commands in
Guest

Run Multiple

WorkflowItemLink

Commands in

Check
Results

Guest
Check

WorkflowItemTask

Results
WorkflowItemEnd
WorkflowItemEnd
createValida

WorkflowItemTask

torId

vCO Workflow Documentation - Jul 6, 2015

getPrivateKe
yFromConfig

Page

234

Linux VMtools Chef-client first run


Name

createChefCl

Type

WorkflowItemTask

ientConfig

11.2.1.7. Source

Next item

Description

Create
Commands

code for the used actions

11.2.1.7.1. getPrivateKeyFromConfig
//Auto generated script, cannot be modified !
actionResult =
System.getModule("com.vmware.pso.chef").getPrivateKeyFromConfig(configElement,chefHostname
,userid) ;

11.2.1.7.2. Create Commands


var chefClientConfigCommand = "mkdir -p /etc/chef; echo \""+chefClientConfig+"\" >
/etc/chef/client.rb";
var validatorPemCommand = "echo \""+validatorPem+"\" > /etc/chef/"+validatorid+".pem";
var firstRunCommand = "export PATH=/usr/bin:/usr/local/bin; chef-client";

if (jsonFirstBoot !=null && jsonFirstBoot.length > 0){


chefClientConfigCommand = chefClientConfigCommand + "; echo '"+jsonFirstBoot+"' >
/etc/chef/first-boot.json";
firstRunCommand += " -j /etc/chef/first-boot.json";
}

if (environment != null && environment.length > 0) {


firstRunCommand += " -E "+environment;
}

commands = [chefClientConfigCommand,validatorPemCommand,firstRunCommand];

11.2.1.7.3. Check Results


for (var i in scriptExitCodes) {
if (scriptExitCodes[i] != 0) {
//parse scriptOutputText?
throw("Chef First Run Failed");
}
}

vCO Workflow Documentation - Jul 6, 2015

Page

235

Linux VMtools Configure Knife for User

11.2.1.7.4. createValidatorId
//Auto generated script, cannot be modified !
actionResult =
System.getModule("com.vmware.pso.chef").createValidatorId(orgName,opensourceValidatorClien
tName) ;

11.2.1.7.5. createChefClientConfig
//Auto generated script, cannot be modified !
actionResult =
System.getModule("com.vmware.pso.chef").createChefClientConfig(validatorid,chefHostname,or
gName,nodeName,sslVerifyNone) ;

Linux VMtools Configure Knife for


User
11.2.2.

Configures knife on a Linux host via VMtools.


Builds a Knife config (knife.rb) and places it along with your .pem in
~/.chef/
Builds the .pem from the "Chef Private Keys" configuration.

11.2.2.1. Versions
Version

0.0.1

Date

Dec 4, 2014

User

Comment

vCO
Administra
tor

0.0.2

Dec 4, 2014

vCO
Administra
tor

0.0.3

Dec 4, 2014

vCO
Administra
tor

0.0.4

Dec 4, 2014

vCO
Administra
tor

0.0.5

Dec 4, 2014

vCO
Administra
tor

vCO Workflow Documentation - Jul 6, 2015

Page

236

Linux VMtools Configure Knife for User


Version

0.0.6

Date

User

Dec 15, 2014

Comment

vCO
Administra
tor

0.0.7

Jan 4, 2015

vCO
Administra
tor

0.0.8

Apr 30, 2015

vCO
Administra
tor

0.0.9

Apr 30, 2015

vCO
Administra
tor

0.0.10

Apr 30, 2015

vCO
Administra
tor

0.0.11

Apr 30, 2015

vCO
Administra
tor

Current version:0.0.11

11.2.2.2. Inputs
Name

Type

Description

chefHostname*

string

Chef host to configure knife to use

userid*

string

Chef user id to configure knife to


use

orgName

string

Chef org to configure knife to use

vm*

VC:VirtualMachine

username*

string

Guest Username

password*

SecureString

Guest Password

sslVerifyNone

boolean

Disable verification of Chef Server


SSL Cert

vCO Workflow Documentation - Jul 6, 2015

Page

237

Linux VMtools Configure Knife for User


*Parameter is mandatory

11.2.2.3. Outputs
Name

Type

Description

scriptOutputText

string

Output of the script

scriptExitCode

number

Exit code of the script

11.2.2.4. Attributes
Name

Type

configElement

Description

ConfigurationElemen
t

pem

SecureString

errorCode

string

retries

number

retryLimit

number

sleepTime

number

toolsReady

boolean

scriptType

string

bash / bat / powershell

scriptTimeout

number

Timeout for the running script (in


second)

interactiveSession

boolean

Script context interactivity

scriptRefreshTime

number

(default) Time (in seconds) where a


check of script status occurs

command

string

11.2.2.5. Parameter
Parameter

chefHostname

presentation
Description

chefHostname

vCO Workflow Documentation - Jul 6, 2015

Parameter Info

Mandatory input: true

Page

238

Linux VMtools Configure Knife for User


Parameter

Description

orgName

orgName

userid

userid

sslVerifyNone

Disable

Parameter Info

Mandatory input: true

verification of
Chef Server SSL
Cert
vm

vm

Mandatory input: true

username

Guest Username

Mandatory input: true

password

Guest Password

Mandatory input: true

11.2.2.6. Workflow

schema

11.2.2.7. Workflow

items

Name

Type

Next item

Description

WorkflowItemEnd
Build

WorkflowItemTask

command

vCO Workflow Documentation - Jul 6, 2015

Run Script
In Guest

Page

239

Linux VMtools Configure Knife for User


Name

getPrivateKe

Type

WorkflowItemTask

yFromConfig
testVmToolsF

Next item

Description

Build
command

WorkflowItemTask

Tools Ready?

orGuestOps
Tools Ready?

Sleep

WorkflowItemGeneri getPrivateKe
cCondition

yFromConfig

WorkflowItemTask

testVmToolsF
orGuestOps

WorkflowItemEnd
Run Script

WorkflowItemLink

In Guest

Run a script inside the VM and


wait until it returns his
result.
Retrieve the output of the
script and returns it as output
in the workflow
Inspired by implementation done
in PowerCLI in the following
.NET class :
VMware.VimAutomation.ViCore.Impl
.V1.RunScriptInGuestHelper
VMware.VimAutomation.ViCore.Impl
.V1.Service.VmGuestServiceImpl
Requires running VMwareTools
instance in the GuestOS.
Leverages the vSphere 5.x
GuestOperationsManager object
and is not backwards compatible
with previous versions of
vSphere.

11.2.2.8. Source

code for the used actions

11.2.2.8.1. Build command

vCO Workflow Documentation - Jul 6, 2015

Page

240

Linux VMtools Configure Knife for User

var knifeConfig = "chef_server_url 'https://"+chefHostname;


if (orgName != null && orgName.length > 0) {
knifeConfig = knifeConfig+"/organizations/"+orgName+"'";
} else {
knifeConfig = knifeConfig+"'";
}
knifeConfig = knifeConfig+ "\nclient_key '~/.chef/"+userid+".pem'\nnode_name
'"+userid+"'";

if (sslVerifyNone) {
knifeConfig = knifeConfig+"\nssl_verify_mode

:verify_none";

var mkdirCommand = "mkdir -p ~/.chef";


var knifeConfigCommand = "echo \""+knifeConfig+"\" > ~/.chef/knife.rb";
var pemConfigCommand = "echo \""+pem+"\" > ~/.chef/"+userid+".pem";

command = [mkdirCommand, knifeConfigCommand, pemConfigCommand].join("; ");

11.2.2.8.2. getPrivateKeyFromConfig
//Auto generated script, cannot be modified !
actionResult =
System.getModule("com.vmware.pso.chef").getPrivateKeyFromConfig(configElement,chefHostname
,userid) ;

11.2.2.8.3. testVmToolsForGuestOps
//Auto generated script, cannot be modified !
actionResult = System.getModule("com.vmware.pso.GuestOps").testVmToolsForGuestOps(vm) ;

11.2.2.8.4. Tools Ready?


//Generated by the system, cannot be edited
return (toolsReady == true) ;

11.2.2.8.5. Sleep
if (retries < retryLimit) {
System.sleep(sleepTime);
retries = retries + 1;
} else {

vCO Workflow Documentation - Jul 6, 2015

Page

241

Linux VMtools Delete Instance with own key


throw("Retry count exceeded retry limit");
}

Linux VMtools Delete Instance with


own key
11.2.3.

Deletes a Chef Node and respective Client using a client's key extracted
from the guest using VMtools.
The client.pem file is deleted from the guest if both the node and
respective client are deleted. This allows the node to register with Chef
again.

11.2.3.1. Versions
Version

0.0.1

Date

Dec 10, 2014

User

Comment

vCO
Administra
tor

0.0.2

Dec 10, 2014

vCO
Administra
tor

0.0.3

Dec 10, 2014

vCO
Administra
tor

0.0.4

Dec 10, 2014

vCO
Administra
tor

0.0.5

Dec 10, 2014

vCO
Administra
tor

0.0.6

Dec 12, 2014

vCO
Administra
tor

0.0.7

Dec 15, 2014

vCO
Administra
tor

0.0.8

Dec 15, 2014

vCO
Administra
tor

vCO Workflow Documentation - Jul 6, 2015

Page

242

Linux VMtools Delete Instance with own key


Version

0.0.9

Date

User

Dec 15, 2014

Comment

vCO
Administra
tor

0.0.10

Dec 15, 2014

vCO
Administra
tor

0.0.11

Dec 15, 2014

vCO
Administra
tor

0.0.12

Dec 20, 2014

vCO
Administra
tor

0.0.13

Jan 2, 2015

vCO
Administra
tor

0.0.14

Apr 30, 2015

vCO
Administra
tor

0.0.15

Apr 30, 2015

vCO
Administra
tor

Current version:0.0.15

11.2.3.2. Inputs
Name

Type

Description

vm*

VC:VirtualMachine

username*

string

Guest Username

password*

SecureString

Guest Password

chefHostname*

string

orgName*

string

node*

string

vCO Workflow Documentation - Jul 6, 2015

Node to delete

Page

243

Linux VMtools Delete Instance with own key


*Parameter is mandatory

11.2.3.3. Attributes
Name

Type

Description

scriptExitCode

number

Exit code of the script

pem

string

filePath

string

Guest path

result

boolean

Set to true if directory was


created successfully

11.2.3.4. Parameter
Parameter

presentation
Description

Parameter Info

chefHostname

chefHostname

Mandatory input: true

orgName

orgName

Mandatory input: false

node

Node to delete

Mandatory input: true

vm

vm

Mandatory input: true

username

Guest Username

Mandatory input: true

password

Guest Password

Mandatory input: true

11.2.3.5. Workflow

schema

vCO Workflow Documentation - Jul 6, 2015

Page

244

Linux VMtools Delete Instance with own key

11.2.3.6. Workflow
Name

items

Type

Next item

Description

WorkflowItemEnd
VMtools get

WorkflowItemLink

Delete Node

client.pem

Configures knife on a remote


Linux host.
Builds a Knife config (knife.rb)
and places it along with your
.pem in ~/.chef/
Builds the .pem from the "Chef
Private Keys" configuration.

Delete

WorkflowItemLink

Client with
own key

Delete file

Deletes a chef API client.

in guest
There is no response body from
the chef server for this
request.

vCO Workflow Documentation - Jul 6, 2015

Page

245

Linux VMtools get client.pem


Name

Delete file

Type

WorkflowItemLink

Next item

Check Result

in guest

Description

Delete a file in a guest virtual


machine.

Check Result

WorkflowItemTask

Delete Node

WorkflowItemLink

Delete

Deletes a Node on a

Client with

Server.

own key

state of the node.

Chef

Returns the last known

Typically a node has a


respective API client as well.
You may also want to delete the
repective client.
See "Samples/Delete Instance
from Chef by Name" as an
example.

11.2.3.7. Source

code for the used actions

11.2.3.7.1. Check Result


if (result) {
System.log("Successfully deleted "+filePath+" on "+vm.name);
} else {
System.warn("Failed to delete "+filePath+" on "+vm.name);
}

11.2.4.

Linux VMtools get client.pem

Retrieves the contents of /etc/chef/client.pem from the guest.

11.2.4.1. Versions
Version

0.0.1

Date

Dec 10, 2014

User

Comment

vCO
Administra
tor

0.0.2

Dec 12, 2014

vCO
Administra
tor

vCO Workflow Documentation - Jul 6, 2015

Page

246

Linux VMtools get client.pem


Version

Date

0.0.3

User

Dec 15, 2014

Comment

vCO
Administra
tor

0.0.4

Dec 15, 2014

vCO
Administra
tor

0.0.5

Apr 30, 2015

vCO
Administra
tor

Current version:0.0.5

11.2.4.2. Inputs
Name

Type

Description

vm*

VC:VirtualMachine

username*

string

Guest Username

password*

SecureString

Guest Password

*Parameter is mandatory

11.2.4.3. Outputs
Name

Type

scriptExitCode

number

pem

string

Description

Exit code of the script

11.2.4.4. Attributes
Name

Type

errorCode

string

retries

number

retryLimit

number

sleepTime

number

vCO Workflow Documentation - Jul 6, 2015

Description

Page

247

Linux VMtools get client.pem


Name

Type

Description

toolsReady

boolean

scriptType

string

bash / bat / powershell

scriptTimeout

number

Timeout for the running script (in


second)

interactiveSession

boolean

Script context interactivity

scriptRefreshTime

number

(default) Time (in seconds) where a


check of script status occurs

command

string

scriptOutputText

string

11.2.4.5. Parameter
Parameter

Output of the script

presentation
Description

Parameter Info

vm

vm

Mandatory input: true

username

Guest Username

Mandatory input: true

password

Guest Password

Mandatory input: true

11.2.4.6. Workflow

schema

vCO Workflow Documentation - Jul 6, 2015

Page

248

Linux VMtools get client.pem

11.2.4.7. Workflow
Name

items

Type

Next item

Description

WorkflowItemEnd
testVmToolsF

WorkflowItemTask

Tools Ready?

orGuestOps
Tools Ready?

Sleep

WorkflowItemGeneri Run Script


cCondition

In Guest

WorkflowItemTask

testVmToolsF
orGuestOps

WorkflowItemEnd

vCO Workflow Documentation - Jul 6, 2015

Page

249

Linux VMtools get client.pem


Name

Run Script

Type

WorkflowItemLink

Next item

Check PEM

In Guest

Description

Run a script inside the VM and


wait until it returns his
result.
Retrieve the output of the
script and returns it as output
in the workflow
Inspired by implementation done
in PowerCLI in the following
.NET class :
VMware.VimAutomation.ViCore.Impl
.V1.RunScriptInGuestHelper
VMware.VimAutomation.ViCore.Impl
.V1.Service.VmGuestServiceImpl
Requires running VMwareTools
instance in the GuestOS.
Leverages the vSphere 5.x
GuestOperationsManager object
and is not backwards compatible
with previous versions of
vSphere.

Check PEM

WorkflowItemTask

11.2.4.8. Source

code for the used actions

11.2.4.8.1. testVmToolsForGuestOps
//Auto generated script, cannot be modified !
actionResult = System.getModule("com.vmware.pso.GuestOps").testVmToolsForGuestOps(vm) ;

11.2.4.8.2. Tools Ready?


//Generated by the system, cannot be edited
return (toolsReady == true) ;

11.2.4.8.3. Sleep

vCO Workflow Documentation - Jul 6, 2015

Page

250

Add New Node


if (retries < retryLimit) {
System.sleep(sleepTime);
retries = retries + 1;
} else {
throw("Retry count exceeded retry limit");
}

11.2.4.8.4. Check PEM


if (scriptOutputText.indexOf("-----BEGIN RSA PRIVATE KEY-----") > -1) {
pem = scriptOutputText;
System.log("Successfully found client.pem");
} else {
throw("Could not find client.pem: "+scriptOutputText);
}

Nodes

12.
12.1.

Add New Node

Simply adds a new node to a Chef Server.

12.1.1. Versions
Version

Date

User

Comment

0.0.1

May 13, 2013

root

works!

0.0.2

May 14, 2013

Dan

doc update

Linsley
0.1.0

May 30, 2013

vCO

added orgName input

Administra
tor
0.1.1

May 30, 2013

Daniel
Linsley

0.1.2

Oct 9, 2013

vCO
Administra
tor

0.1.3

Jan 2, 2015

vCO
Administra
tor

0.1.4

Jan 2, 2015

vCO
Administra
tor

vCO Workflow Documentation - Jul 6, 2015

Page

251

Add New Node


Current version:0.1.4

12.1.2. Inputs
Name

Type

Description

chefHostname*

string

userid*

string

orgName*

string

node*

string

Name of new node

pem

string

(Optional)

Private key for the

userid client.

The private key

will be looked up in the <b>Chef


Private Keys</b> Configuration
Element otherwise.

*Parameter is mandatory

12.1.3. Outputs
Name

url

Type

Description

Type

Description

string

12.1.4. Attributes
Name

chefOp

REST:RESTOperation

errorCode

string

pemAttr

SecureString

configElement

ConfigurationElemen
t

12.1.5. Parameter
Parameter

chefHostname

presentation
Description

chefHostname

vCO Workflow Documentation - Jul 6, 2015

Parameter Info

Mandatory input: true

Page

252

Add New Node


Parameter

Description

Parameter Info

userid

userid

Mandatory input: true

node

Name of new node

Mandatory input: true

orgName

orgName

Mandatory input:
!GetAction("com.vmware.pso.chef.hel
pers","hideOrgName").call(
#chefHostname )

pem

(Optional)

Private

key for the userid


client.

The

private key will be


looked up in the
<b>Chef Private
Keys</b>
Configuration
Element otherwise.

12.1.6. Workflow

schema

12.1.7. Workflow

items

Name

Type

Next item

Description

WorkflowItemEnd
postNodes

WorkflowItemTask

checkAndGetP
em

vCO Workflow Documentation - Jul 6, 2015

Page

253

Add New Node


Name

Add Node

Type

Next item

Description

WorkflowItemTask
WorkflowItemEnd

System+Serve

WorkflowItemTask

Log the input text to the

r error

console and the server log with


level 'error'

System+Serve

WorkflowItemTask

Log the input text to the

r error

console and the server log with


level 'error'

System+Serve

WorkflowItemTask

Log the input text to the

r error

console and the server log with


level 'error'

checkAndGetP

WorkflowItemTask

Add Node

em

12.1.8. Source

code for the used actions

12.1.8.1. postNodes
//Auto generated script, cannot be modified !
actionResult = System.getModule("com.vmware.pso.chef.ops").postNodes(chefHostname,orgName)
;

12.1.8.2. Add Node


var bodyJS = {};
bodyJS.name = node;

var body = JSON.stringify(bodyJS);

var result =
System.getModule("com.vmware.pso.chef").executeRequest(chefOp,orgName,userid,pem,body,[]);

var responseJS = JSON.parse(result);

url = responseJS.uri;
Server.log("Successfully added node",node);
System.log("Successfully added node: "+node);

vCO Workflow Documentation - Jul 6, 2015

Page

254

Delete Node

12.1.8.3. System+Server error


//Auto-generated script
System.error(text + " - " + object);
Server.error(text, object);

12.1.8.4. System+Server error


//Auto-generated script
System.error(text + " - " + object);
Server.error(text, object);

12.1.8.5. System+Server error


//Auto-generated script
System.error(text + " - " + object);
Server.error(text, object);

12.1.8.6. checkAndGetPem
//Auto generated script, cannot be modified !
actionResult =
System.getModule("com.vmware.pso.chef").checkAndGetPem(pem,configElement,chefHostname,user
id) ;

12.2.

Delete Node

Deletes a Node on a
node.

Chef Server.

Returns the last known state of the

Typically a node has a respective API client as well. You may also want
to delete the repective client.
See "Samples/Delete Instance from Chef by Name" as an example.

12.2.1. Versions
Version

Date

User

Comment

0.0.1

May 13, 2013

root

works!

0.0.2

May 13, 2013

root

Delete Node

0.0.3

May 14, 2013

root

pull pem from config item

vCO Workflow Documentation - Jul 6, 2015

Page

255

Delete Node
Version

0.1.0

Date

User

May 30, 2013

vCO

Comment

added orgName input

Administra
tor
0.1.1

May 30, 2013

Daniel
Linsley

0.1.2

May 31, 2013

Daniel
Linsley

0.1.3

May 31, 2013

Daniel
Linsley

0.1.4

Jun 20, 2013

Daniel
Linsley

0.1.5

Oct 9, 2013

vCO
Administra
tor

0.1.6

Oct 9, 2013

vCO
Administra
tor

0.1.7

Dec 20, 2014

vCO
Administra
tor

0.1.8

Jan 2, 2015

vCO
Administra
tor

0.1.9

Jan 2, 2015

vCO
Administra
tor

Current version:0.1.9

12.2.2. Inputs
Name

Type

chefHostname*

string

userid*

string

vCO Workflow Documentation - Jul 6, 2015

Description

Page

256

Delete Node
Name

Type

Description

orgName*

string

node*

string

Node to delete

pem

string

(Optional)

Private key for the

userid client.

The private key

will be looked up in the <b>Chef


Private Keys</b> Configuration
Element otherwise.

*Parameter is mandatory

12.2.3. Outputs
Name

overrides

string

name

string

json_class

string

run_list

string

defaults

string

chef_type

string

automatic

string

Type

Description

Type

Description

12.2.4. Attributes
Name

chefOp

REST:RESTOperation

errorCode

string

configElement

ConfigurationElemen
t

pemAttr

12.2.5. Parameter

SecureString

presentation

vCO Workflow Documentation - Jul 6, 2015

Page

257

Delete Node

Parameter

Description

Parameter Info

chefHostname

chefHostname

Mandatory input: true

userid

userid

Mandatory input: true

node

Node to delete

Mandatory input: true

orgName

orgName

Mandatory input:
!GetAction("com.vmware.pso.chef.hel
pers","hideOrgName").call(
#chefHostname )

pem

(Optional)

Private

key for the userid


client.

The

private key will be


looked up in the
<b>Chef Private
Keys</b>
Configuration
Element otherwise.

12.2.6. Workflow

schema

12.2.7. Workflow

items

Name

Type

Next item

Description

WorkflowItemEnd

vCO Workflow Documentation - Jul 6, 2015

Page

258

Delete Node
Name

deleteNode

Type

WorkflowItemTask

Next item

Description

checkAndGetP
em

Execute

WorkflowItemTask

Delete Node
WorkflowItemEnd
System+Serve

WorkflowItemTask

Log the input text to the

r error

console and the server log with


level 'error'

System+Serve

WorkflowItemTask

Log the input text to the

r error

console and the server log with


level 'error'

System+Serve

WorkflowItemTask

Log the input text to the

r error

console and the server log with


level 'error'

checkAndGetP

WorkflowItemTask

em

12.2.8. Source

Execute
Delete Node

code for the used actions

12.2.8.1. deleteNode
//Auto generated script, cannot be modified !
actionResult =
System.getModule("com.vmware.pso.chef.ops").deleteNode(chefHostname,orgName) ;

12.2.8.2. Execute Delete Node


var result =
System.getModule("com.vmware.pso.chef").executeRequest(chefOp,orgName,userid,pem,"",[node]
);

var responseJS = JSON.parse(result);

overrides = JSON.stringify(responseJS.override);
name = responseJS.name;
chef_type = responseJS.chef_type;
json_class = responseJS.json_class;

vCO Workflow Documentation - Jul 6, 2015

Page

259

Get Node By Attribute Value


run_list = JSON.stringify(responseJS.run_list);
defaults = JSON.stringify(responseJS['default']);
automatic = JSON.stringify(responseJS.automatic);
System.log("Successfully deleted node: "+node);
Server.log("Successfully deleted node",node);

12.2.8.3. System+Server error


//Auto-generated script
System.error(text + " - " + object);
Server.error(text, object);

12.2.8.4. System+Server error


//Auto-generated script
System.error(text + " - " + object);
Server.error(text, object);

12.2.8.5. System+Server error


//Auto-generated script
System.error(text + " - " + object);
Server.error(text, object);

12.2.8.6. checkAndGetPem
//Auto generated script, cannot be modified !
actionResult =
System.getModule("com.vmware.pso.chef").checkAndGetPem(pem,configElement,chefHostname,user
id) ;

12.3.

Get Node By Attribute Value

Retrieves details of a particular node on a Chef Server by the value of an


attribute

12.3.1. Versions
Version

Date

User

Comment

0.0.1

May 13, 2013

root

works!

0.0.2

May 14, 2013

root

Get pem from config item

0.0.3

May 14, 2013

root

Doc update

vCO Workflow Documentation - Jul 6, 2015

Page

260

Get Node By Attribute Value


Version

0.1.0

Date

May 30, 2013

User

vCO

Comment

add orgName input

Administra
tor
0.1.1

May 31, 2013

Daniel
Linsley

0.1.2

May 31, 2013

Daniel
Linsley

0.1.3

May 31, 2013

Daniel
Linsley

0.1.4

May 31, 2013

Daniel
Linsley

0.1.5

Jun 3, 2013

Daniel
Linsley

0.1.6

Jun 20, 2013

Daniel
Linsley

0.1.7

Aug 28, 2013

vCO
Administra
tor

0.1.8

Aug 28, 2013

vCO
Administra
tor

0.1.9

Aug 28, 2013

vCO
Administra
tor

0.1.10

Oct 9, 2013

vCO
Administra
tor

0.1.11

Oct 9, 2013

vCO
Administra
tor

0.1.12

Jan 2, 2015

vCO
Administra
tor

vCO Workflow Documentation - Jul 6, 2015

Page

261

Get Node By Attribute Value


Current version:0.1.12

12.3.2. Inputs
Name

Type

Description

chefHostname*

string

userid*

string

orgName*

string

attributeName

string

name of attribute to find node by

attributeValue

string

value of attribute to find node by

pem

string

(Optional)

Private key for the

userid client.

The private key

will be looked up in the <b>Chef


Private Keys</b> Configuration
Element otherwise.

*Parameter is mandatory

12.3.3. Outputs
Name

Type

Description

overrides

string

JSON Obj

name

string

Name of the node

json_class

string

run_list

string

JSON Array

defaults

string

JSON Obj

chef_type

string

automatic

string

JSON Obj

12.3.4. Attributes
Name

chefOp

Type

Description

REST:RESTOperation

vCO Workflow Documentation - Jul 6, 2015

Page

262

Get Node By Attribute Value


Name

Type

Description

errorCode

string

pemAttr

SecureString

configElement

ConfigurationElemen
t

12.3.5. Parameter
Parameter

presentation
Description

Parameter Info

chefHostname

chefHostname

Mandatory input: true

userid

userid

Mandatory input: true

orgName

orgName

Mandatory input:
!GetAction("com.vmware.pso.chef.hel
pers","hideOrgName").call(
#chefHostname )

attributeName

name of attribute
to find node by

attributeValue

value of attribute
to find node by

pem

(Optional)

Private

key for the userid


client.

The

private key will be


looked up in the
<b>Chef Private
Keys</b>
Configuration
Element otherwise.

12.3.6. Workflow

schema

vCO Workflow Documentation - Jul 6, 2015

Page

263

Get Node By Attribute Value

12.3.7. Workflow
Name

items
Type

Next item

Description

WorkflowItemEnd
getSearch

WorkflowItemTask

checkAndGetP
em

Scriptable

WorkflowItemTask

task
WorkflowItemEnd
System+Serve

WorkflowItemTask

Log the input text to the

r error

console and the server log with


level 'error'

System+Serve

WorkflowItemTask

Log the input text to the

r error

console and the server log with


level 'error'

System+Serve

WorkflowItemTask

Log the input text to the

r error

console and the server log with


level 'error'

checkAndGetP

WorkflowItemTask

em

12.3.8. Source

Scriptable
task

code for the used actions

vCO Workflow Documentation - Jul 6, 2015

Page

264

Get Node By Attribute Value

12.3.8.1. getSearch
//Auto generated script, cannot be modified !
actionResult = System.getModule("com.vmware.pso.chef.ops").getSearch(chefHostname,orgName)
;

12.3.8.2. Scriptable task


var result =
System.getModule("com.vmware.pso.chef").executeRequest(chefOp,orgName,userid,pem,"",["node
", attributeName+":"+attributeValue]);

var responseJS = JSON.parse(result);

if (responseJS.rows.length == 0 ) {
throw("Could not find node by attribute specified");
}
if (responseJS.rows.length > 1) {
System.warn("Matched multiple items. Returning first match");
Server.warn("Matched multiple items. Returning first match");
}

var node = responseJS.rows[0];

overrides = JSON.stringify(node.overrides);
name = node.name;
json_class = node.json_class;
run_list = JSON.stringify(node.run_list);
defaults = JSON.stringify(node.defaults);
chef_type = node.chef_type;

12.3.8.3. System+Server error


//Auto-generated script
System.error(text + " - " + object);
Server.error(text, object);

12.3.8.4. System+Server error


//Auto-generated script
System.error(text + " - " + object);
Server.error(text, object);

vCO Workflow Documentation - Jul 6, 2015

Page

265

Get Node Details

12.3.8.5. System+Server error


//Auto-generated script
System.error(text + " - " + object);
Server.error(text, object);

12.3.8.6. checkAndGetPem
//Auto generated script, cannot be modified !
actionResult =
System.getModule("com.vmware.pso.chef").checkAndGetPem(pem,configElement,chefHostname,user
id) ;

12.4.

Get Node Details

Retrieves details of a particular node on a Chef Server.

12.4.1. Versions
Version

Date

User

Comment

0.0.1

May 13, 2013

root

works!

0.0.2

May 14, 2013

root

Get pem from config item

0.0.3

May 14, 2013

root

Doc update

0.1.0

May 30, 2013

vCO

add orgName input

Administra
tor
0.1.1

May 31, 2013

Daniel
Linsley

0.1.2

Jun 20, 2013

Daniel
Linsley

0.1.3

Oct 9, 2013

vCO
Administra
tor

0.1.4

Jan 2, 2015

vCO
Administra
tor

Current version:0.1.4

vCO Workflow Documentation - Jul 6, 2015

Page

266

Get Node Details

12.4.2. Inputs
Name

Type

chefHostname*

string

userid*

string

orgName*

string

node*

string

pem

string

Description

(Optional)

Private key for the

userid client.

The private key

will be looked up in the <b>Chef


Private Keys</b> Configuration
Element otherwise.

*Parameter is mandatory

12.4.3. Outputs
Name

Type

Description

overrides

string

JSON Obj

name

string

Name of the node

json_class

string

run_list

string

JSON Array

defaults

string

JSON Obj

chef_type

string

automatic

string

JSON Obj

nodeJS

string

The raw json object of the node

12.4.4. Attributes
Name

Type

chefOp

REST:RESTOperation

errorCode

string

vCO Workflow Documentation - Jul 6, 2015

Description

Page

267

Get Node Details


Name

Type

Description

pemAttr

SecureString

configElement

ConfigurationElemen
t

12.4.5. Parameter

presentation

Parameter

Description

Parameter Info

chefHostname

chefHostname

Mandatory input: true

userid

userid

Mandatory input: true

node

node

Mandatory input: true

orgName

orgName

Mandatory input:
!GetAction("com.vmware.pso.chef.hel
pers","hideOrgName").call(
#chefHostname )

pem

(Optional)

Private

key for the userid


client.

The

private key will be


looked up in the
<b>Chef Private
Keys</b>
Configuration
Element otherwise.

12.4.6. Workflow

schema

vCO Workflow Documentation - Jul 6, 2015

Page

268

Get Node Details

12.4.7. Workflow
Name

items
Type

Next item

Description

WorkflowItemEnd
getNode

WorkflowItemTask

checkAndGetP
em

Scriptable

WorkflowItemTask

task
WorkflowItemEnd
System+Serve

WorkflowItemTask

Log the input text to the

r error

console and the server log with


level 'error'

System+Serve

WorkflowItemTask

Log the input text to the

r error

console and the server log with


level 'error'

checkAndGetP

WorkflowItemTask

em
System+Serve

Scriptable
task

WorkflowItemTask

r error

Log the input text to the


console and the server log with
level 'error'

12.4.8. Source

code for the used actions

vCO Workflow Documentation - Jul 6, 2015

Page

269

Get Node Details

12.4.8.1. getNode
//Auto generated script, cannot be modified !
actionResult = System.getModule("com.vmware.pso.chef.ops").getNode(chefHostname,orgName) ;

12.4.8.2. Scriptable task


var result =
System.getModule("com.vmware.pso.chef").executeRequest(chefOp,orgName,userid,pem,"",[node]
);

nodeJS = result;
var responseJS = JSON.parse(result);

overrides = JSON.stringify(responseJS.override);
name = responseJS.name;
chef_type = responseJS.chef_type;
json_class = responseJS.json_class;
run_list = JSON.stringify(responseJS.run_list);
defaults = JSON.stringify(responseJS['default']);
automatic = JSON.stringify(responseJS.automatic);

12.4.8.3. System+Server error


//Auto-generated script
System.error(text + " - " + object);
Server.error(text, object);

12.4.8.4. System+Server error


//Auto-generated script
System.error(text + " - " + object);
Server.error(text, object);

12.4.8.5. checkAndGetPem
//Auto generated script, cannot be modified !
actionResult =
System.getModule("com.vmware.pso.chef").checkAndGetPem(pem,configElement,chefHostname,user
id) ;

12.4.8.6. System+Server error

vCO Workflow Documentation - Jul 6, 2015

Page

270

Get Nodes

//Auto-generated script
System.error(text + " - " + object);
Server.error(text, object);

12.5.

Get Nodes

Returns a list of nodes from Chef server

12.5.1. Versions
Version

Date

User

Comment

0.0.1

May 13, 2013

root

works!

0.0.2

May 14, 2013

root

get pem from config

0.1.0

May 30, 2013

vCO

add orgName input

Administra
tor
0.1.1

Jan 2, 2015

vCO
Administra
tor

Current version:0.1.1

12.5.2. Inputs
Name

Type

chefHostname*

string

userid*

string

orgName*

string

pem

string

Description

(Optional)

Private key for the

userid client.

The private key

will be looked up in the <b>Chef


Private Keys</b> Configuration
Element otherwise.

*Parameter is mandatory

12.5.3. Outputs
Name

vCO Workflow Documentation - Jul 6, 2015

Type

Description

Page

271

Get Nodes
Name

Type

Description

nodes

Array/string

Node Names

urls

Array/string

Node URLs

12.5.4. Attributes
Name

Type

Description

chefOp

REST:RESTOperation

errorCode

string

configElement

ConfigurationElemen
t

pemAttr

SecureString

12.5.5. Parameter
Parameter

presentation
Description

Parameter Info

chefHostname

chefHostname

Mandatory input: true

userid

userid

Mandatory input: true

orgName

orgName

Mandatory input:
!GetAction("com.vmware.pso.chef.hel
pers","hideOrgName").call(
#chefHostname )

pem

(Optional)

Private

key for the userid


client.

The

private key will be


looked up in the
<b>Chef Private
Keys</b>
Configuration
Element otherwise.

12.5.6. Workflow

schema

vCO Workflow Documentation - Jul 6, 2015

Page

272

Get Nodes

12.5.7. Workflow
Name

items
Type

Next item

Description

WorkflowItemEnd
getNodes

WorkflowItemTask

checkAndGetP
em

Scriptable

WorkflowItemTask

task
checkAndGetP

WorkflowItemTask

em
System+Serve

Scriptable
task

WorkflowItemTask

r error

Log the input text to the


console and the server log with
level 'error'

System+Serve

WorkflowItemTask

r error

Log the input text to the


console and the server log with
level 'error'

System+Serve

WorkflowItemTask

r error

Log the input text to the


console and the server log with
level 'error'

WorkflowItemEnd

12.5.8. Source

code for the used actions

vCO Workflow Documentation - Jul 6, 2015

Page

273

Get Nodes

12.5.8.1. getNodes
//Auto generated script, cannot be modified !
actionResult = System.getModule("com.vmware.pso.chef.ops").getNodes(chefHostname,orgName)
;

12.5.8.2. Scriptable task


var result =
System.getModule("com.vmware.pso.chef").executeRequest(chefOp,orgName,userid,pem,"",[]);

var responseJS = JSON.parse(result);

nodes = new Array();


urls = new Array();

for(var i in responseJS) {
nodes.push(i);
urls.push(responseJS[i]);
}

12.5.8.3. checkAndGetPem
//Auto generated script, cannot be modified !
actionResult =
System.getModule("com.vmware.pso.chef").checkAndGetPem(pem,configElement,chefHostname,user
id) ;

12.5.8.4. System+Server error


//Auto-generated script
System.error(text + " - " + object);
Server.error(text, object);

12.5.8.5. System+Server error


//Auto-generated script
System.error(text + " - " + object);
Server.error(text, object);

12.5.8.6. System+Server error

vCO Workflow Documentation - Jul 6, 2015

Page

274

Register Node

//Auto-generated script
System.error(text + " - " + object);
Server.error(text, object);

12.6.

Register Node

Registers a new node to a Chef Server.


has Chef Client installed.

Assumes node is linux and already

This workflow creates the appropriate files on the target node:


- /etc/chef/client.rb
- /etc/chef/first-boot.js
- /etc/chef/<org>-validator.pem
And runs chef-client

12.6.1. Versions
Version

0.0.1

Date

May 30, 2013

User

Comment

Daniel
Linsley

0.0.2

May 30, 2013

Daniel
Linsley

0.0.3

May 30, 2013

Daniel
Linsley

0.0.4

May 30, 2013

Daniel
Linsley

0.0.5

May 30, 2013

Daniel
Linsley

0.0.6

May 30, 2013

Daniel
Linsley

0.0.7

May 30, 2013

Daniel
Linsley

0.0.8

May 30, 2013

Daniel
Linsley

0.0.9

May 30, 2013

Daniel
Linsley

vCO Workflow Documentation - Jul 6, 2015

Page

275

Register Node
Version

Date

0.0.10

User

May 31, 2013

Comment

Daniel
Linsley

0.0.11

May 31, 2013

Daniel
Linsley

0.0.12

May 31, 2013

Daniel
Linsley

0.0.13

May 31, 2013

Daniel
Linsley

0.0.14

May 31, 2013

Daniel
Linsley

0.0.15

May 31, 2013

Daniel
Linsley

0.0.16

May 31, 2013

Daniel
Linsley

0.0.17

Jun 20, 2013

Daniel
Linsley

0.0.18

Aug 28, 2013

vCO
Administra
tor

0.0.19

Oct 9, 2013

vCO
Administra
tor

Current version:0.0.19

12.6.2. Inputs
Name

Type

Description

chefHostname

string

orgName

string

ipaddress

string

hostname/ip of target node for ssh

nodename

string

fqdn to be used as the chef node


name

vCO Workflow Documentation - Jul 6, 2015

Page

276

Register Node
Name

Type

Description

username

string

ssh username of target node

password

SecureString

ssh password of target node

runlist

Array/string

environment

string

12.6.3. Attributes
Name

configElement

Type

Description

ConfigurationElemen
t

validatorid

string

validatorPem

SecureString

validatorPemCommand

string

passwordAuthentication

boolean

Sets authentication to password or


key file

result

number

0 = OK, Negative = Error, Positive


= Number of values returned, after
error text

errorText

string

Error text, if any

outputText

string

Result of running the SSH command

clientConfig

string

firstBootJSON

string

clientConfigCommand

string

firstBootJsonCommand

string

clientRunCommand

string

12.6.4. Parameter
Parameter

presentation
Description

vCO Workflow Documentation - Jul 6, 2015

Parameter Info

Page

277

Register Node
Parameter

Description

chefHostname

chefHostname

orgName

orgName

ipaddress

hostname/ip of

Parameter Info

target node for ssh


nodename

fqdn to be used as
the chef node name

username

ssh username of
target node

password

ssh password of
target node

runlist

runlist

environment

environment

12.6.5. Workflow

schema

12.6.6. Workflow

items

Name

Type

Next item

Description

WorkflowItemEnd

vCO Workflow Documentation - Jul 6, 2015

Page

278

Register Node
Name

getPrivateKe

Type

WorkflowItemTask

yFromConfig

Next item

Description

Create
client
config

create

WorkflowItemTask

validatorid
Create

getPrivateKe
yFromConfig

WorkflowItemTask

Create

client

first-

config

boot.json

Write Config

WorkflowItemLink

Write

Runs an SSH command.

Validator
Create

WorkflowItemTask

Write Config

WorkflowItemLink

Write first-

Commands
Write
Validator

Runs an SSH command.

boot.json

First Run!

WorkflowItemLink

Create

WorkflowItemTask

first-

Runs an SSH command.


Create
Commands

boot.json
Write first-

WorkflowItemLink

First Run!

Runs an SSH command.

boot.json

12.6.7. Source

code for the used actions

12.6.7.1. getPrivateKeyFromConfig
//Auto generated script, cannot be modified !
actionResult =
System.getModule("com.vmware.pso.chef").getPrivateKeyFromConfig(configElement,chefHostname
,userid) ;

12.6.7.2. create validatorid


if (orgName !=null && orgName.length > 0) {
validatorid = orgName+"-validator";
} else {
validatorid = "validator";

vCO Workflow Documentation - Jul 6, 2015

Page

279

Tag Node
}

12.6.7.3. Create client config


clientConfig =

"validation_client_name

"validation_key

'/etc/chef/"+validatorid+".pem'\n"+

"chef_server_url
"node_name

'"+validatorid+"'\n" +

'https://"+chefHostname+"/organizations/"+orgName+"'\n"+

'"+nodename+"'";

12.6.7.4. Create Commands


clientConfigCommand = "mkdir -p /etc/chef; echo \""+clientConfig+"\" >
/etc/chef/client.rb";
validatorPemCommand = "echo \""+validatorPem+"\" > /etc/chef/"+validatorid+".pem";
firstBootJsonCommand = "echo '"+firstBootJSON+"' > /etc/chef/first-boot.json";

clientRunCommand = "chef-client -j /etc/chef/first-boot.json";

if (environment != null && environment.length > 0) {


clientRunCommand += " -E "+environment;
}

12.6.7.5. Create first-boot.json


var firstBoot = {};
firstBoot.run_list = runlist;
firstBoot.accessibleIp = ipaddress;

firstBootJSON = JSON.stringify(firstBoot);

12.7.

Tag Node

Adds a tag to a Chef node.


command.

This is similar to the "knife tag node create"

12.7.1. Versions
Version

0.0.1

Date

Dec 22, 2014

User

Comment

vCO
Administra
tor

0.0.2

Jan 2, 2015

vCO
Administra
tor

vCO Workflow Documentation - Jul 6, 2015

Page

280

Tag Node
Version

0.0.3

Date

User

Apr 4, 2015

Comment

vCO
Administra
tor

0.0.4

Apr 30, 2015

vCO
Administra
tor

0.0.5

Apr 30, 2015

vCO
Administra
tor

0.0.6

Jul 6, 2015

vCO
Administra
tor

0.0.7

Jul 8, 2015

vCO
Administra
tor

Current version:0.0.7

12.7.2. Inputs
Name

Type

Description

chefHostname*

string

userid*

string

orgName*

string

node*

string

tag*

string

Tag to add

pem

string

(Optional)

Private key for the

userid client.

The private key

will be looked up in the <b>Chef


Private Keys</b> Configuration
Element otherwise.

*Parameter is mandatory

12.7.3. Attributes

vCO Workflow Documentation - Jul 6, 2015

Page

281

Tag Node

Name

Type

nodeJS

string

attributeClass

string

attributeName

string

attributeValueJS

string

Description

The raw json object of the node

could be a string, number, boolean,


array, etc.

12.7.4. Parameter

presentation

Parameter

Description

Parameter Info

chefHostname

chefHostname

Mandatory input: true

userid

userid

Mandatory input: true

orgName

orgName

Mandatory input:
!GetAction("com.vmware.pso.chef.hel
pers","hideOrgName").call(
#chefHostname )

node

node

Mandatory input: true

tag

tag to add

Mandatory input: true

pem

(Optional)

Private

key for the userid


client.

The

private key will be


looked up in the
<b>Chef Private
Keys</b>
Configuration
Element otherwise.

12.7.5. Workflow

schema

vCO Workflow Documentation - Jul 6, 2015

Page

282

Tag Node

12.7.6. Workflow
Name

items
Type

Next item

Description

WorkflowItemEnd
Get Node

WorkflowItemLink

Details

Add to Tag

Retrieves details of a

attribute

particular node on a Chef


Server.

Set Single

WorkflowItemLink

Adds or replaces a single

Node

attribute to a node.

Attribute
Add to Tag

WorkflowItemTask

attribute

Set Single
Node
Attribute

12.7.7. Source

code for the used actions

12.7.7.1. Add to Tag attribute


var nodeObj = JSON.parse(nodeJS);

if (nodeObj.normal.tags != null) {
var tags = nodeObj.normal.tags;
var found = false;
for (var i in tags) {
if (tags[i] == tag) {
found = true;
break;
}
}
if (!found) {
tags.push(tag);
}

vCO Workflow Documentation - Jul 6, 2015

Page

283

Untag Node
attributeValueJS = JSON.stringify(tags);
} else

attributeValueJS = JSON.stringify([tag]);
}

12.8.

Untag Node

Adds a tag to a Chef node.


command.

This is similar to the "knife tag node delete"

12.8.1. Versions
Version

0.0.1

Date

User

Jan 2, 2015

Comment

vCO
Administra
tor

0.0.2

Apr 4, 2015

vCO
Administra
tor

0.0.3

Apr 30, 2015

vCO
Administra
tor

0.0.4

Apr 30, 2015

vCO
Administra
tor

0.0.5

Jul 6, 2015

vCO
Administra
tor

Current version:0.0.5

12.8.2. Inputs
Name

Type

chefHostname*

string

userid*

string

orgName*

string

node*

string

tag*

string

vCO Workflow Documentation - Jul 6, 2015

Description

Tag to remove

Page

284

Untag Node
Name

Type

pem

string

Description

(Optional)

Private key for the

userid client.

The private key

will be looked up in the <b>Chef


Private Keys</b> Configuration
Element otherwise.

*Parameter is mandatory

12.8.3. Attributes
Name

Type

nodeJS

string

attributeClass

string

attributeName

string

attributeValueJS

string

Description

The raw json object of the node

could be a string, number, boolean,


array, etc.

12.8.4. Parameter

presentation

Parameter

Description

Parameter Info

chefHostname

chefHostname

Mandatory input: true

userid

userid

Mandatory input: true

orgName

orgName

Mandatory input:
!GetAction("com.vmware.pso.chef.hel
pers","hideOrgName").call(
#chefHostname )

node

node

Mandatory input: true

tag

Tag to remove

Mandatory input: true

vCO Workflow Documentation - Jul 6, 2015

Page

285

Untag Node
Parameter

Description

pem

(Optional)

Parameter Info

Private

key for the userid


client.

The

private key will be


looked up in the
<b>Chef Private
Keys</b>
Configuration
Element otherwise.

12.8.5. Workflow

schema

12.8.6. Workflow

items

Name

Type

Next item

Description

WorkflowItemEnd
Get Node

WorkflowItemLink

Details

Set Single

Remove from

Retrieves details of a

tag

particular node on a Chef

attribute

Server.

WorkflowItemLink

Adds or replaces a single

Node

attribute to a node.

Attribute
Remove from

WorkflowItemTask

Set Single

tag

Node

attribute

Attribute

12.8.7. Source

code for the used actions

12.8.7.1. Remove from tag attribute

vCO Workflow Documentation - Jul 6, 2015

Page

286

Update Environment for Node

var nodeObj = JSON.parse(nodeJS);

if (nodeObj.normal.tags != null) {
var tags = nodeObj.normal.tags;
var found = false;
for (var i in tags) {
if (tags[i] == tag) {
found = true;
tags.splice(i,1);
break;
}
}
attributeValueJS = JSON.stringify(tags);
}

12.9.

Update Environment for Node

Updates the environment for a node on a Chef Server.


For the new run list to be applied chef-client needs to be run on the
node.

12.9.1. Versions
Version

Date

User

Comment

0.0.1

May 13, 2013

root

works!

0.0.2

May 14, 2013

root

Get pem from config item

0.0.3

May 14, 2013

root

Doc update

0.1.0

May 30, 2013

vCO

add orgName input

Administra
tor
0.1.1

May 30, 2013

vCO
Administra
tor

0.1.2

May 30, 2013

Daniel
Linsley

0.1.3

May 30, 2013

Daniel
Linsley

vCO Workflow Documentation - Jul 6, 2015

Page

287

Update Environment for Node


Version

0.1.4

Date

May 30, 2013

User

Comment

Daniel
Linsley

0.1.5

May 31, 2013

Daniel
Linsley

0.1.6

Jun 20, 2013

Daniel
Linsley

0.1.7

Oct 9, 2013

vCO
Administra
tor

0.1.8

Oct 9, 2013

vCO
Administra
tor

0.1.9

Oct 9, 2013

vCO
Administra
tor

0.1.10

Oct 9, 2013

vCO
Administra
tor

0.1.11

Nov 24, 2014

vCO
Administra
tor

0.1.12

Apr 30, 2015

vCO
Administra
tor

0.1.13

Apr 30, 2015

vCO
Administra
tor

0.1.14

Jul 6, 2015

vCO
Administra
tor

0.1.15

Jul 6, 2015

vCO
Administra
tor

vCO Workflow Documentation - Jul 6, 2015

Page

288

Update Environment for Node


Current version:0.1.15

12.9.2. Inputs
Name

Type

chefHostname*

string

userid*

string

orgName

string

node*

string

environment*

string

pem

string

Description

(Optional)

Private key for the

userid client.

The private key

will be looked up in the <b>Chef


Private Keys</b> Configuration
Element otherwise.

*Parameter is mandatory

12.9.3. Outputs
Name

Type

Description

overrides

string

JSON Obj

name

string

Name of the node

json_class

string

run_list

string

JSON Array

defaults

string

JSON Obj

chef_type

string

automatic

string

JSON Obj

12.9.4. Attributes
Name

chefOp

Type

Description

REST:RESTOperation

vCO Workflow Documentation - Jul 6, 2015

Page

289

Update Environment for Node


Name

Type

Description

errorCode

string

pemAttr

SecureString

configElement

ConfigurationElemen
t

chefGetOp

REST:RESTOperation

12.9.5. Parameter

presentation

Parameter

Description

Parameter Info

chefHostname

chefHostname

Mandatory input: true

userid

userid

Mandatory input: true

orgName

orgName

node

node

Mandatory input: true

environment

environment

Mandatory input: true

pem

(Optional)

Private

key for the userid


client.

The

private key will be


looked up in the
<b>Chef Private
Keys</b>
Configuration
Element otherwise.

12.9.6. Workflow

schema

vCO Workflow Documentation - Jul 6, 2015

Page

290

Update Environment for Node

12.9.7. Workflow
Name

items
Type

Next item

Description

WorkflowItemEnd
putNode

WorkflowItemTask

checkAndGetP
em

Scriptable

WorkflowItemTask

task
WorkflowItemEnd
System+Serve

WorkflowItemTask

Log the input text to the

r error

console and the server log with


level 'error'

System+Serve

WorkflowItemTask

Log the input text to the

r error

console and the server log with


level 'error'

checkAndGetP

WorkflowItemTask

em
System+Serve

Scriptable
task

WorkflowItemTask

Log the input text to the

r error

console and the server log with


level 'error'

getNode

WorkflowItemTask

12.9.8. Source

putNode

code for the used actions

12.9.8.1. putNode

vCO Workflow Documentation - Jul 6, 2015

Page

291

Update Environment for Node

//Auto generated script, cannot be modified !


actionResult = System.getModule("com.vmware.pso.chef.ops").putNode(chefHostname,orgName) ;

12.9.8.2. Scriptable task


var result =
System.getModule("com.vmware.pso.chef").executeRequest(chefGetOp,orgName,userid,pem,"",[no
de]);

var body = JSON.parse(result);


body.chef_environment = environment;

var bodyJS = JSON.stringify(body);


var result =
System.getModule("com.vmware.pso.chef").executeRequest(chefOp,orgName,userid,pem,bodyJS,[n
ode]);

var responseJS = JSON.parse(result);

overrides = JSON.stringify(responseJS.override);
name = responseJS.name;
chef_type = responseJS.chef_type;
json_class = responseJS.json_class;
run_list = JSON.stringify(responseJS.run_list);
defaults = JSON.stringify(responseJS['default']);
automatic = JSON.stringify(responseJS.automatic);

12.9.8.3. System+Server error


//Auto-generated script
System.error(text + " - " + object);
Server.error(text, object);

12.9.8.4. System+Server error


//Auto-generated script
System.error(text + " - " + object);
Server.error(text, object);

12.9.8.5. checkAndGetPem

vCO Workflow Documentation - Jul 6, 2015

Page

292

Update Runlist on Node


//Auto generated script, cannot be modified !
actionResult =
System.getModule("com.vmware.pso.chef").checkAndGetPem(pem,configElement,chefHostname,user
id) ;

12.9.8.6. System+Server error


//Auto-generated script
System.error(text + " - " + object);
Server.error(text, object);

12.9.8.7. getNode
//Auto generated script, cannot be modified !
actionResult = System.getModule("com.vmware.pso.chef.ops").getNode(chefHostname,orgName) ;

12.10.

Update Runlist on Node

Updates the run_list for a node on a Chef Server.


Requires the chef-client to be run on the node for the change to be
realized.

12.10.1. Versions
Version

Date

User

Comment

0.0.1

May 13, 2013

root

works!

0.0.2

May 14, 2013

root

Get pem from config item

0.0.3

May 14, 2013

root

Doc update

0.1.0

May 30, 2013

vCO

add orgName input

Administra
tor
0.1.1

May 30, 2013

vCO
Administra
tor

0.1.2

May 30, 2013

Daniel
Linsley

0.1.3

May 30, 2013

Daniel
Linsley

vCO Workflow Documentation - Jul 6, 2015

Page

293

Update Runlist on Node


Version

0.1.4

Date

User

May 30, 2013

Comment

Daniel
Linsley

0.1.5

Jun 20, 2013

Daniel
Linsley

0.1.6

Oct 9, 2013

vCO
Administra
tor

0.1.7

Oct 9, 2013

vCO
Administra
tor

0.1.8

Feb 26, 2014

vCO
Administra
tor

0.1.9

Nov 24, 2014

vCO
Administra
tor

0.1.10

Apr 30, 2015

vCO
Administra
tor

0.1.11

Jul 6, 2015

vCO
Administra
tor

0.1.12

Jul 6, 2015

vCO
Administra
tor

Current version:0.1.12

12.10.2. Inputs
Name

Type

chefHostname*

string

userid*

string

orgName

string

vCO Workflow Documentation - Jul 6, 2015

Description

Page

294

Update Runlist on Node


Name

Type

node*

string

runlist

Array/string

pem

string

Description

(Optional)

Private key for the

userid client.

The private key

will be looked up in the <b>Chef


Private Keys</b> Configuration
Element otherwise.

*Parameter is mandatory

12.10.3. Outputs
Name

Type

Description

overrides

string

JSON Obj

name

string

Name of the node

json_class

string

run_list

string

JSON Array

defaults

string

JSON Obj

chef_type

string

automatic

string

JSON Obj

12.10.4. Attributes
Name

Type

chefOp

REST:RESTOperation

errorCode

string

pemAttr

SecureString

configElement

ConfigurationElemen

Description

t
chefGetOp

REST:RESTOperation

vCO Workflow Documentation - Jul 6, 2015

Page

295

Update Runlist on Node

12.10.5. Parameter

presentation

Parameter

Description

Parameter Info

chefHostname

chefHostname

Mandatory input: true

userid

userid

Mandatory input: true

orgName

orgName

node

node

runlist

runlist

pem

(Optional)

Mandatory input: true

Private

key for the userid


client.

The

private key will be


looked up in the
<b>Chef Private
Keys</b>
Configuration
Element otherwise.

12.10.6. Workflow

schema

12.10.7. Workflow

items

Name

Type

Next item

Description

WorkflowItemEnd
putNode

WorkflowItemTask

checkAndGetP
em

vCO Workflow Documentation - Jul 6, 2015

Page

296

Update Runlist on Node


Name

Scriptable

Type

Next item

Description

WorkflowItemTask

task
WorkflowItemEnd
System+Serve

WorkflowItemTask

Log the input text to the

r error

console and the server log with


level 'error'

System+Serve

WorkflowItemTask

Log the input text to the

r error

console and the server log with


level 'error'

checkAndGetP

WorkflowItemTask

em
System+Serve

Scriptable
task

WorkflowItemTask

Log the input text to the

r error

console and the server log with


level 'error'

getNode

WorkflowItemTask

12.10.8. Source

putNode

code for the used actions

12.10.8.1. putNode
//Auto generated script, cannot be modified !
actionResult = System.getModule("com.vmware.pso.chef.ops").putNode(chefHostname,orgName) ;

12.10.8.2. Scriptable task


var result =
System.getModule("com.vmware.pso.chef").executeRequest(chefGetOp,orgName,userid,pem,"",[no
de]);

var body = JSON.parse(result);


body.run_list = runlist;

var bodyJS = JSON.stringify(body);

var result =
System.getModule("com.vmware.pso.chef").executeRequest(chefOp,orgName,userid,pem,bodyJS,[n
ode]);

vCO Workflow Documentation - Jul 6, 2015

Page

297

Delete Single Node Attribute

var responseJS = JSON.parse(result);

overrides = JSON.stringify(responseJS.override);
name = responseJS.name;
chef_type = responseJS.chef_type;
json_class = responseJS.json_class;
run_list = JSON.stringify(responseJS.run_list);
defaults = JSON.stringify(responseJS['default']);
automatic = JSON.stringify(responseJS.automatic);

12.10.8.3. System+Server error


//Auto-generated script
System.error(text + " - " + object);
Server.error(text, object);

12.10.8.4. System+Server error


//Auto-generated script
System.error(text + " - " + object);
Server.error(text, object);

12.10.8.5. checkAndGetPem
//Auto generated script, cannot be modified !
actionResult =
System.getModule("com.vmware.pso.chef").checkAndGetPem(pem,configElement,chefHostname,user
id) ;

12.10.8.6. System+Server error


//Auto-generated script
System.error(text + " - " + object);
Server.error(text, object);

12.10.8.7. getNode
//Auto generated script, cannot be modified !
actionResult = System.getModule("com.vmware.pso.chef.ops").getNode(chefHostname,orgName) ;

Attributes

12.11.
12.11.1.

Delete Single Node Attribute

vCO Workflow Documentation - Jul 6, 2015

Page

298

Delete Single Node Attribute


Deletes a single attribute from a node.

12.11.1.1. Versions
Version

Date

User

Comment

0.0.1

May 13, 2013

root

works!

0.0.2

May 14, 2013

root

Get pem from config item

0.0.3

May 14, 2013

root

Doc update

0.1.0

May 30, 2013

vCO

add orgName input

Administra
tor
0.1.1

May 31, 2013

Daniel
Linsley

0.1.2

Jun 20, 2013

Daniel
Linsley

0.1.3

Jul 29, 2013

vCO
Administra
tor

0.1.4

Jul 29, 2013

vCO
Administra
tor

0.1.5

Jul 29, 2013

vCO
Administra
tor

0.1.6

Jul 29, 2013

vCO
Administra
tor

0.1.7

Aug 1, 2013

vCO
Administra
tor

0.1.8

Aug 1, 2013

vCO
Administra
tor

vCO Workflow Documentation - Jul 6, 2015

Page

299

Delete Single Node Attribute


Version

0.1.9

Date

Aug 1, 2013

User

Comment

vCO
Administra
tor

0.1.10

Aug 1, 2013

vCO
Administra
tor

0.1.11

Aug 1, 2013

vCO
Administra
tor

0.1.12

Aug 1, 2013

vCO
Administra
tor

0.1.13

Aug 1, 2013

vCO
Administra
tor

0.1.14

Aug 1, 2013

vCO
Administra
tor

0.1.15

Aug 1, 2013

vCO
Administra
tor

0.1.16

Aug 1, 2013

vCO
Administra
tor

0.1.17

Aug 1, 2013

vCO
Administra
tor

0.1.18

Aug 1, 2013

vCO
Administra
tor

0.1.19

Aug 1, 2013

vCO
Administra
tor

vCO Workflow Documentation - Jul 6, 2015

Page

300

Delete Single Node Attribute


Version

0.1.20

Date

User

Aug 1, 2013

Comment

vCO
Administra
tor

0.1.21

Aug 1, 2013

vCO
Administra
tor

0.1.22

Aug 1, 2013

vCO
Administra
tor

0.1.23

Aug 1, 2013

vCO
Administra
tor

0.1.24

Aug 1, 2013

vCO
Administra
tor

0.1.25

Aug 1, 2013

vCO
Administra
tor

0.1.26

Oct 9, 2013

vCO
Administra
tor

0.1.27

Oct 9, 2013

vCO
Administra
tor

0.1.28

Jan 2, 2015

vCO
Administra
tor

Current version:0.1.28

12.11.1.2. Inputs
Name

Type

chefHostname*

string

userid*

string

vCO Workflow Documentation - Jul 6, 2015

Description

Page

301

Delete Single Node Attribute


Name

Type

orgName*

string

node*

string

attributeClass*

string

attributeName*

string

pem

string

Description

(Optional)

Private key for the

userid client.

The private key

will be looked up in the <b>Chef


Private Keys</b> Configuration
Element otherwise.

*Parameter is mandatory

12.11.1.3. Outputs
Name

nodeJS

Type

Description

Type

Description

string

12.11.1.4. Attributes
Name

chefOp

REST:RESTOperation

errorCode

string

pemAttr

SecureString

configElement

ConfigurationElemen
t

chefGetOp

REST:RESTOperation

12.11.1.5. Parameter
Parameter

presentation
Description

Parameter Info

chefHostname

chefHostname

Mandatory input: true

userid

userid

Mandatory input: true

vCO Workflow Documentation - Jul 6, 2015

Page

302

Delete Single Node Attribute


Parameter

Description

Parameter Info

orgName

orgName

Mandatory input:
!GetAction("com.vmware.pso.chef.hel
pers","hideOrgName").call(
#chefHostname )

node

node

Mandatory input: true

attributeClass

attributeClass

Mandatory input: true

attributeName

attributeName

Mandatory input: true

pem

(Optional)

Private

key for the userid


client.

The

private key will be


looked up in the
<b>Chef Private
Keys</b>
Configuration
Element otherwise.

12.11.1.6. Workflow

schema

12.11.1.7. Workflow

items

Name

Type

Next item

Description

WorkflowItemEnd
putNode

WorkflowItemTask

checkAndGetP
em

vCO Workflow Documentation - Jul 6, 2015

Page

303

Delete Single Node Attribute


Name

Scriptable

Type

Next item

Description

WorkflowItemTask

task
WorkflowItemEnd
System+Serve

WorkflowItemTask

Log the input text to the

r error

console and the server log with


level 'error'

System+Serve

WorkflowItemTask

Log the input text to the

r error

console and the server log with


level 'error'

checkAndGetP

WorkflowItemTask

em
System+Serve

Scriptable
task

WorkflowItemTask

Log the input text to the

r error

console and the server log with


level 'error'

getNode

WorkflowItemTask

12.11.1.8. Source

putNode

code for the used actions

12.11.1.8.1. putNode
//Auto generated script, cannot be modified !
actionResult = System.getModule("com.vmware.pso.chef.ops").putNode(chefHostname,orgName) ;

12.11.1.8.2. Scriptable task


var result =
System.getModule("com.vmware.pso.chef").executeRequest(chefGetOp,orgName,userid,pem,"",[no
de]);
var responseObj = JSON.parse(result);

if (responseObj[attributeClass] === undefined) {


throw("Invalid attribute class for node");
}
if (responseObj[attributeClass][attributeName] === undefined) {
throw("Attribute: "+attributeName+" does not exist on node");
}

vCO Workflow Documentation - Jul 6, 2015

Page

304

Set Node Attributes


delete responseObj[attributeClass][attributeName];

var newNodeJS = JSON.stringify(responseObj);

System.log("body: "+newNodeJS);
nodeJS =
System.getModule("com.vmware.pso.chef").executeRequest(chefOp,orgName,userid,pem,newNodeJS
,[node]);

System.log("Successfully deleted node attribute: "+attributeName);


Server.log("Successfully deleted node attribute", attributeName);

12.11.1.8.3. System+Server error


//Auto-generated script
System.error(text + " - " + object);
Server.error(text, object);

12.11.1.8.4. System+Server error


//Auto-generated script
System.error(text + " - " + object);
Server.error(text, object);

12.11.1.8.5. checkAndGetPem
//Auto generated script, cannot be modified !
actionResult =
System.getModule("com.vmware.pso.chef").checkAndGetPem(pem,configElement,chefHostname,user
id) ;

12.11.1.8.6. System+Server error


//Auto-generated script
System.error(text + " - " + object);
Server.error(text, object);

12.11.1.8.7. getNode
//Auto generated script, cannot be modified !
actionResult = System.getModule("com.vmware.pso.chef.ops").getNode(chefHostname,orgName) ;

12.11.2.

Set Node Attributes

vCO Workflow Documentation - Jul 6, 2015

Page

305

Set Node Attributes


Adds or replaces a set of attributes for a node.

12.11.2.1. Versions
Version

Date

User

Comment

0.0.1

May 13, 2013

root

works!

0.0.2

May 14, 2013

root

Get pem from config item

0.0.3

May 14, 2013

root

Doc update

0.1.0

May 30, 2013

vCO

add orgName input

Administra
tor
0.1.1

May 31, 2013

Daniel
Linsley

0.1.2

Jun 20, 2013

Daniel
Linsley

0.1.3

Jul 29, 2013

vCO
Administra
tor

0.1.4

Jul 29, 2013

vCO
Administra
tor

0.1.5

Jul 29, 2013

vCO
Administra
tor

0.1.6

Jul 29, 2013

vCO
Administra
tor

0.1.7

Aug 1, 2013

vCO
Administra
tor

0.1.8

Aug 1, 2013

vCO
Administra
tor

vCO Workflow Documentation - Jul 6, 2015

Page

306

Set Node Attributes


Version

0.1.9

Date

Aug 1, 2013

User

Comment

vCO
Administra
tor

0.1.10

Aug 1, 2013

vCO
Administra
tor

0.1.11

Aug 1, 2013

vCO
Administra
tor

0.1.12

Aug 1, 2013

vCO
Administra
tor

0.1.13

Aug 1, 2013

vCO
Administra
tor

0.1.14

Aug 1, 2013

vCO
Administra
tor

0.1.15

Oct 9, 2013

vCO
Administra
tor

0.1.16

Jan 2, 2015

vCO
Administra
tor

0.1.17

Jul 6, 2015

vCO
Administra
tor

0.1.18

Jul 6, 2015

vCO
Administra
tor

Current version:0.1.18

12.11.2.2. Inputs
Name

vCO Workflow Documentation - Jul 6, 2015

Type

Description

Page

307

Set Node Attributes


Name

Type

chefHostname*

string

userid*

string

orgName*

string

node*

string

attributeClass*

string

attributesJS*

string

Description

JSON object of attributes to


add/update

pem

string

(Optional)

Private key for the

userid client.

The private key

will be looked up in the <b>Chef


Private Keys</b> Configuration
Element otherwise.

*Parameter is mandatory

12.11.2.3. Outputs
Name

nodeJS

Type

string

Description

The raw json object of the node

12.11.2.4. Attributes
Name

Type

chefOp

REST:RESTOperation

errorCode

string

pemAttr

SecureString

configElement

ConfigurationElemen

Description

t
chefGetOp

REST:RESTOperation

12.11.2.5. Parameter

presentation

vCO Workflow Documentation - Jul 6, 2015

Page

308

Set Node Attributes


Parameter

Description

Parameter Info

chefHostname

chefHostname

Mandatory input: true

userid

userid

Mandatory input: true

node

node

Mandatory input: true

orgName

orgName

Mandatory input:
!GetAction("com.vmware.pso.chef.hel
pers","hideOrgName").call(
#chefHostname )

attributesJS

attributesJS

Mandatory input: true

attributeClass

attributeClass

Mandatory input: true

pem

(Optional)

Private

key for the userid


client.

The

private key will be


looked up in the
<b>Chef Private
Keys</b>
Configuration
Element otherwise.

12.11.2.6. Workflow

schema

12.11.2.7. Workflow

items

Name

Type

Next item

Description

WorkflowItemEnd

vCO Workflow Documentation - Jul 6, 2015

Page

309

Set Node Attributes


Name

putNode

Type

WorkflowItemTask

Next item

Description

checkAndGetP
em

Scriptable

WorkflowItemTask

task
WorkflowItemEnd
System+Serve

WorkflowItemTask

Log the input text to the

r error

console and the server log with


level 'error'

System+Serve

WorkflowItemTask

Log the input text to the

r error

console and the server log with


level 'error'

checkAndGetP

WorkflowItemTask

em
System+Serve

Scriptable
task

WorkflowItemTask

Log the input text to the

r error

console and the server log with


level 'error'

getNode

WorkflowItemTask

12.11.2.8. Source

putNode

code for the used actions

12.11.2.8.1. putNode
//Auto generated script, cannot be modified !
actionResult = System.getModule("com.vmware.pso.chef.ops").putNode(chefHostname,orgName) ;

12.11.2.8.2. Scriptable task


var result =
System.getModule("com.vmware.pso.chef").executeRequest(chefGetOp,orgName,userid,pem,"",[no
de]);

nodeJS = result;
var responseObj = JSON.parse(result);

var newAttrs = JSON.parse(attributesJS);

vCO Workflow Documentation - Jul 6, 2015

Page

310

Set Node Attributes


if(responseObj[attributeClass] === undefined) {
throw ("Invalid attribute class for node");
}

for (var i in newAttrs) {


responseObj[attributeClass][i] = newAttrs[i];
}

newNodeJS = JSON.stringify(responseObj);

result =
System.getModule("com.vmware.pso.chef").executeRequest(chefOp,orgName,userid,pem,newNodeJS
,[node]);

nodeJS = result;

12.11.2.8.3. System+Server error


//Auto-generated script
System.error(text + " - " + object);
Server.error(text, object);

12.11.2.8.4. System+Server error


//Auto-generated script
System.error(text + " - " + object);
Server.error(text, object);

12.11.2.8.5. checkAndGetPem
//Auto generated script, cannot be modified !
actionResult =
System.getModule("com.vmware.pso.chef").checkAndGetPem(pem,configElement,chefHostname,user
id) ;

12.11.2.8.6. System+Server error


//Auto-generated script
System.error(text + " - " + object);
Server.error(text, object);

12.11.2.8.7. getNode

vCO Workflow Documentation - Jul 6, 2015

Page

311

Set Single Node Attribute

//Auto generated script, cannot be modified !


actionResult = System.getModule("com.vmware.pso.chef.ops").getNode(chefHostname,orgName) ;

12.11.3.

Set Single Node Attribute

Adds or replaces a single attribute to a node.

12.11.3.1. Versions
Version

Date

User

Comment

0.0.1

May 13, 2013

root

works!

0.0.2

May 14, 2013

root

Get pem from config item

0.0.3

May 14, 2013

root

Doc update

0.1.0

May 30, 2013

vCO

add orgName input

Administra
tor
0.1.1

May 31, 2013

Daniel
Linsley

0.1.2

Jun 20, 2013

Daniel
Linsley

0.1.3

Jul 29, 2013

vCO
Administra
tor

0.1.4

Jul 29, 2013

vCO
Administra
tor

0.1.5

Jul 29, 2013

vCO
Administra
tor

0.1.6

Jul 29, 2013

vCO
Administra
tor

0.1.7

Aug 1, 2013

vCO
Administra
tor

vCO Workflow Documentation - Jul 6, 2015

Page

312

Set Single Node Attribute


Version

0.1.8

Date

Aug 1, 2013

User

Comment

vCO
Administra
tor

0.1.9

Aug 1, 2013

vCO
Administra
tor

0.1.10

Aug 1, 2013

vCO
Administra
tor

0.1.11

Aug 1, 2013

vCO
Administra
tor

0.1.12

Aug 1, 2013

vCO
Administra
tor

0.1.13

Aug 1, 2013

vCO
Administra
tor

0.1.14

Aug 1, 2013

vCO
Administra
tor

0.1.15

Aug 1, 2013

vCO
Administra
tor

0.1.16

Aug 1, 2013

vCO
Administra
tor

0.1.17

Oct 9, 2013

vCO
Administra
tor

0.1.18

Oct 9, 2013

vCO
Administra
tor

vCO Workflow Documentation - Jul 6, 2015

Page

313

Set Single Node Attribute


Version

0.1.19

Date

User

Jan 2, 2015

Comment

vCO
Administra
tor

Current version:0.1.19

12.11.3.2. Inputs
Name

Type

chefHostname*

string

userid*

string

orgName*

string

node*

string

attributeClass*

string

attributeName*

string

attributeValueJS

string

Description

could be a string, number, boolean,


array, etc.

pem

string

(Optional)

Private key for the

userid client.

The private key

will be looked up in the <b>Chef


Private Keys</b> Configuration
Element otherwise.

*Parameter is mandatory

12.11.3.3. Outputs
Name

nodeJS

Type

string

Description

The raw json object of the node

12.11.3.4. Attributes
Name

chefOp

Type

Description

REST:RESTOperation

vCO Workflow Documentation - Jul 6, 2015

Page

314

Set Single Node Attribute


Name

Type

Description

errorCode

string

pemAttr

SecureString

configElement

ConfigurationElemen
t

chefGetOp

REST:RESTOperation

12.11.3.5. Parameter
Parameter

presentation
Description

Parameter Info

chefHostname

chefHostname

Mandatory input: true

userid

userid

Mandatory input: true

node

node

Mandatory input: true

orgName

orgName

Mandatory input:
!GetAction("com.vmware.pso.chef.hel
pers","hideOrgName").call(
#chefHostname )

attributeClass

attributeClass

Mandatory input: true

attributeName

attributeName

Mandatory input: true

attributeValueJS

attributeValueJS:
could be a string,
number, boolean,
array, etc.

pem

(Optional)

Private

key for the userid


client.

The

private key will be


looked up in the
<b>Chef Private
Keys</b>
Configuration
Element otherwise.

vCO Workflow Documentation - Jul 6, 2015

Page

315

Set Single Node Attribute

12.11.3.6. Workflow

schema

12.11.3.7. Workflow

items

Name

Type

Next item

Description

WorkflowItemEnd
putNode

WorkflowItemTask

checkAndGetP
em

Scriptable

WorkflowItemTask

task
WorkflowItemEnd
System+Serve

WorkflowItemTask

Log the input text to the

r error

console and the server log with


level 'error'

System+Serve

WorkflowItemTask

Log the input text to the

r error

console and the server log with


level 'error'

checkAndGetP

WorkflowItemTask

em
System+Serve

Scriptable
task

WorkflowItemTask

Log the input text to the

r error

console and the server log with


level 'error'

getNode

WorkflowItemTask

12.11.3.8. Source

putNode

code for the used actions

vCO Workflow Documentation - Jul 6, 2015

Page

316

Set Single Node Attribute

12.11.3.8.1. putNode
//Auto generated script, cannot be modified !
actionResult = System.getModule("com.vmware.pso.chef.ops").putNode(chefHostname,orgName) ;

12.11.3.8.2. Scriptable task


var result =
System.getModule("com.vmware.pso.chef").executeRequest(chefGetOp,orgName,userid,pem,"",[no
de]);

nodeJS = result;
var responseObj = JSON.parse(result);

if(responseObj[attributeClass] === undefined) {


throw ("Invalid attribute class for node");
}

responseObj[attributeClass][attributeName] = JSON.parse(attributeValue);

newNodeJS = JSON.stringify(responseObj);

System.log("body:

"+newNodeJS);

result =
System.getModule("com.vmware.pso.chef").executeRequest(chefOp,orgName,userid,pem,newNodeJS
,[node]);

nodeJS = result;

12.11.3.8.3. System+Server error


//Auto-generated script
System.error(text + " - " + object);
Server.error(text, object);

12.11.3.8.4. System+Server error


//Auto-generated script
System.error(text + " - " + object);
Server.error(text, object);

12.11.3.8.5. checkAndGetPem

vCO Workflow Documentation - Jul 6, 2015

Page

317

Add New Role

//Auto generated script, cannot be modified !


actionResult =
System.getModule("com.vmware.pso.chef").checkAndGetPem(pem,configElement,chefHostname,user
id) ;

12.11.3.8.6. System+Server error


//Auto-generated script
System.error(text + " - " + object);
Server.error(text, object);

12.11.3.8.7. getNode
//Auto generated script, cannot be modified !
actionResult = System.getModule("com.vmware.pso.chef.ops").getNode(chefHostname,orgName) ;

Roles

13.
13.1.

Add New Role

Simply adds a new role to a Chef Server.

13.1.1. Versions
Version

Date

User

Comment

0.0.1

May 13, 2013

root

works!

0.0.2

May 14, 2013

Dan

doc update

Linsley
0.1.0

May 30, 2013

vCO

added orgName input

Administra
tor
0.1.1

Jun 20, 2013

Daniel
Linsley

0.1.2

Oct 9, 2013

vCO
Administra
tor

0.1.3

Oct 9, 2013

vCO
Administra
tor

vCO Workflow Documentation - Jul 6, 2015

Page

318

Add New Role


Version

Date

0.1.4

User

Apr 30, 2015

Comment

vCO
Administra
tor

0.1.5

Jul 8, 2015

vCO
Administra
tor

0.1.6

Jul 8, 2015

vCO
Administra
tor

Current version:0.1.6

13.1.2. Inputs
Name

Type

chefHostname*

string

userid*

string

orgName

string

role*

string

description

string

pem

string

Description

Name of new node

(Optional) Private key for the


userid client.

This private key

will be looked up in the <b>Chef


Private Keys</b> Configuration
Element otherwise.

*Parameter is mandatory

13.1.3. Outputs
Name

url

Type

Description

Type

Description

string

13.1.4. Attributes
Name

vCO Workflow Documentation - Jul 6, 2015

Page

319

Add New Role


Name

Type

Description

chefOp

REST:RESTOperation

errorCode

string

pemAttr

SecureString

configElement

ConfigurationElemen
t

13.1.5. Parameter
Parameter

presentation
Description

Parameter Info

Mandatory input: true

chefHostname

chefHostname

orgName

orgName

userid

userid

Mandatory input: true

role

Name of new node

Mandatory input: true

description

description

pem

(Optional) Private
key for the userid
client.

This

private key will be


looked up in the
<b>Chef Private
Keys</b>
Configuration
Element otherwise.

13.1.6. Workflow

schema

vCO Workflow Documentation - Jul 6, 2015

Page

320

Add New Role

13.1.7. Workflow
Name

items
Type

Next item

Description

WorkflowItemEnd
postRoles

WorkflowItemTask

checkAndGetP
em

Scriptable

WorkflowItemTask

task
WorkflowItemEnd
System+Serve

WorkflowItemTask

Log the input text to the

r error

console and the server log with


level 'error'

System+Serve

WorkflowItemTask

Log the input text to the

r error

console and the server log with


level 'error'

checkAndGetP

WorkflowItemTask

em
System+Serve

Scriptable
task

WorkflowItemTask

r error

Log the input text to the


console and the server log with
level 'error'

vCO Workflow Documentation - Jul 6, 2015

Page

321

Add New Role

13.1.8. Source

code for the used actions

13.1.8.1. postRoles
//Auto generated script, cannot be modified !
actionResult = System.getModule("com.vmware.pso.chef.ops").postRoles(chefHostname,orgName)
;

13.1.8.2. Scriptable task


var bodyJS = {};
bodyJS.name = role;
bodyJS.description = description;

var body = JSON.stringify(bodyJS);

var result =
System.getModule("com.vmware.pso.chef").executeRequest(chefOp,orgName,userid,pem,body,[]);

var responseJS = JSON.parse(result);

url = responseJS.uri;
Server.log("Successfully added role",role);
System.log("Successfully added role: "+role);

13.1.8.3. System+Server error


//Auto-generated script
System.error(text + " - " + object);
Server.error(text, object);

13.1.8.4. System+Server error


//Auto-generated script
System.error(text + " - " + object);
Server.error(text, object);

13.1.8.5. checkAndGetPem
//Auto generated script, cannot be modified !
actionResult =
System.getModule("com.vmware.pso.chef").checkAndGetPem(pem,configElement,chefHostname,user
id) ;

vCO Workflow Documentation - Jul 6, 2015

Page

322

Delete Role

13.1.8.6. System+Server error


//Auto-generated script
System.error(text + " - " + object);
Server.error(text, object);

13.2.

Delete Role

Deletes a Role on a Chef Server.

13.2.1. Versions
Version

Date

User

Comment

0.0.1

May 13, 2013

root

works!

0.0.2

May 13, 2013

root

Delete Node

0.0.3

May 14, 2013

root

pull pem from config item

0.1.0

May 30, 2013

vCO

added orgName input

Administra
tor
0.1.1

May 30, 2013

Daniel
Linsley

0.1.2

May 31, 2013

Daniel
Linsley

0.1.3

May 31, 2013

Daniel
Linsley

0.1.4

Jun 20, 2013

Daniel
Linsley

0.1.5

Oct 9, 2013

vCO
Administra
tor

0.1.6

Oct 9, 2013

vCO
Administra
tor

0.1.7

Oct 9, 2013

vCO
Administra
tor

vCO Workflow Documentation - Jul 6, 2015

Page

323

Delete Role
Version

0.1.8

Date

User

Oct 9, 2013

Comment

vCO
Administra
tor

0.1.9

Jul 8, 2015

vCO
Administra
tor

0.1.10

Jul 8, 2015

vCO
Administra
tor

Current version:0.1.10

13.2.2. Inputs
Name

Type

Description

chefHostname*

string

userid*

string

orgName

string

role*

string

Role to delete

pem

string

(Optional) Private key for the


userid client.

This private key

will be looked up in the <b>Chef


Private Keys</b> Configuration
Element otherwise.

*Parameter is mandatory

13.2.3. Attributes
Name

Type

chefOp

REST:RESTOperation

errorCode

string

pemAttr

SecureString

configElement

ConfigurationElemen

Description

vCO Workflow Documentation - Jul 6, 2015

Page

324

Delete Role

13.2.4. Parameter

presentation

Parameter

Description

Parameter Info

Mandatory input: true

chefHostname

chefHostname

orgName

orgName

userid

userid

Mandatory input: true

role

role

Mandatory input: true

pem

(Optional) Private
key for the userid
client.

This

private key will be


looked up in the
<b>Chef Private
Keys</b>
Configuration
Element otherwise.

13.2.5. Workflow

schema

13.2.6. Workflow

items

Name

Type

Next item

Description

WorkflowItemEnd

vCO Workflow Documentation - Jul 6, 2015

Page

325

Delete Role
Name

deleteRole

Type

WorkflowItemTask

Next item

Description

checkAndGetP
em

Scriptable

WorkflowItemTask

task
WorkflowItemEnd
System+Serve

WorkflowItemTask

Log the input text to the

r error

console and the server log with


level 'error'

System+Serve

WorkflowItemTask

Log the input text to the

r error

console and the server log with


level 'error'

checkAndGetP

WorkflowItemTask

em
System+Serve

Scriptable
task

WorkflowItemTask

r error

Log the input text to the


console and the server log with
level 'error'

13.2.7. Source

code for the used actions

13.2.7.1. deleteRole
//Auto generated script, cannot be modified !
actionResult =
System.getModule("com.vmware.pso.chef.ops").deleteRole(chefHostname,orgName) ;

13.2.7.2. Scriptable task


var result =
System.getModule("com.vmware.pso.chef").executeRequest(chefOp,orgName,userid,pem,"",[role]
);

var responseJS = JSON.parse(result);

System.log("Successfully deleted role: "+role);


Server.log("Successfully deleted role",role);

vCO Workflow Documentation - Jul 6, 2015

Page

326

Get Role Details

13.2.7.3. System+Server error


//Auto-generated script
System.error(text + " - " + object);
Server.error(text, object);

13.2.7.4. System+Server error


//Auto-generated script
System.error(text + " - " + object);
Server.error(text, object);

13.2.7.5. checkAndGetPem
//Auto generated script, cannot be modified !
actionResult =
System.getModule("com.vmware.pso.chef").checkAndGetPem(pem,configElement,chefHostname,user
id) ;

13.2.7.6. System+Server error


//Auto-generated script
System.error(text + " - " + object);
Server.error(text, object);

13.3.

Get Role Details

Retrieves details of a particular node on a Chef Server.

13.3.1. Versions
Version

Date

User

Comment

0.0.1

May 13, 2013

root

works!

0.0.2

May 14, 2013

root

Get pem from config item

0.0.3

May 14, 2013

root

Doc update

0.1.0

May 30, 2013

vCO

add orgName input

Administra
tor
0.1.1

May 31, 2013

Daniel
Linsley

vCO Workflow Documentation - Jul 6, 2015

Page

327

Get Role Details


Version

0.1.2

Date

User

Jun 20, 2013

Comment

Daniel
Linsley

0.1.3

Aug 1, 2013

vCO
Administra
tor

0.1.4

Aug 1, 2013

vCO
Administra
tor

0.1.5

Aug 1, 2013

vCO
Administra
tor

0.1.6

Oct 9, 2013

vCO
Administra
tor

0.1.7

Jul 8, 2015

vCO
Administra
tor

0.1.8

Jul 8, 2015

vCO
Administra
tor

Current version:0.1.8

13.3.2. Inputs
Name

Type

chefHostname*

string

userid*

string

orgName

string

role*

string

vCO Workflow Documentation - Jul 6, 2015

Description

Page

328

Get Role Details


Name

pem

Type

string

Description

(Optional) Private key for the


userid client.

This private key

will be looked up in the <b>Chef


Private Keys</b> Configuration
Element otherwise.

*Parameter is mandatory

13.3.3. Outputs
Name

Type

Description

override_attributes

string

JSON Obj

name

string

Name of the node

json_class

string

run_list

string

JSON Array

default_attributes

string

JSON Obj

chef_type

string

automatic

string

roleJS

string

JSON Obj

13.3.4. Attributes
Name

Type

chefOp

REST:RESTOperation

errorCode

string

pemAttr

SecureString

configElement

ConfigurationElemen

Description

13.3.5. Parameter
Parameter

presentation
Description

vCO Workflow Documentation - Jul 6, 2015

Parameter Info

Page

329

Get Role Details


Parameter

Description

Parameter Info

Mandatory input: true

chefHostname

chefHostname

orgName

orgName

userid

userid

Mandatory input: true

role

role

Mandatory input: true

pem

(Optional) Private
key for the userid
client.

This

private key will be


looked up in the
<b>Chef Private
Keys</b>
Configuration
Element otherwise.

13.3.6. Workflow

schema

13.3.7. Workflow

items

Name

Type

Next item

Description

WorkflowItemEnd
getRole

WorkflowItemTask

checkAndGetP
em

Scriptable

WorkflowItemTask

task

vCO Workflow Documentation - Jul 6, 2015

Page

330

Get Role Details


Name

Type

Next item

Description

WorkflowItemEnd
System+Serve

WorkflowItemTask

Log the input text to the

r error

console and the server log with


level 'error'

System+Serve

WorkflowItemTask

Log the input text to the

r error

console and the server log with


level 'error'

checkAndGetP

WorkflowItemTask

em
System+Serve

Scriptable
task

WorkflowItemTask

r error

Log the input text to the


console and the server log with
level 'error'

13.3.8. Source

code for the used actions

13.3.8.1. getRole
//Auto generated script, cannot be modified !
actionResult = System.getModule("com.vmware.pso.chef.ops").getRole(chefHostname,orgName) ;

13.3.8.2. Scriptable task


var result =
System.getModule("com.vmware.pso.chef").executeRequest(chefOp,orgName,userid,pem,"",[role]
);

roleJS = result;
var responseJS = JSON.parse(result);

override_attributes = JSON.stringify(responseJS.override_attributes);
name = responseJS.name;
chef_type = responseJS.chef_type;
json_class = responseJS.json_class;
run_list = JSON.stringify(responseJS.run_list);
default_attributes = JSON.stringify(responseJS['default_attributes']);
automatic = JSON.stringify(responseJS.automatic);

vCO Workflow Documentation - Jul 6, 2015

Page

331

Get Roles

13.3.8.3. System+Server error


//Auto-generated script
System.error(text + " - " + object);
Server.error(text, object);

13.3.8.4. System+Server error


//Auto-generated script
System.error(text + " - " + object);
Server.error(text, object);

13.3.8.5. checkAndGetPem
//Auto generated script, cannot be modified !
actionResult =
System.getModule("com.vmware.pso.chef").checkAndGetPem(pem,configElement,chefHostname,user
id) ;

13.3.8.6. System+Server error


//Auto-generated script
System.error(text + " - " + object);
Server.error(text, object);

13.4.

Get Roles

Returns a list of roles from Chef server

13.4.1. Versions
Version

Date

User

Comment

0.0.1

May 13, 2013

root

works!

0.0.2

May 14, 2013

root

get pem from config

0.1.0

May 30, 2013

vCO

add orgName input

Administra
tor
0.1.1

Jun 20, 2013

Daniel
Linsley

vCO Workflow Documentation - Jul 6, 2015

Page

332

Get Roles
Version

0.1.2

Date

User

Jul 8, 2015

Comment

vCO
Administra
tor

0.1.3

Jul 8, 2015

vCO
Administra
tor

Current version:0.1.3

13.4.2. Inputs
Name

Type

chefHostname*

string

userid*

string

orgName

string

pem

string

Description

(Optional) Private key for the


userid client.

This private key

will be looked up in the <b>Chef


Private Keys</b> Configuration
Element otherwise.

*Parameter is mandatory

13.4.3. Outputs
Name

Type

roles

Array/string

urls

Array/string

Description

Node URLs

13.4.4. Attributes
Name

Type

chefOp

REST:RESTOperation

errorCode

string

vCO Workflow Documentation - Jul 6, 2015

Description

Page

333

Get Roles
Name

Type

configElement

Description

ConfigurationElemen
t

pemAttr

SecureString

13.4.5. Parameter
Parameter

presentation
Description

chefHostname

chefHostname

orgName

orgName

userid

userid

pem

(Optional) Private

Parameter Info

Mandatory input: true

Mandatory input: true

key for the userid


client.

This

private key will be


looked up in the
<b>Chef Private
Keys</b>
Configuration
Element otherwise.

13.4.6. Workflow

schema

13.4.7. Workflow

items

vCO Workflow Documentation - Jul 6, 2015

Page

334

Get Roles

Name

Type

Next item

Description

WorkflowItemEnd
getRoles

WorkflowItemTask

checkAndGetP
em

Scriptable

WorkflowItemTask

task
checkAndGetP

WorkflowItemTask

em
System+Serve

Scriptable
task

WorkflowItemTask

r error

Log the input text to the


console and the server log with
level 'error'

System+Serve

WorkflowItemTask

r error

Log the input text to the


console and the server log with
level 'error'

System+Serve

WorkflowItemTask

r error

Log the input text to the


console and the server log with
level 'error'

WorkflowItemEnd

13.4.8. Source

code for the used actions

13.4.8.1. getRoles
//Auto generated script, cannot be modified !
actionResult = System.getModule("com.vmware.pso.chef.ops").getRoles(chefHostname,orgName)
;

13.4.8.2. Scriptable task


var result =
System.getModule("com.vmware.pso.chef").executeRequest(chefOp,orgName,userid,pem,"",[]);

var responseJS = JSON.parse(result);

roles = new Array();


urls = new Array();

vCO Workflow Documentation - Jul 6, 2015

Page

335

Update Runlist on Role

for(var i in responseJS) {
roles.push(i);
urls.push(responseJS[i]);
}

13.4.8.3. checkAndGetPem
//Auto generated script, cannot be modified !
actionResult =
System.getModule("com.vmware.pso.chef").checkAndGetPem(pem,configElement,chefHostname,user
id) ;

13.4.8.4. System+Server error


//Auto-generated script
System.error(text + " - " + object);
Server.error(text, object);

13.4.8.5. System+Server error


//Auto-generated script
System.error(text + " - " + object);
Server.error(text, object);

13.4.8.6. System+Server error


//Auto-generated script
System.error(text + " - " + object);
Server.error(text, object);

13.5.

Update Runlist on Role

Updates the run_list for a role on a Chef Server.


The chef-client would need to be run on every node associated with the
role for the change to be realized.

13.5.1. Versions
Version

Date

User

Comment

0.0.1

May 13, 2013

root

works!

0.0.2

May 14, 2013

root

Get pem from config item

vCO Workflow Documentation - Jul 6, 2015

Page

336

Update Runlist on Role


Version

Date

User

Comment

0.0.3

May 14, 2013

root

Doc update

0.1.0

May 30, 2013

vCO

add orgName input

Administra
tor
0.1.1

May 30, 2013

vCO
Administra
tor

0.1.2

Jun 20, 2013

Daniel
Linsley

0.1.3

Oct 9, 2013

vCO
Administra
tor

0.1.4

Oct 9, 2013

vCO
Administra
tor

0.1.5

May 16, 2014

vCO
Administra
tor

0.1.6

Nov 24, 2014

vCO
Administra
tor

0.1.7

Apr 30, 2015

vCO
Administra
tor

0.1.8

Apr 30, 2015

vCO
Administra
tor

0.1.9

Apr 30, 2015

vCO
Administra
tor

0.1.10

Jul 8, 2015

vCO
Administra
tor

vCO Workflow Documentation - Jul 6, 2015

Page

337

Update Runlist on Role


Version

Date

0.1.11

User

Jul 8, 2015

Comment

vCO
Administra
tor

Current version:0.1.11

13.5.2. Inputs
Name

Type

chefHostname*

string

userid*

string

orgName

string

role*

string

runlist*

Array/string

pem

string

Description

(Optional) Private key for the


userid client.

This private key

will be looked up in the <b>Chef


Private Keys</b> Configuration
Element otherwise.

*Parameter is mandatory

13.5.3. Outputs
Name

Type

Description

overrides

string

JSON Obj

name

string

Name of the role

json_class

string

run_list

string

JSON Array

defaults

string

JSON Obj

chef_type

string

automatic

string

vCO Workflow Documentation - Jul 6, 2015

JSON Obj

Page

338

Update Runlist on Role

13.5.4. Attributes
Name

Type

Description

chefOp

REST:RESTOperation

errorCode

string

pemAttr

SecureString

configElement

ConfigurationElemen
t

chefGetOp

REST:RESTOperation

13.5.5. Parameter

presentation

Parameter

Description

Parameter Info

Mandatory input: true

chefHostname

chefHostname

orgName

orgName

userid

userid

Mandatory input: true

role

role

Mandatory input: true

runlist

runlist

Mandatory input: true

pem

(Optional) Private
key for the userid
client.

This

private key will be


looked up in the
<b>Chef Private
Keys</b>
Configuration
Element otherwise.

13.5.6. Workflow

schema

vCO Workflow Documentation - Jul 6, 2015

Page

339

Update Runlist on Role

13.5.7. Workflow
Name

items
Type

Next item

Description

WorkflowItemEnd
putRole

WorkflowItemTask

checkAndGetP
em

Scriptable

WorkflowItemTask

task
WorkflowItemEnd
System+Serve

WorkflowItemTask

Log the input text to the

r error

console and the server log with


level 'error'

System+Serve

WorkflowItemTask

Log the input text to the

r error

console and the server log with


level 'error'

checkAndGetP

WorkflowItemTask

em
System+Serve

Scriptable
task

WorkflowItemTask

Log the input text to the

r error

console and the server log with


level 'error'

getRole

WorkflowItemTask

13.5.8. Source

putRole

code for the used actions

13.5.8.1. putRole

vCO Workflow Documentation - Jul 6, 2015

Page

340

Update Runlist on Role

//Auto generated script, cannot be modified !


actionResult = System.getModule("com.vmware.pso.chef.ops").putRole(chefHostname,orgName) ;

13.5.8.2. Scriptable task


var result =
System.getModule("com.vmware.pso.chef").executeRequest(chefGetOp,orgName,userid,pem,"",[ro
le]);

var body = JSON.parse(result);


body.run_list = runlist;

var bodyJS = JSON.stringify(body);


var result =
System.getModule("com.vmware.pso.chef").executeRequest(chefOp,orgName,userid,pem,bodyJS,[r
ole]);

var responseJS = JSON.parse(result);

overrides = JSON.stringify(responseJS.override);
name = responseJS.name;
chef_type = responseJS.chef_type;
json_class = responseJS.json_class;
run_list = JSON.stringify(responseJS.run_list);
defaults = JSON.stringify(responseJS['default']);
automatic = JSON.stringify(responseJS.automatic);

13.5.8.3. System+Server error


//Auto-generated script
System.error(text + " - " + object);
Server.error(text, object);

13.5.8.4. System+Server error


//Auto-generated script
System.error(text + " - " + object);
Server.error(text, object);

13.5.8.5. checkAndGetPem

vCO Workflow Documentation - Jul 6, 2015

Page

341

Delete Single Role Attribute


//Auto generated script, cannot be modified !
actionResult =
System.getModule("com.vmware.pso.chef").checkAndGetPem(pem,configElement,chefHostname,user
id) ;

13.5.8.6. System+Server error


//Auto-generated script
System.error(text + " - " + object);
Server.error(text, object);

13.5.8.7. getRole
//Auto generated script, cannot be modified !
actionResult = System.getModule("com.vmware.pso.chef.ops").getRole(chefHostname,orgName) ;

Attributes

13.6.
13.6.1.

Delete Single Role Attribute

Deletes a single attribute from a role.

13.6.1.1. Versions
Version

Date

User

Comment

0.0.1

May 13, 2013

root

works!

0.0.2

May 14, 2013

root

Get pem from config item

0.0.3

May 14, 2013

root

Doc update

0.1.0

May 30, 2013

vCO

add orgName input

Administra
tor
0.1.1

May 31, 2013

Daniel
Linsley

0.1.2

Jun 20, 2013

Daniel
Linsley

0.1.3

Jul 29, 2013

vCO
Administra
tor

0.1.4

Jul 29, 2013

vCO
Administra
tor

vCO Workflow Documentation - Jul 6, 2015

Page

342

Delete Single Role Attribute


Version

0.1.5

Date

Jul 29, 2013

User

Comment

vCO
Administra
tor

0.1.6

Jul 29, 2013

vCO
Administra
tor

0.1.7

Aug 1, 2013

vCO
Administra
tor

0.1.8

Aug 1, 2013

vCO
Administra
tor

0.1.9

Aug 1, 2013

vCO
Administra
tor

0.1.10

Aug 1, 2013

vCO
Administra
tor

0.1.11

Aug 1, 2013

vCO
Administra
tor

0.1.12

Aug 1, 2013

vCO
Administra
tor

0.1.13

Aug 1, 2013

vCO
Administra
tor

0.1.14

Aug 1, 2013

vCO
Administra
tor

0.1.15

Aug 1, 2013

vCO
Administra
tor

vCO Workflow Documentation - Jul 6, 2015

Page

343

Delete Single Role Attribute


Version

0.1.16

Date

Aug 1, 2013

User

Comment

vCO
Administra
tor

0.1.17

Aug 1, 2013

vCO
Administra
tor

0.1.18

Aug 1, 2013

vCO
Administra
tor

0.1.19

Aug 1, 2013

vCO
Administra
tor

0.1.20

Aug 1, 2013

vCO
Administra
tor

0.1.21

Oct 9, 2013

vCO
Administra
tor

0.1.22

Oct 9, 2013

vCO
Administra
tor

0.1.23

Jul 8, 2015

vCO
Administra
tor

0.1.24

Jul 8, 2015

vCO
Administra
tor

0.1.25

Jul 8, 2015

vCO
Administra
tor

Current version:0.1.25

13.6.1.2. Inputs
Name

vCO Workflow Documentation - Jul 6, 2015

Type

Description

Page

344

Delete Single Role Attribute


Name

Type

chefHostname*

string

userid*

string

orgName

string

role*

string

attributeClass*

string

attributeName*

string

pem

string

Description

(Optional) Private key for the


userid client.

This private key

will be looked up in the <b>Chef


Private Keys</b> Configuration
Element otherwise.

*Parameter is mandatory

13.6.1.3. Outputs
Name

Type

Description

overrides

string

JSON Obj

name

string

Name of the node

json_class

string

run_list

string

JSON Array

defaults

string

JSON Obj

chef_type

string

automatic

string

JSON Obj

roleJS

string

The raw json object of the node

13.6.1.4. Attributes
Name

chefOp

Type

Description

REST:RESTOperation

vCO Workflow Documentation - Jul 6, 2015

Page

345

Delete Single Role Attribute


Name

Type

Description

errorCode

string

pemAttr

SecureString

configElement

ConfigurationElemen
t

chefGetOp

REST:RESTOperation

13.6.1.5. Parameter

presentation

Parameter

Description

Parameter Info

chefHostname

chefHostname

Mandatory input: true

userid

userid

Mandatory input: true

orgName

orgName

role

role

Mandatory input: true

attributeClass

attributeClass

Mandatory input: true

attributeName

attributeName

Mandatory input: true

pem

(Optional) Private
key for the userid
client.

This

private key will be


looked up in the
<b>Chef Private
Keys</b>
Configuration
Element otherwise.

13.6.1.6. Workflow

schema

vCO Workflow Documentation - Jul 6, 2015

Page

346

Delete Single Role Attribute

13.6.1.7. Workflow
Name

items

Type

Next item

Description

WorkflowItemEnd
putRole

WorkflowItemTask

checkAndGetP
em

Scriptable

WorkflowItemTask

task
WorkflowItemEnd
System+Serve

WorkflowItemTask

Log the input text to the

r error

console and the server log with


level 'error'

System+Serve

WorkflowItemTask

Log the input text to the

r error

console and the server log with


level 'error'

checkAndGetP

WorkflowItemTask

em
System+Serve

Scriptable
task

WorkflowItemTask

Log the input text to the

r error

console and the server log with


level 'error'

getRole

WorkflowItemTask

13.6.1.8. Source

putRole

code for the used actions

vCO Workflow Documentation - Jul 6, 2015

Page

347

Delete Single Role Attribute

13.6.1.8.1. putRole
//Auto generated script, cannot be modified !
actionResult = System.getModule("com.vmware.pso.chef.ops").putRole(chefHostname,orgName) ;

13.6.1.8.2. Scriptable task


var result =
System.getModule("com.vmware.pso.chef").executeRequest(chefGetOp,orgName,userid,pem,"",[ro
le]);

var responseObj = JSON.parse(result);

if (responseObj[attributeClass+"_attributes"] === undefined) {


throw("Invalid attribute class for role");
}
if (responseObj[attributeClass+"_attributes"][attributeName] === undefined) {
throw("Attribute "+attributeName+" does not exist on role");
}

delete responseObj[attributeClass+"_attributes"][attributeName];

var newRoleJS = JSON.stringify(responseObj);

roleJS =
System.getModule("com.vmware.pso.chef").executeRequest(chefOp,orgName,userid,pem,newRoleJS
,[role]);

13.6.1.8.3. System+Server error


//Auto-generated script
System.error(text + " - " + object);
Server.error(text, object);

13.6.1.8.4. System+Server error


//Auto-generated script
System.error(text + " - " + object);
Server.error(text, object);

13.6.1.8.5. checkAndGetPem

vCO Workflow Documentation - Jul 6, 2015

Page

348

Set Role Attributes


//Auto generated script, cannot be modified !
actionResult =
System.getModule("com.vmware.pso.chef").checkAndGetPem(pem,configElement,chefHostname,user
id) ;

13.6.1.8.6. System+Server error


//Auto-generated script
System.error(text + " - " + object);
Server.error(text, object);

13.6.1.8.7. getRole
//Auto generated script, cannot be modified !
actionResult = System.getModule("com.vmware.pso.chef.ops").getRole(chefHostname,orgName) ;

13.6.2.

Set Role Attributes

Adds or replaces a set of attributes for a role.

13.6.2.1. Versions
Version

Date

User

Comment

0.0.1

May 13, 2013

root

works!

0.0.2

May 14, 2013

root

Get pem from config item

0.0.3

May 14, 2013

root

Doc update

0.1.0

May 30, 2013

vCO

add orgName input

Administra
tor
0.1.1

May 31, 2013

Daniel
Linsley

0.1.2

Jun 20, 2013

Daniel
Linsley

0.1.3

Jul 29, 2013

vCO
Administra
tor

0.1.4

Jul 29, 2013

vCO
Administra
tor

vCO Workflow Documentation - Jul 6, 2015

Page

349

Set Role Attributes


Version

0.1.5

Date

Jul 29, 2013

User

Comment

vCO
Administra
tor

0.1.6

Jul 29, 2013

vCO
Administra
tor

0.1.7

Aug 1, 2013

vCO
Administra
tor

0.1.8

Aug 1, 2013

vCO
Administra
tor

0.1.9

Aug 1, 2013

vCO
Administra
tor

0.1.10

Aug 1, 2013

vCO
Administra
tor

0.1.11

Aug 1, 2013

vCO
Administra
tor

0.1.12

Aug 1, 2013

vCO
Administra
tor

0.1.13

Aug 1, 2013

vCO
Administra
tor

0.1.14

Aug 1, 2013

vCO
Administra
tor

0.1.15

Aug 1, 2013

vCO
Administra
tor

vCO Workflow Documentation - Jul 6, 2015

Page

350

Set Role Attributes


Version

0.1.16

Date

Aug 1, 2013

User

Comment

vCO
Administra
tor

0.1.17

Aug 1, 2013

vCO
Administra
tor

0.1.18

Aug 1, 2013

vCO
Administra
tor

0.1.19

Aug 1, 2013

vCO
Administra
tor

0.1.20

Aug 1, 2013

vCO
Administra
tor

0.1.21

Aug 1, 2013

vCO
Administra
tor

0.1.22

Aug 1, 2013

vCO
Administra
tor

0.1.23

Aug 2, 2013

vCO
Administra
tor

0.1.24

Oct 9, 2013

vCO
Administra
tor

0.1.25

Apr 30, 2015

vCO
Administra
tor

0.1.26

Jul 8, 2015

vCO
Administra
tor

vCO Workflow Documentation - Jul 6, 2015

Page

351

Set Role Attributes


Version

Date

0.1.27

User

Jul 8, 2015

Comment

vCO
Administra
tor

Current version:0.1.27

13.6.2.2. Inputs
Name

Type

chefHostname*

string

userid*

string

orgName

string

role*

string

attributeClass*

string

attributesJS*

string

Description

JSON object of attributes to


add/update

pem

string

(Optional) Private key for the


userid client.

This private key

will be looked up in the <b>Chef


Private Keys</b> Configuration
Element otherwise.

*Parameter is mandatory

13.6.2.3. Outputs
Name

Type

Description

overrides

string

JSON Obj

name

string

Name of the node

json_class

string

run_list

string

JSON Array

defaults

string

JSON Obj

chef_type

string

vCO Workflow Documentation - Jul 6, 2015

Page

352

Set Role Attributes


Name

Type

automatic

string

roleJS

string

Description

JSON Obj

13.6.2.4. Attributes
Name

Type

Description

chefOp

REST:RESTOperation

errorCode

string

pemAttr

SecureString

configElement

ConfigurationElemen
t

chefGetOp

REST:RESTOperation

13.6.2.5. Parameter
Parameter

presentation
Description

Parameter Info

chefHostname

chefHostname

Mandatory input: true

userid

userid

Mandatory input: true

orgName

orgName

role

role

Mandatory input: true

attributeClass

attributeClass

Mandatory input: true

attributesJS

attributesJS

Mandatory input: true

pem

(Optional) Private
key for the userid
client.

This

private key will be


looked up in the
<b>Chef Private
Keys</b>
Configuration
Element otherwise.

vCO Workflow Documentation - Jul 6, 2015

Page

353

Set Role Attributes

13.6.2.6. Workflow

schema

13.6.2.7. Workflow

items

Name

Type

Next item

Description

WorkflowItemEnd
putRole

WorkflowItemTask

checkAndGetP
em

Scriptable

WorkflowItemTask

task
WorkflowItemEnd
System+Serve

WorkflowItemTask

Log the input text to the

r error

console and the server log with


level 'error'

System+Serve

WorkflowItemTask

Log the input text to the

r error

console and the server log with


level 'error'

checkAndGetP

WorkflowItemTask

em
System+Serve

Scriptable
task

WorkflowItemTask

Log the input text to the

r error

console and the server log with


level 'error'

getRole

WorkflowItemTask

13.6.2.8. Source

putRole

code for the used actions

vCO Workflow Documentation - Jul 6, 2015

Page

354

Set Role Attributes

13.6.2.8.1. putRole
//Auto generated script, cannot be modified !
actionResult = System.getModule("com.vmware.pso.chef.ops").putRole(chefHostname,orgName) ;

13.6.2.8.2. Scriptable task


var result =
System.getModule("com.vmware.pso.chef").executeRequest(chefGetOp,orgName,userid,pem,"",[ro
le]);

var responseObj = JSON.parse(result);

var newAttrs = JSON.parse(attributesJS);

if (responseObj[attributeClass+"_attributes"] === undefined) {


throw("Invalid attribute class for role");
}

for (var i in newAttrs) {


responseObj[attributeClass+"_attributes"][i] = newAttrs[i];
}

newRoleJS = JSON.stringify(responseObj);

result =
System.getModule("com.vmware.pso.chef").executeRequest(chefOp,orgName,userid,pem,newRoleJS
,[role]);

roleJS = result;

13.6.2.8.3. System+Server error


//Auto-generated script
System.error(text + " - " + object);
Server.error(text, object);

13.6.2.8.4. System+Server error


//Auto-generated script
System.error(text + " - " + object);
Server.error(text, object);

vCO Workflow Documentation - Jul 6, 2015

Page

355

Set Single Role Attribute

13.6.2.8.5. checkAndGetPem
//Auto generated script, cannot be modified !
actionResult =
System.getModule("com.vmware.pso.chef").checkAndGetPem(pem,configElement,chefHostname,user
id) ;

13.6.2.8.6. System+Server error


//Auto-generated script
System.error(text + " - " + object);
Server.error(text, object);

13.6.2.8.7. getRole
//Auto generated script, cannot be modified !
actionResult = System.getModule("com.vmware.pso.chef.ops").getRole(chefHostname,orgName) ;

13.6.3.

Set Single Role Attribute

Adds or replaces a single attribute to a role.

13.6.3.1. Versions
Version

Date

User

Comment

0.0.1

May 13, 2013

root

works!

0.0.2

May 14, 2013

root

Get pem from config item

0.0.3

May 14, 2013

root

Doc update

0.1.0

May 30, 2013

vCO

add orgName input

Administra
tor
0.1.1

May 31, 2013

Daniel
Linsley

0.1.2

Jun 20, 2013

Daniel
Linsley

0.1.3

Jul 29, 2013

vCO
Administra
tor

vCO Workflow Documentation - Jul 6, 2015

Page

356

Set Single Role Attribute


Version

0.1.4

Date

Jul 29, 2013

User

Comment

vCO
Administra
tor

0.1.5

Jul 29, 2013

vCO
Administra
tor

0.1.6

Jul 29, 2013

vCO
Administra
tor

0.1.7

Aug 1, 2013

vCO
Administra
tor

0.1.8

Aug 1, 2013

vCO
Administra
tor

0.1.9

Aug 1, 2013

vCO
Administra
tor

0.1.10

Aug 1, 2013

vCO
Administra
tor

0.1.11

Aug 1, 2013

vCO
Administra
tor

0.1.12

Aug 1, 2013

vCO
Administra
tor

0.1.13

Aug 1, 2013

vCO
Administra
tor

0.1.14

Aug 1, 2013

vCO
Administra
tor

vCO Workflow Documentation - Jul 6, 2015

Page

357

Set Single Role Attribute


Version

0.1.15

Date

Aug 1, 2013

User

Comment

vCO
Administra
tor

0.1.16

Aug 1, 2013

vCO
Administra
tor

0.1.17

Aug 1, 2013

vCO
Administra
tor

0.1.18

Aug 1, 2013

vCO
Administra
tor

0.1.19

Aug 1, 2013

vCO
Administra
tor

0.1.20

Aug 1, 2013

vCO
Administra
tor

0.1.21

Aug 1, 2013

vCO
Administra
tor

0.1.22

Oct 9, 2013

vCO
Administra
tor

0.1.23

Jul 8, 2015

vCO
Administra
tor

0.1.24

Jul 8, 2015

vCO
Administra
tor

Current version:0.1.24

13.6.3.2. Inputs
Name

vCO Workflow Documentation - Jul 6, 2015

Type

Description

Page

358

Set Single Role Attribute


Name

Type

chefHostname*

string

userid*

string

orgName

string

role*

string

attributeClass*

string

attributeName*

string

attributeValueJS*

string

Description

could be a string, number, boolean,


array, etc.

pem

string

(Optional) Private key for the


userid client.

This private key

will be looked up in the <b>Chef


Private Keys</b> Configuration
Element otherwise.

*Parameter is mandatory

13.6.3.3. Outputs
Name

Type

Description

overrides

string

JSON Obj

name

string

Name of the node

json_class

string

run_list

string

JSON Array

defaults

string

JSON Obj

chef_type

string

automatic

string

JSON Obj

roleJS

string

The raw json object of the node

13.6.3.4. Attributes
Name

vCO Workflow Documentation - Jul 6, 2015

Type

Description

Page

359

Set Single Role Attribute


Name

Type

Description

chefOp

REST:RESTOperation

errorCode

string

pemAttr

SecureString

configElement

ConfigurationElemen
t

chefGetOp

REST:RESTOperation

13.6.3.5. Parameter

presentation

Parameter

Description

Parameter Info

chefHostname

chefHostname

Mandatory input: true

userid

userid

Mandatory input: true

orgName

orgName

role

role

Mandatory input: true

attributeClass

attributeClass

Mandatory input: true

attributeName

attributeName

Mandatory input: true

attributeValueJS

could be a string,

Mandatory input: true

number, boolean,
array, etc.
pem

(Optional) Private
key for the userid
client.

This

private key will be


looked up in the
<b>Chef Private
Keys</b>
Configuration
Element otherwise.

13.6.3.6. Workflow

schema

vCO Workflow Documentation - Jul 6, 2015

Page

360

Set Single Role Attribute

13.6.3.7. Workflow
Name

items

Type

Next item

Description

WorkflowItemEnd
putRole

WorkflowItemTask

checkAndGetP
em

Scriptable

WorkflowItemTask

task
WorkflowItemEnd
System+Serve

WorkflowItemTask

Log the input text to the

r error

console and the server log with


level 'error'

System+Serve

WorkflowItemTask

Log the input text to the

r error

console and the server log with


level 'error'

checkAndGetP

WorkflowItemTask

em
System+Serve

Scriptable
task

WorkflowItemTask

Log the input text to the

r error

console and the server log with


level 'error'

getRole

WorkflowItemTask

13.6.3.8. Source

putRole

code for the used actions

13.6.3.8.1. putRole

vCO Workflow Documentation - Jul 6, 2015

Page

361

Set Single Role Attribute

//Auto generated script, cannot be modified !


actionResult = System.getModule("com.vmware.pso.chef.ops").putRole(chefHostname,orgName) ;

13.6.3.8.2. Scriptable task


var result =
System.getModule("com.vmware.pso.chef").executeRequest(chefGetOp,orgName,userid,pem,"",[ro
le]);

var responseObj = JSON.parse(result);

if (responseObj[attributeClass+"_attributes"] === undefined) {


throw("Invalid attribute class for role");
}

responseObj[attributeClass+"_attributes"][attributeName] = JSON.parse(attributeValue);

var newRoleJS = JSON.stringify(responseObj);

roleJS =
System.getModule("com.vmware.pso.chef").executeRequest(chefOp,orgName,userid,pem,newRoleJS
,[role]);

13.6.3.8.3. System+Server error


//Auto-generated script
System.error(text + " - " + object);
Server.error(text, object);

13.6.3.8.4. System+Server error


//Auto-generated script
System.error(text + " - " + object);
Server.error(text, object);

13.6.3.8.5. checkAndGetPem
//Auto generated script, cannot be modified !
actionResult =
System.getModule("com.vmware.pso.chef").checkAndGetPem(pem,configElement,chefHostname,user
id) ;

vCO Workflow Documentation - Jul 6, 2015

Page

362

Delete Instance from Chef by accessibleIp

13.6.3.8.6. System+Server error


//Auto-generated script
System.error(text + " - " + object);
Server.error(text, object);

13.6.3.8.7. getRole
//Auto generated script, cannot be modified !
actionResult = System.getModule("com.vmware.pso.chef.ops").getRole(chefHostname,orgName) ;

Samples

14.
14.1.

Delete Instance from Chef by


accessibleIp
Deletes a node and it's respective client object from Chef.
identified by it's <b>accessibleIp</b> attribute

The node is

14.1.1. Versions
Version

0.0.1

Date

May 31, 2013

User

Comment

Daniel
Linsley

0.0.2

May 31, 2013

Daniel
Linsley

0.0.3

May 31, 2013

Daniel
Linsley

0.0.4

May 31, 2013

Daniel
Linsley

0.0.5

May 31, 2013

Daniel
Linsley

0.0.6

Aug 28, 2013

vCO
Administra
tor

0.0.7

Oct 9, 2013

vCO
Administra
tor

vCO Workflow Documentation - Jul 6, 2015

Page

363

Delete Instance from Chef by accessibleIp


Version

Date

0.0.8

User

Jul 6, 2015

Comment

vCO
Administra
tor

Current version:0.0.8

14.1.2. Inputs
Name

Type

chefHostname*

string

orgName

string

userid*

string

ipaddress*

string

Description

The ipaddress to be found in the


<b>accessibleIp</b> attribute

pem

string

(Optional) Private key for the


userid client.

This private key

will be looked up in the <b>Chef


Private Keys</b> Configuration
Element otherwise.

*Parameter is mandatory

14.1.3. Attributes
Name

Type

node

string

attributeName

string

14.1.4. Parameter
Parameter

Description

Name of the node

presentation
Description

Parameter Info

chefHostname

chefHostname

Mandatory input: true

userid

userid

Mandatory input: true

orgName

orgName

vCO Workflow Documentation - Jul 6, 2015

Page

364

Delete Instance from Chef by accessibleIp


Parameter

Description

Parameter Info

The ipaddress to be Mandatory input: true

ipaddress

found in the
<b>accessibleIp</b>
attribute
pem

(Optional)

Private

key for the userid


client.

The

private key will be


looked up in the
<b>Chef Private
Keys</b>
Configuration
Element otherwise.

14.1.5. Workflow

schema

14.1.6. Workflow

items

Name

Type

Next item

Description

WorkflowItemEnd

vCO Workflow Documentation - Jul 6, 2015

Page

365

Delete Instance from Chef by Name


Name

Get Node By

Type

WorkflowItemLink

Next item

Delete Node

Description

Retrieves details of a

Attribute

particular node on a

Chef

Value

Server by the value of an


attribute

Delete Node

WorkflowItemLink

Delete

Deletes a Node in chef.

Returns

Client

the last known state of the


node.

Delete

WorkflowItemLink

Deletes a chef API client.

Client
There is no response body from
the chef server for this
request.

14.1.7. Source
14.2.

code for the used actions

Delete Instance from Chef by Name

Deletes a node and it's respective client object from Chef.


identified by IP address

The node is

14.2.1. Versions
Version

0.0.1

Date

May 31, 2013

User

Comment

Daniel
Linsley

0.0.2

May 31, 2013

Daniel
Linsley

0.0.3

May 31, 2013

Daniel
Linsley

0.0.4

May 31, 2013

Daniel
Linsley

0.0.5

May 31, 2013

Daniel
Linsley

0.0.6

Jul 6, 2015

vCO
Administra
tor

vCO Workflow Documentation - Jul 6, 2015

Page

366

Delete Instance from Chef by Name


Version

Date

0.0.7

User

Jul 6, 2015

Comment

vCO
Administra
tor

Current version:0.0.7

14.2.2. Inputs
Name

Type

Description

chefHostname*

string

orgName

string

userid*

string

node*

string

Name of the node

pem

string

(Optional) Private key for the


userid client.

This private key

will be looked up in the <b>Chef


Private Keys</b> Configuration
Element otherwise.

*Parameter is mandatory

14.2.3. Parameter
Parameter

presentation
Description

Parameter Info

Mandatory input: true

chefHostname

chefHostname

orgName

orgName

userid

userid

Mandatory input: true

node

Name of the node

Mandatory input: true

vCO Workflow Documentation - Jul 6, 2015

Page

367

Delete Instance from Chef by Name


Parameter

Description

pem

(Optional)

Parameter Info

Private

key for the userid


client.

The

private key will be


looked up in the
<b>Chef Private
Keys</b>
Configuration
Element otherwise.

14.2.4. Workflow

schema

14.2.5. Workflow

items

Name

Type

Next item

Description

WorkflowItemEnd
Delete Node

WorkflowItemLink

Delete

Deletes a Node in chef.

Returns

Client

the last known state of the


node.

vCO Workflow Documentation - Jul 6, 2015

Page

368

Delete Many Instances from Chef by accessibleIp


Name

Type

Delete

Next item

WorkflowItemLink

Description

Deletes a chef API client.

Client
There is no response body from
the chef server for this
request.

14.2.6. Source
14.3.

code for the used actions

Delete Many Instances from Chef by


accessibleIp
Deletes many nodes and their respective client objects from Chef.
nodes are identified by IP address.

The

14.3.1. Versions
Version

0.0.1

Date

User

May 31, 2013

Comment

Daniel
Linsley

0.0.2

May 31, 2013

Daniel
Linsley

0.0.3

Jun 20, 2013

Daniel
Linsley

0.0.4

Jul 8, 2015

vCO
Administra
tor

0.0.5

Jul 8, 2015

vCO
Administra
tor

0.0.6

Jul 8, 2015

vCO
Administra
tor

Current version:0.0.6

14.3.2. Inputs
Name

chefHostname*

Type

Description

string

vCO Workflow Documentation - Jul 6, 2015

Page

369

Delete Many Instances from Chef by accessibleIp


Name

Type

orgName

string

userid*

string

ipaddresses*

Array/string

pem

string

Description

(Optional) Private key for the


userid client.

This private key

will be looked up in the <b>Chef


Private Keys</b> Configuration
Element otherwise.

*Parameter is mandatory

14.3.3. Parameter
Parameter

presentation
Description

Parameter Info

Mandatory input: true

chefHostname

chefHostname

orgName

orgName

userid

userid

Mandatory input: true

ipaddresses

ipaddresses

Mandatory input: true

pem

(Optional) Private
key for the userid
client.

This

private key will be


looked up in the
<b>Chef Private
Keys</b>
Configuration
Element otherwise.

14.3.4. Workflow

schema

vCO Workflow Documentation - Jul 6, 2015

Page

370

Windows VMtools Chef-client first run

14.3.5. Workflow
Name

items
Type

Next item

Description

WorkflowItemEnd
Foreach

WorkflowItemForeac

(Delete Node

by IP)

14.3.6. Source
15.
15.1.
15.1.1.

code for the used actions

Windows
VMtools

Windows VMtools Chef-client first run

Before running this workflow make sure you have run "Set Private Key" for
the validator client of your Chef organization (<orgName>-validator).
This workflow creates the following files on the target system via
VMtools:
- c:\chef\client.rb
- c:\chef\<orgName>-validator.pem
- c:\chef\first-boot.json (if specified)
The workflow then executes the first chef-client run. This will:
- Register the node with the Chef Server
- Save the respective private key for the node as /etc/chef/client.pem
Note: If /etc/chef/client.pem already exists when this workflow is run,
it will not register as a new node. It may fail if that is your purpose.

15.1.1.1. Versions

vCO Workflow Documentation - Jul 6, 2015

Page

371

Windows VMtools Chef-client first run

Version

0.0.1

Date

Dec 12, 2014

User

Comment

vCO
Administra
tor

0.0.2

Dec 12, 2014

vCO
Administra
tor

0.0.3

Dec 12, 2014

vCO
Administra
tor

0.0.4

Dec 12, 2014

vCO
Administra
tor

0.0.5

Dec 12, 2014

vCO
Administra
tor

0.0.6

Dec 12, 2014

vCO
Administra
tor

0.0.7

Dec 12, 2014

vCO
Administra
tor

0.0.8

Dec 12, 2014

vCO
Administra
tor

0.0.9

Dec 12, 2014

vCO
Administra
tor

0.0.10

Dec 12, 2014

vCO
Administra
tor

0.0.11

Dec 12, 2014

vCO
Administra
tor

vCO Workflow Documentation - Jul 6, 2015

Page

372

Windows VMtools Chef-client first run


Version

Date

0.0.12

User

Dec 12, 2014

Comment

vCO
Administra
tor

0.0.13

Dec 12, 2014

vCO
Administra
tor

0.0.14

Dec 12, 2014

vCO
Administra
tor

0.0.15

Dec 12, 2014

vCO
Administra
tor

0.0.16

Dec 12, 2014

vCO
Administra
tor

0.0.17

Dec 12, 2014

vCO
Administra
tor

0.0.18

Apr 30, 2015

vCO
Administra
tor

0.0.19

Apr 30, 2015

vCO
Administra
tor

Current version:0.0.19

15.1.1.2. Inputs
Name

Type

Description

chefHostname*

string

Chef Server hostname

orgName

string

Chef organization name

environment

string

jsonFirstBoot

string

vCO Workflow Documentation - Jul 6, 2015

Page

373

Windows VMtools Chef-client first run


Name

nodeName

Type

string

Description

Optionally specify the name of this


new node

vm*

VC:VirtualMachine

Virtual Machine (VC)

username*

string

Guest username

password*

SecureString

Guest password

sslVerifyNone

boolean

Disable verification of Chef Server


SSL Cert

*Parameter is mandatory

15.1.1.3. Attributes
Name

configElement

Type

Description

ConfigurationElemen
t

validatorid

string

validatorPem

SecureString

chefClientConfig

string

commands

Array/string

scriptType

string

scriptExitCodes

Array/number

scriptOutputTexts

Array/string

overwrite

boolean

vcoPaths

Array/string

guestFilePaths

Array/string

errorCode

string

bash / bat / powershell

Overwrite file if exists

opensourceValidatorClie string
ntName

vCO Workflow Documentation - Jul 6, 2015

Page

374

Windows VMtools Chef-client first run

15.1.1.4. Parameter

presentation

Parameter

Description

chefHostname

chefHostname

orgName

orgName

environment

environment

jsonFirstBoot

jsonFirstBoot

nodeName

Optionally specify

Parameter Info

Mandatory input: true

the name of this


new node
sslVerifyNone

Disable
verification of
Chef Server SSL
Cert

vm

Virtual Machine

Mandatory input: true

(VC)
username

Guest Username

Mandatory input: true

password

Guest Password

Mandatory input: true

15.1.1.5. Workflow

schema

vCO Workflow Documentation - Jul 6, 2015

Page

375

Windows VMtools Chef-client first run

15.1.1.6. Workflow
Name

getPrivateKe

items

Type

WorkflowItemTask

yFromConfig
Create Chef

Next item

Description

Write Temp
PEM

WorkflowItemTask

Client

Create
Commands

config
Create

WorkflowItemTask

Commands

Write Many
Files to
Guest

Write Temp

WorkflowItemTask

PEM

Create Chef
Client
config

vCO Workflow Documentation - Jul 6, 2015

Page

376

Windows VMtools Chef-client first run


Name

Type

Run Multiple

Next item

Description

WorkflowItemLink

Commands in
Guest
WorkflowItemEnd
Write Many

WorkflowItemLink

Files to

Cleanup Temp
Files

Guest
Cleanup Temp

WorkflowItemTask

Files
WorkflowItemEnd
Cleanup Temp

WorkflowItemTask

Files

Run Multiple
Commands in
Guest

createValida

WorkflowItemTask

torId

getPrivateKe
yFromConfig

15.1.1.7. Source

code for the used actions

15.1.1.7.1. getPrivateKeyFromConfig
//Auto generated script, cannot be modified !
actionResult =
System.getModule("com.vmware.pso.chef").getPrivateKeyFromConfig(configElement,chefHostname
,userid) ;

15.1.1.7.2. Create Chef Client config


var chefClientConfig =

"validation_client_name

"validation_key

'"+validatorid+"'\r\n" +

'c:\\chef\\"+validatorid+".pem'\r\n";

if (orgName != null && orgName.length > 0) {


chefClientConfig = chefClientConfig + "chef_server_url
'https://"+chefHostname+"/organizations/"+orgName+"'";
} else {
chefClientConfig = chefClientConfig + "chef_server_url

'https://"+chefHostname+"'";

vCO Workflow Documentation - Jul 6, 2015

Page

377

Windows VMtools Chef-client first run


if (nodeName != null && nodeName.length > 0){
chefClientConfig = chefClientConfig+"\r\nnode_name '"+nodeName+"'";
}

if (sslVerifyNone) {
chefClientConfig = chefClientConfig+"\r\nssl_verify_mode

:verify_none";

var vcoFile = System.createTempFile();


vcoFile.write(chefClientConfig);

vcoPaths.push(vcoFile.path);
guestFilePaths.push("c:\\chef\\client.rb");

if (jsonFirstBoot != null && jsonFirstBoot.length > 0) {


var vcoFile = System.createTempFile();
vcoFile.write(jsonFirstBoot);

vcoPaths.push(vcoFile.path);
guestFilePaths.push("c:\\chef\\first-boot.json");
}

15.1.1.7.3. Create Commands


commands = [];

var firstRunCommand = "c:\\opscode\\chef\\bin\\chef-client.bat";

if (environment != null && environment.length > 0) {


firstRunCommand += " -E "+environment;
}

if (jsonFirstBoot !=null && jsonFirstBoot.length > 0){


firstRunCommand += " -j c:\\chef\\first-boot.json";
}

commands.push(firstRunCommand);

15.1.1.7.4. Write Temp PEM


var vcoFile = System.createTempFile();
vcoFile.write(validatorPem);
vcoPaths = [vcoFile.path];

vCO Workflow Documentation - Jul 6, 2015

Page

378

Windows VMtools Delete Instance with own key


guestFilePaths = ["c:\\chef\\"+validatorid+".pem"];

15.1.1.7.5. Cleanup Temp Files


for (var i in vcoPaths) {
var f = new File(vcoPaths[i]);
try {
f.deleteFile();
} catch (e) {}
}

15.1.1.7.6. Cleanup Temp Files


for (var i in vcoPaths) {
var f = new File(vcoPaths[i]);
try {
f.deleteFile();
} catch (e) {}
}

15.1.1.7.7. createValidatorId
//Auto generated script, cannot be modified !
actionResult =
System.getModule("com.vmware.pso.chef").createValidatorId(orgName,opensourceValidatorClien
tName) ;

Windows VMtools Delete Instance with


own key
15.1.2.

Deletes a Chef Node and respective Client using a client's key extracted
from the guest using VMtools.

15.1.2.1. Versions
Version

0.0.1

Date

Dec 12, 2014

User

Comment

vCO
Administra
tor

0.0.2

Dec 12, 2014

vCO
Administra
tor

vCO Workflow Documentation - Jul 6, 2015

Page

379

Windows VMtools Delete Instance with own key


Version

0.0.3

Date

User

Dec 15, 2014

Comment

vCO
Administra
tor

0.0.4

Dec 15, 2014

vCO
Administra
tor

0.0.5

Dec 15, 2014

vCO
Administra
tor

0.0.6

Dec 20, 2014

vCO
Administra
tor

0.0.7

Jan 2, 2015

vCO
Administra
tor

0.0.8

Apr 30, 2015

vCO
Administra
tor

Current version:0.0.8

15.1.2.2. Inputs
Name

Type

Description

vm*

VC:VirtualMachine

username*

string

Username

password*

SecureString

Password

chefHostname*

string

orgName

string

node*

string

Node to delete

*Parameter is mandatory

15.1.2.3. Attributes

vCO Workflow Documentation - Jul 6, 2015

Page

380

Windows VMtools Delete Instance with own key

Name

Type

Description

scriptExitCode

number

Exit code of the script

pem

string

filePath

string

Guest path

result

boolean

Set to true if directory was


created successfully

15.1.2.4. Parameter
Parameter

presentation
Description

Parameter Info

Mandatory input: true

chefHostname

chefHostname

orgName

orgName

node

Node to delete

Mandatory input: true

vm

vm

Mandatory input: true

username

Username

Mandatory input: true

password

Password

Mandatory input: true

15.1.2.5. Workflow

schema

vCO Workflow Documentation - Jul 6, 2015

Page

381

Windows VMtools Delete Instance with own key

15.1.2.6. Workflow
Name

items

Type

Next item

Description

WorkflowItemEnd
Windows

WorkflowItemLink

Delete Node

WorkflowItemLink

Delete file

VMtools get
client.pem
Delete
Client with

Deletes a chef API client.

in guest

own key

There is no response body from


the chef server for this
request.

Delete file

WorkflowItemLink

in guest
Check Result

Check Result

Delete a file in a guest virtual


machine.

WorkflowItemTask

vCO Workflow Documentation - Jul 6, 2015

Page

382

Windows VMtools get client.pem


Name

Delete Node

Type

WorkflowItemLink

Next item

Description

Delete

Deletes a Node on a

Client with

Server.

own key

state of the node.

Chef

Returns the last known

Typically a node has a


respective API client as well.
You may also want to delete the
repective client.
See "Samples/Delete Instance
from Chef by Name" as an
example.

15.1.2.7. Source

code for the used actions

15.1.2.7.1. Check Result


if (result) {
System.log("Successfully deleted "+filePath+" on "+vm.name);
} else {
System.warn("Failed to delete "+filePath+" on "+vm.name);
}

15.1.3.

Windows VMtools get client.pem

15.1.3.1. Versions
Version

0.0.1

Date

Dec 12, 2014

User

Comment

vCO
Administra
tor

0.0.2

Dec 12, 2014

vCO
Administra
tor

0.0.3

Dec 12, 2014

vCO
Administra
tor

0.0.4

Dec 15, 2014

vCO
Administra
tor

vCO Workflow Documentation - Jul 6, 2015

Page

383

Windows VMtools get client.pem


Current version:0.0.4

15.1.3.2. Inputs
Name

Type

Description

vm

VC:VirtualMachine

username

string

Username

password

SecureString

Password

15.1.3.3. Outputs
Name

Type

scriptExitCode

number

pem

string

Description

Exit code of the script

15.1.3.4. Attributes
Name

Type

Description

errorCode

string

retries

number

retryLimit

number

sleepTime

number

toolsReady

boolean

scriptType

string

bash / bat / powershell

scriptTimeout

number

Timeout for the running script (in


second)

interactiveSession

boolean

Script context interactivity

scriptRefreshTime

number

(default) Time (in seconds) where a


check of script status occurs

command

string

scriptOutputText

string

vCO Workflow Documentation - Jul 6, 2015

Output of the script

Page

384

Windows VMtools get client.pem

15.1.3.5. Parameter

presentation

Parameter

Description

vm

vm

username

Guest Username

password

Guest Password

15.1.3.6. Workflow

schema

15.1.3.7. Workflow

items

Name

Type

Parameter Info

Next item

Description

WorkflowItemEnd
testVmToolsF

WorkflowItemTask

Tools Ready?

orGuestOps

vCO Workflow Documentation - Jul 6, 2015

Page

385

Windows VMtools get client.pem


Name

Tools Ready?

Sleep

Type

Next item

Description

WorkflowItemGeneri Run Script


cCondition

In Guest

WorkflowItemTask

testVmToolsF
orGuestOps

WorkflowItemEnd
Run Script

WorkflowItemLink

Check PEM

In Guest

Run a script inside the VM and


wait until it returns his
result.
Retrieve the output of the
script and returns it as output
in the workflow
Inspired by implementation done
in PowerCLI in the following
.NET class :
VMware.VimAutomation.ViCore.Impl
.V1.RunScriptInGuestHelper
VMware.VimAutomation.ViCore.Impl
.V1.Service.VmGuestServiceImpl
Requires running VMwareTools
instance in the GuestOS.
Leverages the vSphere 5.x
GuestOperationsManager object
and is not backwards compatible
with previous versions of
vSphere.

Check PEM

WorkflowItemTask

15.1.3.8. Source

code for the used actions

15.1.3.8.1. testVmToolsForGuestOps
//Auto generated script, cannot be modified !
actionResult = System.getModule("com.vmware.pso.GuestOps").testVmToolsForGuestOps(vm) ;

vCO Workflow Documentation - Jul 6, 2015

Page

386

Windows VMtools get client.pem

15.1.3.8.2. Tools Ready?


//Generated by the system, cannot be edited
return (toolsReady == true) ;

15.1.3.8.3. Sleep
if (retries < retryLimit) {
System.sleep(sleepTime);
retries = retries + 1;
} else {
throw("Retry count exceeded retry limit");
}

15.1.3.8.4. Check PEM


if (scriptOutputText.indexOf("-----BEGIN RSA PRIVATE KEY-----") > -1) {
pem = scriptOutputText;
System.log("Successfully found client.pem");
} else {
throw("Could not find client.pem: "+scriptOutputText);
}

vCO Workflow Documentation - Jul 6, 2015

Page

387

Das könnte Ihnen auch gefallen