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
=== removed file 'common-startup.sh'
--- common-startup.sh 2015-05-19 16:24:24 +0000
+++ common-startup.sh 1970-01-01 00:00:00 +0000
@@ -1,39 +0,0 @@
1set -eu
2set +x
3: ${SCRIPTS=$(readlink -f $(dirname $0))}
4export PATH="$SCRIPTS:$PATH"
5
6export JUJU_HOME=${JUJU_HOME:-$HOME/cloud-city}
7: ${JUJU_REPOSITORY=$HOME/repository}
8export JUJU_REPOSITORY
9
10export MACHINES=""
11source $JUJU_HOME/juju-qa.jujuci
12set -x
13
14# Determine BRANCH, REVNO, VERSION, and PACKAGES under test.
15RELEASE=$(lsb_release -sr)
16ARCH=$(dpkg --print-architecture)
17if [[ -n ${revision_build:-} ]]; then
18 VERSION=$($SCRIPTS/jujuci.py get-build-vars --version $revision_build)
19 PACKAGES_JOB="publish-revision"
20 JUJU_LOCAL_DEB="juju-local_$VERSION-0ubuntu1~$RELEASE.1~juju1_all.deb"
21 JUJU_CORE_DEB="juju-core_$VERSION-0ubuntu1~$RELEASE.1~juju1_$ARCH.deb"
22 $SCRIPTS/jujuci.py get-build-vars --summary --env $ENV $revision_build
23elif [[ -n ${VERSION:-} ]]; then
24 PACKAGES_JOB="certify-ubuntu-packages"
25 JUJU_LOCAL_DEB=$(
26 $SCRIPTS/jujuci.py list $PACKAGES_JOB "juju-local_*_all.deb")
27 JUJU_CORE_DEB=$(
28 $SCRIPTS/jujuci.py list $PACKAGES_JOB "juju-core_*_$ARCH.deb")
29 echo "Testing $VERSION on $ENV"
30else
31 echo "Job didn't define revision_build or VERSION"
32 exit 1
33fi
34
35# Provide the juju-core and juju-local packages to the test
36$SCRIPTS/jujuci.py get $PACKAGES_JOB $JUJU_LOCAL_DEB
37$SCRIPTS/jujuci.py get $PACKAGES_JOB $JUJU_CORE_DEB
38dpkg-deb -x ./$JUJU_CORE_DEB extracted-bin
39export NEW_JUJU_BIN=$(readlink -f $(dirname $(find extracted-bin -name juju)))
400
=== modified file 'deploy_stack.py'
--- deploy_stack.py 2015-05-15 19:37:31 +0000
+++ deploy_stack.py 2015-05-29 20:53:21 +0000
@@ -381,8 +381,6 @@
381def add_path_args(parser):381def add_path_args(parser):
382 parser.add_argument('--new-juju-bin', default=None,382 parser.add_argument('--new-juju-bin', default=None,
383 help='Dirctory containing the new Juju binary.')383 help='Dirctory containing the new Juju binary.')
384 parser.add_argument('--run-startup', help='Run common-startup.sh.',
385 action='store_true', default=False)
386384
387385
388def add_output_args(parser):386def add_output_args(parser):
@@ -402,22 +400,7 @@
402400
403401
404def get_juju_path(args):402def get_juju_path(args):
405 if args.run_startup:403 juju_path = os.path.join(args.new_juju_bin, 'juju')
406 env = dict(os.environ)
407 env.update({
408 'ENV': args.env,
409 })
410 scripts = os.path.dirname(os.path.abspath(sys.argv[0]))
411 subprocess.check_call(
412 ['bash', '{}/common-startup.sh'.format(scripts)], env=env)
413 bin_path = subprocess.check_output(['find', 'extracted-bin', '-name',
414 'juju']).rstrip('\n')
415 juju_path = os.path.abspath(bin_path)
416 elif args.new_juju_bin is None:
417 raise Exception('Either --new-juju-bin or --run-startup must be'
418 ' supplied.')
419 else:
420 juju_path = os.path.join(args.new_juju_bin, 'juju')
421 return juju_path404 return juju_path
422405
423406
424407
=== modified file 'test_deploy_stack.py'
--- test_deploy_stack.py 2015-05-15 19:45:42 +0000
+++ test_deploy_stack.py 2015-05-29 20:53:21 +0000
@@ -8,7 +8,6 @@
8import os8import os
9from StringIO import StringIO9from StringIO import StringIO
10import subprocess10import subprocess
11import sys
12from textwrap import dedent11from textwrap import dedent
13from unittest import TestCase12from unittest import TestCase
1413
@@ -80,7 +79,7 @@
80 cmd_line = ['proc', '--new-juju-bin', '/tmp/juju']79 cmd_line = ['proc', '--new-juju-bin', '/tmp/juju']
81 with patch('sys.argv', cmd_line):80 with patch('sys.argv', cmd_line):
82 args_dict = parser.parse_args().__dict__81 args_dict = parser.parse_args().__dict__
83 expected = {'run_startup': False, 'new_juju_bin': '/tmp/juju'}82 expected = {'new_juju_bin': '/tmp/juju'}
84 self.assertEqual(args_dict, expected)83 self.assertEqual(args_dict, expected)
8584
86 def test_add_path_args_new_juju_bin_default(self):85 def test_add_path_args_new_juju_bin_default(self):
@@ -112,26 +111,10 @@
112 self.assertEqual(args_dict, expected)111 self.assertEqual(args_dict, expected)
113112
114 def test_get_juju_path_new_juju_bin(self):113 def test_get_juju_path_new_juju_bin(self):
115 args = Namespace(new_juju_bin='/tmp/juju', run_startup=False)114 args = Namespace(new_juju_bin='/tmp/juju')
116 juju_path = get_juju_path(args)115 juju_path = get_juju_path(args)
117 self.assertEqual(juju_path, '/tmp/juju/juju')116 self.assertEqual(juju_path, '/tmp/juju/juju')
118117
119 def test_get_juju_path_run_startup(self):
120 args = Namespace(run_startup=True, env='proc')
121 with patch.dict(os.environ, {'PATH': os.environ['PATH']}):
122 with patch('subprocess.check_call', autospec=True) as cc_mock:
123 with patch('subprocess.check_output',
124 return_value='foo\n') as co_mock:
125 juju_path = get_juju_path(args)
126 env = dict(os.environ)
127 scripts = os.path.dirname(os.path.abspath(sys.argv[0]))
128 env['ENV'] = args.env
129 cc_mock.assert_called_once_with(
130 ['bash', '{}/common-startup.sh'.format(scripts)], env=env)
131 co_mock.assert_called_once_with(
132 ['find', 'extracted-bin', '-name', 'juju'])
133 self.assertEqual(juju_path, os.path.abspath('foo'))
134
135 def test_get_log_level_debug(self):118 def test_get_log_level_debug(self):
136 parser = ArgumentParser('proc')119 parser = ArgumentParser('proc')
137 add_output_args(parser)120 add_output_args(parser)
@@ -796,7 +779,6 @@
796 logs='bar',779 logs='bar',
797 machine=[],780 machine=[],
798 new_juju_bin=None,781 new_juju_bin=None,
799 run_startup=False,
800 series=None,782 series=None,
801 upgrade=False,783 upgrade=False,
802 verbose=False,784 verbose=False,

Subscribers

People subscribed via source and target branches