1023.1.2
by Aaron Bentley
First python version of gotestwin.py |
1 |
#!/usr/bin/env python
|
2 |
from argparse import ArgumentParser |
|
3 |
from json import dump |
|
4 |
import os |
|
5 |
from os.path import ( |
|
6 |
basename, |
|
7 |
dirname, |
|
8 |
join, |
|
9 |
)
|
|
10 |
import subprocess |
|
11 |
||
12 |
||
13 |
def main(): |
|
14 |
scripts = dirname(__file__) |
|
15 |
parser = ArgumentParser() |
|
1023.1.3
by Aaron Bentley
Add docs. |
16 |
parser.add_argument('host', help='The machine to test on.') |
17 |
parser.add_argument('revision', help='The revision-build to test.') |
|
18 |
parser.add_argument('package', nargs='?', default='github.com/juju/juju', |
|
19 |
help='The package to test.') |
|
1023.1.2
by Aaron Bentley
First python version of gotestwin.py |
20 |
args = parser.parse_args() |
21 |
||
22 |
juju_ci_path = join(scripts, 'jujuci.py') |
|
23 |
downloaded = subprocess.check_output([ |
|
1023.1.4
by Aaron Bentley
Retrieve just the tarball. |
24 |
juju_ci_path, 'get', '-b', args.revision, 'build-revision', '*.tar.gz', |
25 |
'./']) |
|
26 |
(tarfile,) = [basename(l) for l in downloaded.splitlines()] |
|
1023.1.2
by Aaron Bentley
First python version of gotestwin.py |
27 |
|
28 |
subprocess.check_call([ |
|
29 |
juju_ci_path, 'get-build-vars', '--summary', args.revision]) |
|
30 |
with open('temp-config.yaml', 'w') as temp_file: |
|
31 |
dump({ |
|
32 |
'install': {'ci': [ |
|
33 |
tarfile, |
|
34 |
join(scripts, 'gotesttarfile.py'), |
|
1424
by Curtis Hovey
Fix gotestwin imports. |
35 |
join(scripts, 'jujucharm.py'), |
1023.1.2
by Aaron Bentley
First python version of gotestwin.py |
36 |
join(scripts, 'utility.py'), |
37 |
]},
|
|
1027.2.4
by seman.said at canonical
Updated unit test in test_schedule_hetero_control. |
38 |
'command': [ |
1023.1.2
by Aaron Bentley
First python version of gotestwin.py |
39 |
'python', 'ci/gotesttarfile.py', '-v', '-g', 'go.exe', '-p', |
40 |
args.package, '--remove', 'ci/{}'.format(tarfile) |
|
1027.2.4
by seman.said at canonical
Updated unit test in test_schedule_hetero_control. |
41 |
]},
|
1031.1.4
by Curtis Hovey
Hush lint. |
42 |
temp_file) |
1023.1.2
by Aaron Bentley
First python version of gotestwin.py |
43 |
juju_home = os.environ.get('JUJU_HOME', |
44 |
join(dirname(scripts), 'cloud-city')) |
|
45 |
subprocess.check_call([ |
|
46 |
'workspace-run', '-v', '-i', join(juju_home, 'staging-juju-rsa'), |
|
47 |
'temp-config.yaml', 'Administrator@{}'.format(args.host) |
|
48 |
])
|
|
49 |
||
1023.1.3
by Aaron Bentley
Add docs. |
50 |
|
1023.1.2
by Aaron Bentley
First python version of gotestwin.py |
51 |
if __name__ == '__main__': |
52 |
main() |