system-config/playbooks/roles/vos-release/files/vos_release.sh
Ian Wienand a6a4e5dfe5 vos-release: fix sudo
If you read the man page

 # This will cause sudo to read and parse any files in the /etc/sudoers.d
 # directory that do not end in '~' or contain a '.' character.

I don't know why sudo doesn't like files with a ".", but remove it

Fix the syntax in this file which has too many spaces

The theory that specifying a command means you can have nologin as
shell is debunked; change the shell to /bin/bash

 root@mirror-update01:~# ssh -i ~/.ssh/id_vos_release vos_release@afs01.dfw.openstack.org vos
 This account is currently not available.

Don't use shortcuts for positional parameters, suggested by jaltmann
in If70b27cb974eb8c1bafec2b7ef86d4f5cba3c4c5.

After hand applying these fixes, I can log in and run the script as
expected.

Change-Id: I058aadaa5ca5c7b8e94b275c4b8d26e1e0688ce8
2019-11-21 17:51:18 +11:00

18 lines
298 B
Bash
Executable File

#!/bin/bash
if [[ -z "${SSH_ORIGINAL_COMMAND}" ]]; then
echo "usage: vos release <volume>"
exit 1
fi
set -- $SSH_ORIGINAL_COMMAND
if [[ $# != 3 || $1 != "vos" || $2 != "release" ]]; then
echo "usage: vos release <volume>"
exit 1
fi
sudo vos release -id $3 -verbose -localauth