vagrant-spk icon indicating copy to clipboard operation
vagrant-spk copied to clipboard

vagrant-spk should not fail if the user-provided bash scripts are not executable

Open paulproteus opened this issue 10 years ago • 4 comments

Steps to reproduce:

git clone https://github.com/paulproteus/php-app-to-package-for-sandstorm.git
cd php-app-to-package-for-sandstorm
vagrant-spk setupvm lemp
chmod 644 .sandstorm/*
vagrant-spk up  # works fine
vagrant-spk  # fails, see below

(note: I'm doing the chmod as part of the steps to reproduce not because anyone would actually do that chmod, but instead for the reason that on Windows, users are likely to fail to commit the +x bit as part of the git repo, result in packages that fail to build)

Expected behavior:

Grain starts.

Actual behavior:

➜  php-app-to-package-for-sandstorm git:(master) ✗ vagrant-spk dev
Calling 'vagrant' 'ssh' '-c' '/opt/app/.sandstorm/build.sh && cd /opt/app/.sandstorm && spk dev --pkg-def=/opt/app/.sandstorm/sandstorm-pkgdef.capnp:pkgdef' in /tmp/php-app-to-package-for-sandstorm/.sandstorm
spk dev: --pkg-def=/opt/app/.sandstorm/sandstorm-pkgdef.capnp:pkgdef: not found
Try 'spk dev --help' for more information.
Connection to 127.0.0.1 closed.
Traceback (most recent call last):
  File "/usr/local/bin/vagrant-spk", line 367, in <module>
    main()
  File "/usr/local/bin/vagrant-spk", line 364, in main
    operation(args)
  File "/usr/local/bin/vagrant-spk", line 298, in dev
    "spk dev --pkg-def=/opt/app/.sandstorm/sandstorm-pkgdef.capnp:pkgdef"
  File "/usr/local/bin/vagrant-spk", line 177, in call_vagrant_command
    return subprocess.check_call(command, cwd=sandstorm_dir)
  File "/usr/lib/python2.7/subprocess.py", line 540, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['vagrant', 'ssh', '-c', '/opt/app/.sandstorm/build.sh && cd /opt/app/.sandstorm && spk dev --pkg-def=/opt/app/.sandstorm/sandstorm-pkgdef.capnp:pkgdef']' returned non-zero exit status 1

paulproteus avatar Aug 31 '15 22:08 paulproteus

I can fix this in the fullness of time, but wanted to record this issue so I don't forget it.

paulproteus avatar Aug 31 '15 22:08 paulproteus

Yeah, good idea! Reasonable options include explicitly chmod'ing the scripts before executing them, or explicitly bash-ing them.

zarvox avatar Aug 31 '15 22:08 zarvox

I've created this branch:

https://github.com/sandstorm-io/vagrant-spk/tree/wip-stop-relying-on-executable-mode

with a number of untested changes that should achieve this. The main task remaining is to test that branch.

paulproteus avatar Feb 22 '16 00:02 paulproteus

@zarvox - along those lines - given that in that branch, we no longer rely on the files being executable, I'm going to stop creating them with mode 755, so that we can be sure we don't rely on them being executable. Curious for your +1 -1 on that.

paulproteus avatar Feb 22 '16 00:02 paulproteus