Switch to using $() for subshells, part 1
Cleanup every use of `` for subshells in the nodepool and tools directory , replacing them with $(), and finally making the scripts consistent. Change-Id: I2b05cd20f9c9a30ab88f8db235aa81da93b1fad3
This commit is contained in:
parent
5650cc4e36
commit
85a0f4f44f
@ -23,11 +23,11 @@
|
|||||||
set -e
|
set -e
|
||||||
|
|
||||||
# If lsb_release is missing, just do nothing.
|
# If lsb_release is missing, just do nothing.
|
||||||
DISTRO=`lsb_release -si` || true
|
DISTRO=$(lsb_release -si) || true
|
||||||
|
|
||||||
case $DISTRO in
|
case $DISTRO in
|
||||||
'Ubuntu'|'Debian')
|
'Ubuntu'|'Debian')
|
||||||
PRESEED=`mktemp`
|
PRESEED=$(mktemp)
|
||||||
cat > $PRESEED <<EOF
|
cat > $PRESEED <<EOF
|
||||||
d-i iptables-persistent/autosave_done boolean true
|
d-i iptables-persistent/autosave_done boolean true
|
||||||
d-i iptables-persistent/autosave_v4 boolean false
|
d-i iptables-persistent/autosave_v4 boolean false
|
||||||
|
@ -43,7 +43,7 @@ elif [ -f /usr/bin/apt-get ]; then
|
|||||||
sudo DEBIAN_FRONTEND=noninteractive apt-get \
|
sudo DEBIAN_FRONTEND=noninteractive apt-get \
|
||||||
--option "Dpkg::Options::=--force-confold" \
|
--option "Dpkg::Options::=--force-confold" \
|
||||||
--assume-yes install build-essential python-dev \
|
--assume-yes install build-essential python-dev \
|
||||||
python-software-properties linux-headers-virtual linux-headers-`uname -r`
|
python-software-properties linux-headers-virtual linux-headers-$(uname -r)
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
echo "Unsupported distro."
|
echo "Unsupported distro."
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
|
|
||||||
export PATH=$PATH:/usr/local/sbin:/usr/sbin
|
export PATH=$PATH:/usr/local/sbin:/usr/sbin
|
||||||
|
|
||||||
for ip in `cat /etc/nodepool/primary_node /etc/nodepool/sub_nodes /etc/nodepool/primary_node_private /etc/nodepool/sub_nodes_private | sort -u`; do
|
for ip in $(cat /etc/nodepool/primary_node /etc/nodepool/sub_nodes /etc/nodepool/primary_node_private /etc/nodepool/sub_nodes_private | sort -u); do
|
||||||
sudo iptables -I openstack-INPUT 1 -s $ip -j ACCEPT
|
sudo iptables -I openstack-INPUT 1 -s $ip -j ACCEPT
|
||||||
done
|
done
|
||||||
|
|
||||||
@ -26,7 +26,7 @@ echo "" >> /home/jenkins/.ssh/authorized_keys
|
|||||||
cat /etc/nodepool/id_rsa.pub >> /home/jenkins/.ssh/authorized_keys
|
cat /etc/nodepool/id_rsa.pub >> /home/jenkins/.ssh/authorized_keys
|
||||||
echo "" >> /home/jenkins/.ssh/authorized_keys
|
echo "" >> /home/jenkins/.ssh/authorized_keys
|
||||||
|
|
||||||
ROLE=`cat /etc/nodepool/role`
|
ROLE=$(cat /etc/nodepool/role)
|
||||||
if [ $ROLE == "primary" ]; then
|
if [ $ROLE == "primary" ]; then
|
||||||
cp /etc/nodepool/id_rsa /home/jenkins/.ssh/id_rsa
|
cp /etc/nodepool/id_rsa /home/jenkins/.ssh/id_rsa
|
||||||
chmod 0600 /home/jenkins/.ssh/id_rsa
|
chmod 0600 /home/jenkins/.ssh/id_rsa
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
|
|
||||||
cd /opt/nodepool-scripts/
|
cd /opt/nodepool-scripts/
|
||||||
./install_devstack_dependencies.sh
|
./install_devstack_dependencies.sh
|
||||||
DISTRIB_CODENAME=`lsb_release -sc`
|
DISTRIB_CODENAME=$(lsb_release -sc)
|
||||||
python ./cache_devstack.py $DISTRIB_CODENAME
|
python ./cache_devstack.py $DISTRIB_CODENAME
|
||||||
|
|
||||||
sync
|
sync
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
# It checks that *.config files respect certain gerrit ACL rules
|
# It checks that *.config files respect certain gerrit ACL rules
|
||||||
|
|
||||||
export TMPDIR=`/bin/mktemp -d`
|
export TMPDIR=$(/bin/mktemp -d)
|
||||||
trap "rm -rf $TMPDIR" EXIT
|
trap "rm -rf $TMPDIR" EXIT
|
||||||
|
|
||||||
pushd $TMPDIR
|
pushd $TMPDIR
|
||||||
|
@ -22,7 +22,7 @@ rm -rf /tmp/newimage
|
|||||||
mkdir -p /tmp/newimage
|
mkdir -p /tmp/newimage
|
||||||
|
|
||||||
#qemu-nbd needs the absolute path of the image
|
#qemu-nbd needs the absolute path of the image
|
||||||
qemu-nbd -c /dev/nbd1 `readlink -e $IMAGE`
|
qemu-nbd -c /dev/nbd1 $(readlink -e $IMAGE)
|
||||||
|
|
||||||
#mount the first partition
|
#mount the first partition
|
||||||
mount /dev/nbd1p1 /tmp/newimage
|
mount /dev/nbd1p1 /tmp/newimage
|
||||||
|
@ -28,7 +28,7 @@ mkdir -p .test/new/config
|
|||||||
mkdir -p .test/new/out
|
mkdir -p .test/new/out
|
||||||
cd ../..
|
cd ../..
|
||||||
|
|
||||||
GITHEAD=`git rev-parse HEAD`
|
GITHEAD=$(git rev-parse HEAD)
|
||||||
|
|
||||||
# First generate output from HEAD~1
|
# First generate output from HEAD~1
|
||||||
git checkout HEAD~1
|
git checkout HEAD~1
|
||||||
|
Loading…
x
Reference in New Issue
Block a user