From d06057ef6bfe31eb63c90eef5705390b5a77bdfb Mon Sep 17 00:00:00 2001 From: Igor Malinovskiy Date: Wed, 3 Jun 2015 16:31:19 +0300 Subject: [PATCH] Fix bashate issues --- elements/manila-cifs/install.d/50-manila-cifs | 2 +- .../50-manila-samba-patch-config | 2 +- elements/manila-nfs/install.d/50-manila-nfs | 2 +- .../post-install.d/50-manila-nfs-patch-config | 2 +- .../manila-ssh/environment.d/50-manila-user | 2 +- .../manila-ssh/extra-data.d/50-manila-user | 2 +- elements/manila-ssh/install.d/50-manila-user | 2 +- .../install.d/60-fetch-public-ssh-keys | 2 +- .../install.d/fetch-public-ssh-keys.conf | 2 +- .../install.d/fetch-public-ssh-keys.sh | 48 +++++++++---------- .../00-install-required-packages | 2 +- .../root.d/10-cache-ubuntu-tarball | 2 +- 12 files changed, 35 insertions(+), 35 deletions(-) diff --git a/elements/manila-cifs/install.d/50-manila-cifs b/elements/manila-cifs/install.d/50-manila-cifs index 7e3b2b4..507b63c 100755 --- a/elements/manila-cifs/install.d/50-manila-cifs +++ b/elements/manila-cifs/install.d/50-manila-cifs @@ -2,4 +2,4 @@ set -eu -install-packages samba samba-common samba-common-bin \ No newline at end of file +install-packages samba samba-common samba-common-bin diff --git a/elements/manila-cifs/post-install.d/50-manila-samba-patch-config b/elements/manila-cifs/post-install.d/50-manila-samba-patch-config index fcadd90..0b5c55a 100755 --- a/elements/manila-cifs/post-install.d/50-manila-samba-patch-config +++ b/elements/manila-cifs/post-install.d/50-manila-samba-patch-config @@ -7,4 +7,4 @@ set -eu set -o pipefail # Enable registry in samba config -sed -i "s/\[global\]/\[global\]\\n\\n include = registry\\n/g" /etc/samba/smb.conf \ No newline at end of file +sed -i "s/\[global\]/\[global\]\\n\\n include = registry\\n/g" /etc/samba/smb.conf diff --git a/elements/manila-nfs/install.d/50-manila-nfs b/elements/manila-nfs/install.d/50-manila-nfs index bb404c8..b33842b 100755 --- a/elements/manila-nfs/install.d/50-manila-nfs +++ b/elements/manila-nfs/install.d/50-manila-nfs @@ -7,4 +7,4 @@ set -eu set -o pipefail # Install required packages -install-packages nfs-common nfs-kernel-server portmap \ No newline at end of file +install-packages nfs-common nfs-kernel-server portmap diff --git a/elements/manila-nfs/post-install.d/50-manila-nfs-patch-config b/elements/manila-nfs/post-install.d/50-manila-nfs-patch-config index 32d3869..c0f45e4 100755 --- a/elements/manila-nfs/post-install.d/50-manila-nfs-patch-config +++ b/elements/manila-nfs/post-install.d/50-manila-nfs-patch-config @@ -7,4 +7,4 @@ set -eu set -o pipefail # Patch NFS init script to allow running nfs-kernel-server without exports: -sed -i 's/\s&&\sgrep\s-q\s.*\s\$export_files$//g' /etc/init.d/nfs-kernel-server \ No newline at end of file +sed -i 's/\s&&\sgrep\s-q\s.*\s\$export_files$//g' /etc/init.d/nfs-kernel-server diff --git a/elements/manila-ssh/environment.d/50-manila-user b/elements/manila-ssh/environment.d/50-manila-user index 52ac622..3c5813f 100755 --- a/elements/manila-ssh/environment.d/50-manila-user +++ b/elements/manila-ssh/environment.d/50-manila-user @@ -1,3 +1,3 @@ export DIB_MANILA_USER_USERNAME=${DIB_MANILA_USER_USERNAME:-manila} export DIB_MANILA_USER_AUTHORIZED_KEYS=${DIB_MANILA_USER_AUTHORIZED_KEYS:-} -export DIB_MANILA_USER_PASSWORD=${DIB_MANILA_USER_PASSWORD:-} \ No newline at end of file +export DIB_MANILA_USER_PASSWORD=${DIB_MANILA_USER_PASSWORD:-} diff --git a/elements/manila-ssh/extra-data.d/50-manila-user b/elements/manila-ssh/extra-data.d/50-manila-user index e1e5fcf..bde69d8 100755 --- a/elements/manila-ssh/extra-data.d/50-manila-user +++ b/elements/manila-ssh/extra-data.d/50-manila-user @@ -10,4 +10,4 @@ if [ -n "$DIB_MANILA_USER_AUTHORIZED_KEYS" ]; then if [ -f "$DIB_MANILA_USER_AUTHORIZED_KEYS" ]; then cat $DIB_MANILA_USER_AUTHORIZED_KEYS >> $TMP_HOOKS_PATH/manilauser-ssh-authorized-keys fi -fi \ No newline at end of file +fi diff --git a/elements/manila-ssh/install.d/50-manila-user b/elements/manila-ssh/install.d/50-manila-user index fc1ded6..f7cfbba 100755 --- a/elements/manila-ssh/install.d/50-manila-user +++ b/elements/manila-ssh/install.d/50-manila-user @@ -26,4 +26,4 @@ if [ -f /tmp/in_target.d/devuser-ssh-authorized-keys ]; then cp /tmp/in_target.d/manilauser-ssh-authorized-keys /home/${DIB_MANILA_USER_USERNAME}/.ssh/authorized_keys fi -chown -R ${DIB_MANILA_USER_USERNAME}:${DIB_MANILA_USER_USERNAME} /home/${DIB_MANILA_USER_USERNAME} \ No newline at end of file +chown -R ${DIB_MANILA_USER_USERNAME}:${DIB_MANILA_USER_USERNAME} /home/${DIB_MANILA_USER_USERNAME} diff --git a/elements/manila-ssh/install.d/60-fetch-public-ssh-keys b/elements/manila-ssh/install.d/60-fetch-public-ssh-keys index 5d27a33..0665990 100755 --- a/elements/manila-ssh/install.d/60-fetch-public-ssh-keys +++ b/elements/manila-ssh/install.d/60-fetch-public-ssh-keys @@ -15,4 +15,4 @@ if [ "$DIB_INIT_SYSTEM" == "upstart" ]; then install -D -g root -o root -m 0755 ${SCRIPTDIR}/fetch-public-ssh-keys.conf /etc/init/fetch-public-ssh-keys.conf else echo "Not supported" -fi \ No newline at end of file +fi diff --git a/elements/manila-ssh/install.d/fetch-public-ssh-keys.conf b/elements/manila-ssh/install.d/fetch-public-ssh-keys.conf index b373d3d..b00ea23 100755 --- a/elements/manila-ssh/install.d/fetch-public-ssh-keys.conf +++ b/elements/manila-ssh/install.d/fetch-public-ssh-keys.conf @@ -4,4 +4,4 @@ start on (started networking) task -exec /usr/local/sbin/fetch-public-ssh-keys.sh \ No newline at end of file +exec /usr/local/sbin/fetch-public-ssh-keys.sh diff --git a/elements/manila-ssh/install.d/fetch-public-ssh-keys.sh b/elements/manila-ssh/install.d/fetch-public-ssh-keys.sh index 88bd3e9..52fb4a8 100755 --- a/elements/manila-ssh/install.d/fetch-public-ssh-keys.sh +++ b/elements/manila-ssh/install.d/fetch-public-ssh-keys.sh @@ -7,34 +7,34 @@ MANILA_USER_HOME="/home/$MANILA_USER" MANILA_USER_SSH_DIR="$MANILA_USER_HOME/.ssh" if [ ! -d $MANILA_USER_SSH_DIR ]; then - mkdir -p $MANILA_USER_SSH_DIR - chmod 700 $MANILA_USER_SSH_DIR - chown -R $MANILA_USER $MANILA_USER_SSH_DIR + mkdir -p $MANILA_USER_SSH_DIR + chmod 700 $MANILA_USER_SSH_DIR + chown -R $MANILA_USER $MANILA_USER_SSH_DIR fi # Fetch public key using HTTP ATTEMPTS=10 FAILED=0 while [ ! -f $MANILA_USER_SSH_DIR/authorized_keys ]; do - curl -f http://169.254.169.254/latest/meta-data/public-keys/0/openssh-key > /tmp/metadata-key 2>/dev/null - if [ $? -eq 0 ]; then - cat /tmp/metadata-key >> $MANILA_USER_SSH_DIR/authorized_keys - chmod 0600 $MANILA_USER_SSH_DIR/authorized_keys - chown $MANILA_USER $MANILA_USER_SSH_DIR/authorized_keys - rm -f /tmp/metadata-key - echo "Successfully retrieved public key from instance metadata" - echo "*****************" - echo "AUTHORIZED KEYS" - echo "*****************" - cat $MANILA_USER_SSH_DIR/authorized_keys - echo "*****************" - else - FAILED=`expr $FAILED + 1` - if [ $FAILED -ge $ATTEMPTS ]; then - echo "Failed to retrieve public key from instance metadata after $FAILED attempts, quitting" - break + curl -f http://169.254.169.254/latest/meta-data/public-keys/0/openssh-key > /tmp/metadata-key 2>/dev/null + if [ $? -eq 0 ]; then + cat /tmp/metadata-key >> $MANILA_USER_SSH_DIR/authorized_keys + chmod 0600 $MANILA_USER_SSH_DIR/authorized_keys + chown $MANILA_USER $MANILA_USER_SSH_DIR/authorized_keys + rm -f /tmp/metadata-key + echo "Successfully retrieved public key from instance metadata" + echo "*****************" + echo "AUTHORIZED KEYS" + echo "*****************" + cat $MANILA_USER_SSH_DIR/authorized_keys + echo "*****************" + else + FAILED=`expr $FAILED + 1` + if [ $FAILED -ge $ATTEMPTS ]; then + echo "Failed to retrieve public key from instance metadata after $FAILED attempts, quitting" + break + fi + echo "Could not retrieve public key from instance metadata (attempt #$FAILED/$ATTEMPTS), retrying in 5 seconds..." + sleep 5 fi - echo "Could not retrieve public key from instance metadata (attempt #$FAILED/$ATTEMPTS), retrying in 5 seconds..." - sleep 5 - fi -done \ No newline at end of file +done diff --git a/elements/manila-ubuntu-core/pre-install.d/00-install-required-packages b/elements/manila-ubuntu-core/pre-install.d/00-install-required-packages index b5c2735..4958ee1 100755 --- a/elements/manila-ubuntu-core/pre-install.d/00-install-required-packages +++ b/elements/manila-ubuntu-core/pre-install.d/00-install-required-packages @@ -10,4 +10,4 @@ sudo sed -i -E "s/#\s(deb.+universe)$/\1/g" /etc/apt/sources.list apt-get update apt-get upgrade -y -apt-get install python sudo openssh-server rpcbind -y \ No newline at end of file +apt-get install python sudo openssh-server rpcbind -y diff --git a/elements/manila-ubuntu-core/root.d/10-cache-ubuntu-tarball b/elements/manila-ubuntu-core/root.d/10-cache-ubuntu-tarball index c438eb6..177c252 100755 --- a/elements/manila-ubuntu-core/root.d/10-cache-ubuntu-tarball +++ b/elements/manila-ubuntu-core/root.d/10-cache-ubuntu-tarball @@ -21,7 +21,7 @@ CACHED_FILE=$DIB_IMAGE_CACHE/$BASE_IMAGE_FILE CACHED_FILE_LOCK=$DIB_IMAGE_CACHE/$BASE_IMAGE_FILE.lock CACHED_SUMS=$DIB_IMAGE_CACHE/SHA256SUMS.ubuntu.$DIB_RELEASE.$ARCH -function get_ubuntu_tarball() { +function get_ubuntu_tarball { if [ -n "$DIB_OFFLINE" -a -f "$CACHED_FILE" ] ; then echo "Not checking freshness of cached $CACHED_FILE." else