Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100755 69 lines (59 sloc) 1.98 kb
b03dfd9 Adding two more tests
BuzzTroll authored
1 #!/usr/bin/env python
2
3 import pexpect
4 import sys
5 import os
6 import uuid
7
f3cd495 @buzztroll breaking out the image name from the image location
buzztroll authored
8 tst_image_name = os.environ['NIMBUS_TEST_IMAGE']
9 tst_image_src = os.environ['NIMBUS_SOURCE_TEST_IMAGE']
899db05 @buzztroll this time remembering to quote the env
buzztroll authored
10 to=int(os.environ["NIMBUS_TEST_TIMEOUT"])
b03dfd9 Adding two more tests
BuzzTroll authored
11 cc_home=os.environ['CLOUD_CLIENT_HOME']
12 nh=os.environ['NIMBUS_HOME']
13 logfile = sys.stdout
14 common_image = str(uuid.uuid1()).replace("-", "")
15
f3cd495 @buzztroll breaking out the image name from the image location
buzztroll authored
16 cmd = "%s/bin/nimbus-public-image %s %s" % (nh, tst_image_src, common_image)
b03dfd9 Adding two more tests
BuzzTroll authored
17 (x, rc)=pexpect.run(cmd, withexitstatus=1, logfile=logfile)
18 if rc != 0:
19 print "failed create the public image"
20 sys.exit(1)
21
22 cmd = "%s/bin/cloud-client.sh --run --name %s --hours .25" % (cc_home, common_image)
23 child = pexpect.spawn (cmd, timeout=to, maxread=20000, logfile=logfile)
24 rc = child.expect ('Running:')
25 if rc != 0:
d771635 @buzztroll removing harded references to group
buzztroll authored
26 print "Running not found in the list"
b03dfd9 Adding two more tests
BuzzTroll authored
27 sys.exit(1)
28 handle = child.readline().strip().replace("'", "")
29 rc = child.expect(pexpect.EOF)
30 if rc != 0:
31 print "run"
32 sys.exit(1)
33
34 cmd = "%s/bin/cloud-client.sh --handle %s --save" % (cc_home, handle)
35 print cmd
36 (x, rc)=pexpect.run(cmd, withexitstatus=1, logfile=logfile)
37 print x
38 if rc != 0:
39 print "failed to save"
40 sys.exit(1)
41
42
43 cmd = "%s/bin/cloud-client.sh --run --name %s --hours .25" % (cc_home, common_image)
44 child = pexpect.spawn (cmd, timeout=to, maxread=20000, logfile=logfile)
45 rc = child.expect ('Running:')
46 if rc != 0:
d771635 @buzztroll removing harded references to group
buzztroll authored
47 print "Running not found in the list"
b03dfd9 Adding two more tests
BuzzTroll authored
48 sys.exit(1)
49 handle = child.readline().strip().replace("'", "")
50 rc = child.expect(pexpect.EOF)
51 if rc != 0:
52 print "run"
53 sys.exit(1)
54 cmd = "%s/bin/cloud-client.sh --terminate --handle %s" % (cc_home, handle)
55 print cmd
56 (x, rc)=pexpect.run(cmd, withexitstatus=1, timeout=to, logfile=logfile)
57 print x
58 if rc != 0:
59 print "failed to terminate"
60 sys.exit(1)
61
62
63 cmd = "%s/bin/nimbus-public-image --delete %s" % (nh, common_image)
64 (x, rc)=pexpect.run(cmd, withexitstatus=1, logfile=logfile)
65 if rc != 0:
66 print "failed create the public image"
67 sys.exit(1)
68 sys.exit(0)
Something went wrong with that request. Please try again.