2
from argparse import ArgumentParser
6
from textwrap import dedent
7
from utility import s3_cmd
11
def win_test(script_dir, address, juju_home, revision_build):
12
host = 'Administrator@{}'.format(address)
13
private_key = os.path.join(juju_home, 'staging-juju-rsa')
14
revision_build_url = (
15
's3://juju-qa-data/juju-ci/products/version-{}'.format(revision_build))
16
win_client_url = '{}/build-win-client/'.format(revision_build_url)
17
output = s3_cmd(['ls', '-r', win_client_url])
18
urls = sorted(l.split()[3] for l in output.splitlines())
19
installer = [u for u in urls if re.search('juju-setup-.*\.exe', u)][-1]
20
s3_cmd(['sync', installer, '.'])
21
install_file = installer.split('/')[-1]
22
with open('run-file', 'w') as run_file:
23
run_file.write(dedent("""
26
juju destroy-environment --force -y win-client-deploy
28
python ci\\\\deploy_job.py parallel-win-client \
29
'c:\\Program Files (x86)\\Juju\\juju.exe' \
30
logs win-client-deploy --series trusty \
31
--agent-stream revision-build-{revision_build}
32
""".format(revision_build=revision_build)))
34
ci = [os.path.join(script_dir, f) for f in [
35
'deploy_stack.py', 'deploy_job.py', 'fakejuju.py', 'jujupy.py',
36
'jujuconfig.py', 'remote.py', 'substrate.py', 'utility.py',
37
'get_ami.py', 'chaos.py', 'timeout.py', 'jujucharm.py',
40
ci.extend([install_file, 'run-file'])
41
with open('foo.yaml', 'w') as config:
43
'install': {'ci': ci},
44
'command': ['ci/run-file', install_file],
46
subprocess.check_call(['workspace-run', '-v', 'foo.yaml', host, '-i',
51
parser = ArgumentParser()
52
parser.add_argument('address',
53
help='The IP or DNS address the windows test machine.')
54
parser.add_argument('revision_build',
55
help='Revision-build to test.')
57
'--juju-home', default=os.environ.get('JUJU_HOME'),
58
help='The location of cloud-city and staging-juju-rsa.')
59
script_dir = os.path.dirname(__file__)
60
win_test(script_dir=script_dir, **parser.parse_args().__dict__)
63
if __name__ == '__main__':
6
echo "usage: $0 ADDRESS"
7
echo " ADDRESS: The IP or DNS address the windows test machine."
8
echo " --juju-home: The location of cloud-city and staging-juju-rsa."
13
while [[ "${1-}" != "" && $1 =~ ^-.* ]]; do
17
JUJU_HOME=$(cd $1; pwd)
30
test $# -eq 1 || usage
33
: ${SCRIPTS=$(readlink -f $(dirname $0))}
34
export PATH="$SCRIPTS:$PATH"
36
SSH_OPTIONS="-i $JUJU_HOME/staging-juju-rsa \
37
-o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null"
40
if [[ $INSTALL_JUJU == "true" ]]; then
42
$SCRIPTS/jujuci.py get build-win-client 'juju-setup-*.exe' ./)
43
echo "Downloaded $installer"
44
scp $SSH_OPTIONS $installer \
45
Administrator@$HOST:/cygdrive/c/Users/Administrator/ci
46
ssh $SSH_OPTIONS Administrator@$HOST \
47
/cygdrive/c/Users/Administrator/ci/$installer /verysilent
48
ssh $SSH_OPTIONS Administrator@$HOST juju version
52
$SCRIPTS/deploy_stack.py $SCRIPTS/jujupy.py $SCRIPTS/jujuconfig.py \
53
$SCRIPTS/substrate.py $SCRIPTS/utility.py \
54
Administrator@$HOST:/cygdrive/c/Users/Administrator/ci/
59
ssh $SSH_OPTIONS Administrator@$HOST \
60
'juju destroy-environment --force -y test-win-client'
61
ssh $SSH_OPTIONS Administrator@$HOST \
62
'/cygdrive/c/python27/python \\Users\\Administrator\\ci\\deploy_stack.py' \
65
ssh $SSH_OPTIONS Administrator@$HOST \
66
'juju destroy-environment --force -y test-win-client'