-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathreverseDar.py
More file actions
42 lines (33 loc) · 1.57 KB
/
reverseDar.py
File metadata and controls
42 lines (33 loc) · 1.57 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import com.xebialabs.deployit.plugin.api.udm.artifact.Artifact
import getopt, sys, time, ast
def reverseDar(id, propertiesFile):
file = open(propertiesFile, "w")
cis = [str(item) for item in repository.read(id).deployables]
for item in cis:
ci = repository.read(item)
if isinstance(ci.values._ci, com.xebialabs.deployit.plugin.api.udm.artifact.Artifact):
for entries in repository.read(ci).values._ci.getSyntheticProperties().entrySet():
file.write("artifact" + entries.key + "=" + entries.value + "\n")
file.write("fileLocation=\n")
else:
for entries in repository.read(ci).values._ci.getSyntheticProperties().entrySet():
file.write("resource" + entries.key + "=" + entries.value + "\n")
file.write("fileLocation=\n")
file.close()
try:
opts, args = getopt.getopt(sys.argv[1:],'hd:p:',['id=','propertiesFile='])
except getopt.GetoptError:
print 'cli.sh -host <XLDeployHost> -username <username> -password <password> -f $PWD/reverseDar.y -- -d <id> -p <propertiesFile>'
sys.exit(2)
for opt, arg in opts:
if opt == '-h':
print 'cli.sh -host <XLDeployHost> -username <username> -password <password> -f $PWD/reverseDar.y -- -d <id> -p <propertiesFile>'
sys.exit(-1)
elif opt in ('-d', '--id'):
id = arg
elif opt in ('-p', '--propertiesFile'):
propertiesFile = arg
if id == None:
print 'ERROR: appName and buildID are mandatory on the command line'
print 'cli.sh -host <XLDeployHost> -username <username> -password <password> -f $PWD/reverseDar.py -- -d <id> -p <propertiesFile>'
sys.exit(-1)