Merge lp:~bac/lpsetup/setup_x into lp:lpsetup

Proposed by Brad Crittenden
Status: Merged
Approved by: Brad Crittenden
Approved revision: 79
Merged at revision: 79
Proposed branch: lp:~bac/lpsetup/setup_x
Merge into: lp:lpsetup
Diff against target: 22 lines (+8/-2)
1 file modified
lpsetup/subcommands/init_target.py (+8/-2)
To merge this branch: bzr merge lp:~bac/lpsetup/setup_x
Reviewer Review Type Date Requested Status
Brad Crittenden (community) code Approve
Review via email: mp+121427@code.launchpad.net

Commit message

Check to ensure the interpreter for lpsetup/bin/launchpad-database-setup.sh is what is expected before invoking it.

Description of the change

Our work-around for having the execute bits stripped from lpsetup/bin/launchpad-database-setup.sh requires us to specify the interpreter manually. In order to be safe, we check to ensure it is what we expect.

To post a comment you must log in.
Revision history for this message
Brad Crittenden (bac) wrote :

Self-reviewing as this was the approach suggested in an earlier review.

review: Approve (code)
Revision history for this message
Launchpad QA Bot (lpqabot) wrote :
Download full text (8.2 KiB)

The attempt to merge lp:~bac/lpsetup/setup_x into lp:lpsetup failed. Below is the output from the failed tests.

lxc.aa_profile = lxc-container-with-nesting
WARNING: this command will destroy the 'lpsetup-testing-lxc' environment (type: local).
This includes all machines, services, data, and other resources. Continue [y/N]**********************************************************************
* Checking test environment. *
**********************************************************************
**********************************************************************
* Setting up the test environment for LXC container. *
**********************************************************************
----------------------------------------------------------------------
check_call:
juju bootstrap -e lpsetup-testing-lxc
----------------------------------------------------------------------
**********************************************************************
None
**********************************************************************
**********************************************************************
* Cleaning up. *
**********************************************************************

**********************************************************************
* Run time: 0:02:26.380304 *
**********************************************************************

+ set -o errexit
++ grep -v distribute_setup.py
++ find . -name build -prune -o -name '*.py'
+ pyfiles='./setup.py
./lplxcip/tests/utils.py
./lplxcip/tests/__init__.py
./lplxcip/tests/test_lxcip.py
./lplxcip/tests/test_helpers.py
./lplxcip/tests/test_utils.py
./lplxcip/lxcip.py
./lpsetup/utils.py
./lpsetup/__init__.py
./lpsetup/handlers.py
./lpsetup/tests/utils.py
./lpsetup/tests/__init__.py
./lpsetup/tests/test_argparser.py
./lpsetup/tests/test_cli.py
./lpsetup/tests/test_handlers.py
./lpsetup/tests/subcommands/__init__.py
./lpsetup/tests/subcommands/test_version.py
./lpsetup/tests/subcommands/test_initrepo.py
./lpsetup/tests/subcommands/test_init_target.py
./lpsetup/tests/subcommands/test_smoke.py
./lpsetup/tests/integration/common.py
./lpsetup/tests/integration/test_install_lxc.py
./lpsetup/tests/integration/test_init_target.py
./lpsetup/tests/test_utils.py
./lpsetup/subcommands/__init__.py
./lpsetup/subcommands/install_lxc.py
./lpsetup/subcommands/initlxc.py
./lpsetup/subcommands/init_target.py
./lpsetup/subcommands/update.py
./lpsetup/subcommands/initrepo.py
./lpsetup/subcommands/version.py
./lpsetup/exceptions.py
./lpsetup/argparser.py
./lpsetup/settings.py
./lpsetup/cli.py'
+ pocketlint ./setup.py ./lplxcip/tests/utils.py ./lplxcip/tests/__init__.py ./lplxcip/tests/test_lxcip.py ./lplxcip/tests/test_helpers.py ./lplxcip/tests/test_utils.py ./lplxcip/lxcip.py ./lpsetup/utils.py ./lpsetup/__init__.py ./lpsetup/handlers.py ./lpsetup/tests/utils.py ./lpsetup/tests/__init__.py ./lpsetup/tests/test_argparser.py ./lpsetup/tests/test_cli.py ./lpsetup/tests/test_handlers.py ./lpsetup/tests/subcommands/__init__.py ./lpsetup/tests/subcommands/test_version.py ...

Read more...

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== renamed file 'lpsetup/bin/launchpad-database-setup' => 'lpsetup/bin/launchpad-database-setup.sh' (properties changed: +x to -x)
2=== modified file 'lpsetup/subcommands/init_target.py'
3--- lpsetup/subcommands/init_target.py 2012-08-24 18:49:30 +0000
4+++ lpsetup/subcommands/init_target.py 2012-08-27 14:30:29 +0000
5@@ -266,10 +266,16 @@
6 def setup_database(user):
7 """Setup Launchpad database."""
8 with su(user):
9- script_name = 'launchpad-database-setup'
10+ script_name = 'launchpad-database-setup.sh'
11 here = os.path.dirname(__file__)
12 script_path = os.path.join(here, '..', 'bin', script_name)
13- call('/bin/sh', script_path, user)
14+ with open(script_path, 'r') as f:
15+ line = f.readline()
16+ interpreter = '/bin/sh'
17+ assert line.startswith('#!' + interpreter), (
18+ 'Interpreter for {0} is not {1}.'.format(
19+ script_path, interpreter))
20+ call(interpreter, script_path, user)
21
22 setup_database.description = """Setup database for Launchpad use."""
23

Subscribers

People subscribed via source and target branches