første xml update
[virt-orchestrator.git] / vFLOWER / content / Workflows / Library / vCenter / Guest operations / Files / Check for file in guest.workflow.xml
1 <?xml version="1.0" encoding="UTF-8"?>
2 <workflow xmlns="http://vmware.com/vco/workflow" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://vmware.com/vco/workflow http://vmware.com/vco/workflow/Workflow-v4.xsd" root-name="item4" object-name="workflow:name=generic" id="C3808080808080808080808080808080AA80808001322751030482b80adf61e7c" version="0.0.0" api-version="3.1.0" allowed-operations="fv" restartMode="1" resumeFromFailedMode="0">
3     <display-name>Check for file in guest</display-name>
4
5     <description>
6 Checks to see if a directory exists in a guest VM.
7 Output parameter result is a boolean.
8     </description>
9
10     <position x="100.0" y="50.0"/>
11
12     <input>
13         <param name="vmUsername" type="string">
14             <description>Username for the virtual machine</description>
15         </param>
16         <param name="vmPassword" type="SecureString">
17             <description>Password for the virtual machine</description>
18         </param>
19         <param name="vm" type="VC:VirtualMachine">
20             <description>Virtual machine</description>
21         </param>
22         <param name="path" type="string">
23             <description>Path in virtual machine to check</description>
24         </param>
25     </input>
26
27     <output>
28         <param name="exists" type="boolean">
29             <description>True if directory exists.</description>
30         </param>
31     </output>
32
33     <attrib name="resultLimit" type="number" read-only="false">
34         <value encoded="n">1.0</value>
35         <description>Result list maximum entries.</description>
36     </attrib>
37     <attrib name="result" type="Array/CompositeType(path:string,type:string,size:number):VcGuestFileInfoType" read-only="false">
38         <value encoded="n">__NULL__</value>
39         <description>Array of file info objects (path, type, size).</description>
40     </attrib>
41     <attrib name="errorCode" type="string" read-only="false">
42         <value encoded="n"/>
43     </attrib>
44
45     <workflow-item name="item0" type="end" end-mode="0">
46         <position x="664.5" y="45.40909090909091"/>
47     </workflow-item>
48
49     <workflow-item name="item2" out-name="item0" type="task">
50         <display-name>set result</display-name>
51
52         <script encoded="false">
53 exists = false;
54 for (var i in result) {
55         var f = result[i];
56         System.log("&gt;" + f.path + "&lt;");
57         System.log("&gt;" + path + "&lt;");
58         System.log(f.path + " : " + f.type + " p:" + (f.path == path) + " f:" + (f.type == "file"));
59         if (f.path == path &amp;&amp; f.type == "file") {
60                 exists = true;
61                 break;
62         }
63 }
64         </script>
65
66         <in-binding>
67             <bind name="result" type="Array/CompositeType(path:string,type:string,size:number):VcGuestFileInfoType" export-name="result"/>
68             <bind name="path" type="string" export-name="path"/>
69         </in-binding>
70
71         <out-binding>
72             <bind name="exists" type="boolean" export-name="exists"/>
73         </out-binding>
74
75         <position x="484.5" y="9.954545454545453"/>
76     </workflow-item>
77
78     <workflow-item name="item3" out-name="item0" type="task">
79         <display-name>process error</display-name>
80
81         <script encoded="false">
82 if (!/File .+ was not found.+/.test(errorCode)) {
83         throw errorCode;
84 }
85 exists = false;
86         </script>
87
88         <in-binding>
89             <bind name="errorCode" type="string" export-name="errorCode"/>
90         </in-binding>
91
92         <out-binding>
93             <bind name="exists" type="boolean" export-name="exists"/>
94         </out-binding>
95
96         <position x="484.5" y="55.40909090909091"/>
97     </workflow-item>
98
99     <workflow-item name="item4" out-name="item2" catch-name="item3" throw-bind-name="errorCode" type="link" linked-workflow-id="C28080808080808080808080808080808180808001322751030482b80adf61e7c">
100         <display-name>List path in guest</display-name>
101
102         <in-binding>
103             <bind name="vmUsername" type="string" export-name="vmUsername">
104                 <description>Username for the virtual machine</description>
105             </bind>
106             <bind name="vmPassword" type="SecureString" export-name="vmPassword">
107                 <description>Password for the virtual machine</description>
108             </bind>
109             <bind name="vm" type="VC:VirtualMachine" export-name="vm">
110                 <description>Virtual machine</description>
111             </bind>
112             <bind name="path" type="string" export-name="path">
113                 <description>Path in virtual machine to check</description>
114             </bind>
115             <bind name="resultLimit" type="number" export-name="resultLimit">
116                 <description>Result list maximum entries.</description>
117             </bind>
118         </in-binding>
119
120         <out-binding>
121             <bind name="result" type="Array/CompositeType(path:string,type:string,size:number):VcGuestFileInfoType" export-name="result">
122                 <description>Array of file info objects (path, type, size).</description>
123             </bind>
124         </out-binding>
125
126         <description>List path in a guest VM. Output parameter result is list of files and/or directories or throws if path does not exists.</description>
127
128         <position x="204.5" y="55.40909090909091"/>
129     </workflow-item>
130
131     <presentation>
132         <p-param name="vmUsername">
133             <desc>Username for the virtual machine</desc>
134         </p-param>
135         <p-param name="vmPassword">
136             <desc>Password for the virtual machine</desc>
137         </p-param>
138         <p-param name="vm">
139             <desc>Virtual machine</desc>
140             <p-qual kind="static" name="mandatory" type="boolean">true</p-qual>
141         </p-param>
142         <p-param name="path">
143             <desc>Path in virtual machine to check</desc>
144             <p-qual kind="static" name="mandatory" type="boolean">true</p-qual>
145         </p-param>
146     </presentation>
147 </workflow>