første xml update
[virt-orchestrator.git] / vFLOWER / content / Workflows / uio / lib / ad / get_ad_computer.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="item1" object-name="workflow:name=generic" id="6ba8217c-e631-4bfb-80fc-16cec2e5c369" version="0.0.11" api-version="3.1.0" allowed-operations="fve" restartMode="1" resumeFromFailedMode="0">
3     <display-name>get_ad_computer</display-name>
4
5     <description>Sjekk om AD computer object er opprettet</description>
6
7     <position x="100.0" y="50.0"/>
8
9     <input>
10         <param name="computername" type="string"/>
11     </input>
12
13     <output>
14         <param name="ou" type="string"/>
15     </output>
16
17     <attrib name="pc" type="AD:ComputerAD" read-only="false">
18         <value encoded="n">__NULL__</value>
19     </attrib>
20     <attrib name="sleepTime" type="number" read-only="false">
21         <value encoded="n">10.0</value>
22         <description>Time to sleep in seconds</description>
23     </attrib>
24     <attrib name="counter" type="number" read-only="false">
25         <value encoded="n">10.0</value>
26         <description>counter to increment</description>
27     </attrib>
28     <attrib name="errorCode" type="string" read-only="false">
29         <value encoded="n">Not able to find computer object in AD after 360 retries</value>
30     </attrib>
31     <attrib name="domainName" type="string" read-only="false">
32         <value encoded="n">tsd.uio.no</value>
33         <description>Domain name in form: company.sample (optional)</description>
34     </attrib>
35     <attrib name="task" type="Task" read-only="false">
36         <value encoded="n">__NULL__</value>
37     </attrib>
38
39     <workflow-item name="item0" type="end" end-mode="0">
40         <position x="1004.5" y="27.227272727272727"/>
41     </workflow-item>
42
43     <workflow-item name="item1" out-name="item2" type="task">
44         <display-name>Let etter computer object i AD</display-name>
45
46         <script encoded="false">
47 var vmname=computername;
48 vmname=computername.replace(/\..*/,"")
49
50 function get_computers (vmname) {
51         System.log("NAME "+vmname);
52         var computers = ActiveDirectory.getComputerADRecursively(vmname);
53         for each (var mpc in computers){
54         //System.log("Checking computer: "+pc.name);
55         if (vmname.toLowerCase() == mpc.name.toLowerCase()){
56                 System.log("Found Computer: "+mpc.name);
57                         var ff=mpc.allAttributes;
58                         return mpc;
59         }
60         }
61 }
62
63 pc=get_computers(vmname);
64 System.log("====================================");
65
66 if (pc) {
67         var ldapPath=pc.distinguishedName;
68         var ous=ldapPath.split(',');
69         ous.shift();
70         ou=ous.toString();
71         
72         System.log("Sletter "+pc.name);
73         pc.destroy();
74 }
75         </script>
76
77         <in-binding>
78             <bind name="computername" type="string" export-name="computername"/>
79             <bind name="domainName" type="string" export-name="domainName">
80                 <description>Domain name in form: company.sample (optional)</description>
81             </bind>
82         </in-binding>
83
84         <out-binding>
85             <bind name="pc" type="AD:ComputerAD" export-name="pc"/>
86             <bind name="ou" type="string" export-name="ou"/>
87             <bind name="task" type="Task" export-name="task"/>
88         </out-binding>
89
90         <position x="285.0" y="55.90909090909091"/>
91     </workflow-item>
92
93     <workflow-item name="item2" out-name="item0" type="condition" alt-out-name="item5" comparator="0">
94         <display-name>Defined eller ikke</display-name>
95
96         <script encoded="false">
97 //Generated by the system, cannot be edited
98 return (pc  != null ) ;
99         </script>
100
101         <in-binding>
102             <bind name="pc" type="AD:ComputerAD" export-name="pc"/>
103         </in-binding>
104         <condition name="pc" type="AD:ComputerAD" comparator="0" label="null"/>
105
106         <position x="624.5" y="45.40909090909091"/>
107     </workflow-item>
108
109     <workflow-item name="item4" prototype-id="sleep" out-name="item1" content-mode="x" type="task">
110         <display-name>Sleep</display-name>
111
112         <script encoded="false">
113 //Auto-generated script
114 if ( sleepTime != null )  {
115         System.sleep(sleepTime*1000);
116 }
117 else  {
118         throw "'sleepTime' is NULL";
119 }
120         </script>
121
122         <in-binding>
123             <bind name="sleepTime" type="number" export-name="sleepTime">
124                 <description>Time to sleep in seconds</description>
125             </bind>
126         </in-binding>
127
128         <out-binding/>
129
130         <description>Sleep a given number of seconds</description>
131
132         <position x="624.5" y="246.3181818181818"/>
133     </workflow-item>
134
135     <workflow-item name="item3" prototype-id="increase-counter" out-name="item4" content-mode="x" type="task">
136         <display-name>Increase counter</display-name>
137
138         <script encoded="false">
139 //Auto-generated script
140 counter = counter+1;
141         </script>
142
143         <in-binding>
144             <bind name="counter" type="number" export-name="counter">
145                 <description>counter to increment</description>
146             </bind>
147         </in-binding>
148
149         <out-binding>
150             <bind name="counter" type="number" export-name="counter">
151                 <description>counter incremented</description>
152             </bind>
153         </out-binding>
154
155         <description>Increment a counter by one</description>
156
157         <position x="624.5" y="182.68181818181816"/>
158     </workflow-item>
159
160     <workflow-item name="item5" out-name="item3" type="condition" alt-out-name="item6" comparator="0">
161         <display-name>Gi opp eller fortsett å vente</display-name>
162
163         <script encoded="false">
164 //Generated by the system, cannot be edited
165 return (counter &lt; 360.0) ;
166         </script>
167
168         <in-binding>
169             <bind name="counter" type="number" export-name="counter"/>
170         </in-binding>
171         <condition name="counter" type="number" comparator="3" label="null">360.0</condition>
172
173         <position x="624.5" y="109.04545454545453"/>
174     </workflow-item>
175
176     <workflow-item name="item6" throw-bind-name="errorCode" type="end" end-mode="1">
177         <position x="804.5" y="109.04545454545453"/>
178     </workflow-item>
179
180     <presentation>
181         <p-param name="computername">
182             <desc>computername</desc>
183         </p-param>
184     </presentation>
185 </workflow>