$CWD is used in the lookup of files during mojo run

Bug #1453197 reported by Guillermo Gonzalez
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Mojo: Continuous Delivery for Juju
Confirmed
Medium
Unassigned

Bug Description

During a mojo if a file is referenced with a relative path in a script the lookup is also done in the current working directoy.

I think it should fail if the relative path is wrong, instead of using the CWD

Steps to reproduce:

1) setup the env
bzr branch lp:~verterok/+junk/test-spec
cd test-spec
# bootstrap a juju env

# create the project
sudo mojo project-new mojo-test-spec -s trusty

# fix perms of lxc
sudo chmod 750 /var/lib/lxc/mojo-test-spec.trusty
sudo chgrp $USER /var/lib/lxc/mojo-test-spec.trusty/
sudo chgrp $USER /var/lib/lxc/mojo-test-spec.trusty

# create the workspace
mojo workspace-new --project mojo-test-spec -s trusty --stage "foo/bar/devel" `bzr root` bug-relative-path

2) error case:
mojo run --project mojo-test-spec --series trusty --stage foo/bar/devel `bzr root` bugs-relative-path

output:

2015-05-08 13:04:19 [INFO] Retrieve the spec's manifest
2015-05-08 13:04:19 [INFO] Building resource tree
2015-05-08 13:04:20 [INFO] Build a charm repository
2015-05-08 13:04:20 [INFO] Creating charm repo automatically from all charms in the build directory.
2015-05-08 13:04:20 [INFO] Pulling secrets from /srv/mojo/LOCAL/mojo-bugs/foo/bar/devel to /srv/mojo/mojo-test-spec/trusty/bugs-relative-path/local
2015-05-08 13:04:20 [WARNING] Automatic secrets phase ran but secrets directory /srv/mojo/LOCAL/mojo-test-spec/foo/bar/devel does not exist!
2015-05-08 13:04:20 [INFO] Running juju-deployer
Running: python /usr/bin/juju-deployer -c /srv/mojo/mojo-test-spec/trusty/bugs-relative-path/charms/foo/bar/devel/services -s 60 -d test-services -W -u
2015-05-08 13:04:20 [DEBUG] deployer.cli: Using runtime GoEnvironment on local
2015-05-08 13:04:20 [INFO] deployer.cli: Starting deployment of test-services
2015-05-08 13:04:20 [DEBUG] deployer.import: Getting charms...
2015-05-08 13:04:20 [DEBUG] deployer.deploy: Resolving configuration
2015-05-08 13:04:20 [DEBUG] deployer.env: Connecting to environment...
2015-05-08 13:04:21 [DEBUG] deployer.env: Connected to environment
2015-05-08 13:04:21 [INFO] deployer.import: Deploying services...
2015-05-08 13:04:21 [DEBUG] deployer.import: <deployer.env.go.GoEnvironment object at 0x7fd646c8eb10>
2015-05-08 13:04:27 [DEBUG] deployer.import: Adding units...
2015-05-08 13:04:27 [DEBUG] deployer.import: Waiting for units before adding relations
2015-05-08 13:04:28 [DEBUG] deployer.env: Connecting to environment...
2015-05-08 13:04:29 [DEBUG] deployer.env: Connected to environment
2015-05-08 13:04:29 [INFO] deployer.import: Adding relations...
2015-05-08 13:04:29 [INFO] deployer.cli: Deployment complete in 8.98 seconds
2015-05-08 13:04:29 [INFO] Pulling secrets from /srv/mojo/LOCAL/mojo-test-spec/foo/bar/devel to /srv/mojo/mojo-test-spec/trusty/bugs-relative-path/local
2015-05-08 13:04:29 [WARNING] Automatic secrets phase ran but secrets directory /srv/mojo/LOCAL/mojo-test-spec/foo/bar/devel does not exist!
2015-05-08 13:04:29 [INFO] Running script test-script
/srv/mojo/mojo-test-spec/trusty/bugs-relative-path/spec/foo/bar/test-script: line 4: ../../scripts/findme.sh: No such file or directory

3) happy path, change CWD to the spec root: foo/bar
cd foo/bar
mojo run --project mojo-test-spec --series trusty --stage foo/bar/devel `bzr root` bugs-relative-path

output:
2015-05-08 13:04:37 [INFO] Retrieve the spec's manifest
2015-05-08 13:04:37 [INFO] Building resource tree
2015-05-08 13:04:37 [INFO] Build a charm repository
2015-05-08 13:04:37 [INFO] Creating charm repo automatically from all charms in the build directory.
2015-05-08 13:04:37 [INFO] Pulling secrets from /srv/mojo/LOCAL/mojo-bugs/foo/bar/devel to /srv/mojo/mojo-test-spec/trusty/bugs-relative-path/local
2015-05-08 13:04:37 [WARNING] Automatic secrets phase ran but secrets directory /srv/mojo/LOCAL/mojo-test-spec/foo/bar/devel does not exist!
2015-05-08 13:04:37 [INFO] Running juju-deployer
Running: python /usr/bin/juju-deployer -c /srv/mojo/mojo-test-spec/trusty/bugs-relative-path/charms/foo/bar/devel/services -s 60 -d test-services -W -u
2015-05-08 13:04:37 [DEBUG] deployer.cli: Using runtime GoEnvironment on local
2015-05-08 13:04:37 [INFO] deployer.cli: Starting deployment of test-services
2015-05-08 13:04:37 [DEBUG] deployer.import: Getting charms...
2015-05-08 13:04:37 [DEBUG] deployer.deploy: Resolving configuration
2015-05-08 13:04:37 [DEBUG] deployer.env: Connecting to environment...
2015-05-08 13:04:38 [DEBUG] deployer.env: Connected to environment
2015-05-08 13:04:38 [INFO] deployer.import: Deploying services...
2015-05-08 13:04:38 [DEBUG] deployer.import: <deployer.env.go.GoEnvironment object at 0x7f15ebf9cb10>
2015-05-08 13:04:44 [DEBUG] deployer.import: Adding units...
2015-05-08 13:04:44 [DEBUG] deployer.import: Waiting for units before adding relations
2015-05-08 13:04:45 [DEBUG] deployer.env: Connecting to environment...
2015-05-08 13:04:46 [DEBUG] deployer.env: Connected to environment
2015-05-08 13:04:46 [INFO] deployer.import: Adding relations...
2015-05-08 13:04:46 [INFO] deployer.cli: Deployment complete in 8.86 seconds
2015-05-08 13:04:46 [INFO] Pulling secrets from /srv/mojo/LOCAL/mojo-bugs/foo/bar/devel to /srv/mojo/mojo-test-spec/trusty/bugs-relative-path/local
2015-05-08 13:04:46 [WARNING] Automatic secrets phase ran but secrets directory /srv/mojo/LOCAL/mojo-bugs/foo/bar/devel does not exist!
2015-05-08 13:04:46 [INFO] Running script test-script
ÄLL GOOD

Tags: papercut
description: updated
Tom Haddon (mthaddon)
tags: added: papercut
Tom Haddon (mthaddon)
Changed in mojo:
status: New → Confirmed
importance: Undecided → Medium
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.