Merge lp:~sinzui/juju-ci-tools/remove-common-startup into lp:juju-ci-tools

Proposed by Curtis Hovey
Status: Merged
Merged at revision: 967
Proposed branch: lp:~sinzui/juju-ci-tools/remove-common-startup
Merge into: lp:juju-ci-tools
Diff against target: 137 lines (+3/-77)
3 files modified
common-startup.sh (+0/-39)
deploy_stack.py (+1/-18)
test_deploy_stack.py (+2/-20)
To merge this branch: bzr merge lp:~sinzui/juju-ci-tools/remove-common-startup
Reviewer Review Type Date Requested Status
John George (community) Approve
Review via email: mp+260532@code.launchpad.net

Description of the change

Remove common-startup.sh

No CI jobs are directly using common-startup, or passing --run-startup to script. Let this code die.

PS All the jobs I changed have passed CI.

To post a comment you must log in.
Revision history for this message
John George (jog) wrote :

Small exception message change needed.

review: Needs Fixing
967. By Curtis Hovey

Remove exception...--new-juju-bin is required.

Revision history for this message
John George (jog) wrote :

Thank you.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== removed file 'common-startup.sh'
2--- common-startup.sh 2015-05-19 16:24:24 +0000
3+++ common-startup.sh 1970-01-01 00:00:00 +0000
4@@ -1,39 +0,0 @@
5-set -eu
6-set +x
7-: ${SCRIPTS=$(readlink -f $(dirname $0))}
8-export PATH="$SCRIPTS:$PATH"
9-
10-export JUJU_HOME=${JUJU_HOME:-$HOME/cloud-city}
11-: ${JUJU_REPOSITORY=$HOME/repository}
12-export JUJU_REPOSITORY
13-
14-export MACHINES=""
15-source $JUJU_HOME/juju-qa.jujuci
16-set -x
17-
18-# Determine BRANCH, REVNO, VERSION, and PACKAGES under test.
19-RELEASE=$(lsb_release -sr)
20-ARCH=$(dpkg --print-architecture)
21-if [[ -n ${revision_build:-} ]]; then
22- VERSION=$($SCRIPTS/jujuci.py get-build-vars --version $revision_build)
23- PACKAGES_JOB="publish-revision"
24- JUJU_LOCAL_DEB="juju-local_$VERSION-0ubuntu1~$RELEASE.1~juju1_all.deb"
25- JUJU_CORE_DEB="juju-core_$VERSION-0ubuntu1~$RELEASE.1~juju1_$ARCH.deb"
26- $SCRIPTS/jujuci.py get-build-vars --summary --env $ENV $revision_build
27-elif [[ -n ${VERSION:-} ]]; then
28- PACKAGES_JOB="certify-ubuntu-packages"
29- JUJU_LOCAL_DEB=$(
30- $SCRIPTS/jujuci.py list $PACKAGES_JOB "juju-local_*_all.deb")
31- JUJU_CORE_DEB=$(
32- $SCRIPTS/jujuci.py list $PACKAGES_JOB "juju-core_*_$ARCH.deb")
33- echo "Testing $VERSION on $ENV"
34-else
35- echo "Job didn't define revision_build or VERSION"
36- exit 1
37-fi
38-
39-# Provide the juju-core and juju-local packages to the test
40-$SCRIPTS/jujuci.py get $PACKAGES_JOB $JUJU_LOCAL_DEB
41-$SCRIPTS/jujuci.py get $PACKAGES_JOB $JUJU_CORE_DEB
42-dpkg-deb -x ./$JUJU_CORE_DEB extracted-bin
43-export NEW_JUJU_BIN=$(readlink -f $(dirname $(find extracted-bin -name juju)))
44
45=== modified file 'deploy_stack.py'
46--- deploy_stack.py 2015-05-15 19:37:31 +0000
47+++ deploy_stack.py 2015-05-29 20:53:21 +0000
48@@ -381,8 +381,6 @@
49 def add_path_args(parser):
50 parser.add_argument('--new-juju-bin', default=None,
51 help='Dirctory containing the new Juju binary.')
52- parser.add_argument('--run-startup', help='Run common-startup.sh.',
53- action='store_true', default=False)
54
55
56 def add_output_args(parser):
57@@ -402,22 +400,7 @@
58
59
60 def get_juju_path(args):
61- if args.run_startup:
62- env = dict(os.environ)
63- env.update({
64- 'ENV': args.env,
65- })
66- scripts = os.path.dirname(os.path.abspath(sys.argv[0]))
67- subprocess.check_call(
68- ['bash', '{}/common-startup.sh'.format(scripts)], env=env)
69- bin_path = subprocess.check_output(['find', 'extracted-bin', '-name',
70- 'juju']).rstrip('\n')
71- juju_path = os.path.abspath(bin_path)
72- elif args.new_juju_bin is None:
73- raise Exception('Either --new-juju-bin or --run-startup must be'
74- ' supplied.')
75- else:
76- juju_path = os.path.join(args.new_juju_bin, 'juju')
77+ juju_path = os.path.join(args.new_juju_bin, 'juju')
78 return juju_path
79
80
81
82=== modified file 'test_deploy_stack.py'
83--- test_deploy_stack.py 2015-05-15 19:45:42 +0000
84+++ test_deploy_stack.py 2015-05-29 20:53:21 +0000
85@@ -8,7 +8,6 @@
86 import os
87 from StringIO import StringIO
88 import subprocess
89-import sys
90 from textwrap import dedent
91 from unittest import TestCase
92
93@@ -80,7 +79,7 @@
94 cmd_line = ['proc', '--new-juju-bin', '/tmp/juju']
95 with patch('sys.argv', cmd_line):
96 args_dict = parser.parse_args().__dict__
97- expected = {'run_startup': False, 'new_juju_bin': '/tmp/juju'}
98+ expected = {'new_juju_bin': '/tmp/juju'}
99 self.assertEqual(args_dict, expected)
100
101 def test_add_path_args_new_juju_bin_default(self):
102@@ -112,26 +111,10 @@
103 self.assertEqual(args_dict, expected)
104
105 def test_get_juju_path_new_juju_bin(self):
106- args = Namespace(new_juju_bin='/tmp/juju', run_startup=False)
107+ args = Namespace(new_juju_bin='/tmp/juju')
108 juju_path = get_juju_path(args)
109 self.assertEqual(juju_path, '/tmp/juju/juju')
110
111- def test_get_juju_path_run_startup(self):
112- args = Namespace(run_startup=True, env='proc')
113- with patch.dict(os.environ, {'PATH': os.environ['PATH']}):
114- with patch('subprocess.check_call', autospec=True) as cc_mock:
115- with patch('subprocess.check_output',
116- return_value='foo\n') as co_mock:
117- juju_path = get_juju_path(args)
118- env = dict(os.environ)
119- scripts = os.path.dirname(os.path.abspath(sys.argv[0]))
120- env['ENV'] = args.env
121- cc_mock.assert_called_once_with(
122- ['bash', '{}/common-startup.sh'.format(scripts)], env=env)
123- co_mock.assert_called_once_with(
124- ['find', 'extracted-bin', '-name', 'juju'])
125- self.assertEqual(juju_path, os.path.abspath('foo'))
126-
127 def test_get_log_level_debug(self):
128 parser = ArgumentParser('proc')
129 add_output_args(parser)
130@@ -796,7 +779,6 @@
131 logs='bar',
132 machine=[],
133 new_juju_bin=None,
134- run_startup=False,
135 series=None,
136 upgrade=False,
137 verbose=False,

Subscribers

People subscribed via source and target branches