[FULLCI] Enabled set -s on deployment shell scripts

This commit is contained in:
Hosung Song 2018-07-19 09:23:54 -07:00
Родитель f31c421a53
Коммит 3e9441db69
5 изменённых файлов: 32 добавлений и 33 удалений

Просмотреть файл

@ -3,7 +3,6 @@
"contentVersion": "1.0.0.0",
"parameters": {
"sshPublicKey": { "value": "GEN-SSH-PUB-KEY" },
"dbServerType": { "value": "mssql" },
"fileServerDiskCount": { "value": 2 },
"fileServerDiskSize": { "value": 32 }
}

Просмотреть файл

@ -136,8 +136,8 @@ password=$storageAccountKey
EOF
chmod 600 /etc/moodle_azure_files.credential
grep "^//$storageAccountName.file.core.windows.net/moodle\s\s*/moodle\s\s*cifs" /etc/fstab
if [ $? != "0" ]; then
grep -q -s "^//$storageAccountName.file.core.windows.net/moodle\s\s*/moodle\s\s*cifs" /etc/fstab && _RET=$? || _RET=$?
if [ $_RET != "0" ]; then
echo -e "\n//$storageAccountName.file.core.windows.net/moodle /moodle cifs credentials=/etc/moodle_azure_files.credential,uid=www-data,gid=www-data,nofail,vers=3.0,dir_mode=0770,file_mode=0660,serverino,mfsymlinks" >> /etc/fstab
fi
mkdir -p /moodle
@ -154,8 +154,8 @@ function setup_moodle_mount_dependency_for_systemd_service
local systemdSvcOverrideFileDir="/etc/systemd/system/${serviceName}.service.d"
local systemdSvcOverrideFilePath="${systemdSvcOverrideFileDir}/moodle_on_azure_override.conf"
grep -q "After=moodle.mount" $systemdSvcOverrideFilePath &> /dev/null
if [ $? != "0" ]; then
grep -q -s "After=moodle.mount" $systemdSvcOverrideFilePath && _RET=$? || _RET=$?
if [ $_RET != "0" ]; then
mkdir -p $systemdSvcOverrideFileDir
cat <<EOF > $systemdSvcOverrideFilePath
[Unit]
@ -193,8 +193,8 @@ function create_raid0_ubuntu {
shift
local DISKS="$@"
dpkg -s mdadm
if [ ${?} -eq 1 ];
dpkg -s mdadm && _RET=$? || _RET=$?
if [ $_RET -eq 1 ];
then
echo "installing mdadm"
sudo apt-get -y -q install mdadm
@ -230,8 +230,8 @@ function add_local_filesystem_to_fstab {
local UUID=${1}
local MOUNTPOINT=${2} # E.g., /moodle
grep "${UUID}" /etc/fstab >/dev/null 2>&1
if [ ${?} -eq 0 ];
grep -q -s "${UUID}" /etc/fstab && _RET=$? || _RET=$?
if [ $_RET -eq 0 ];
then
echo "Not adding ${UUID} to fstab again (it's already there!)"
else
@ -291,8 +291,8 @@ function configure_nfs_server_and_export {
apt install -y nfs-kernel-server
echo "Exporting ${MOUNTPOINT}..."
grep "^${MOUNTPOINT}" /etc/exports > /dev/null 2>&1
if [ $? = "0" ]; then
grep -q -s "^${MOUNTPOINT}" /etc/exports && _RET=$? || _RET=$?
if [ $_RET = "0" ]; then
echo "${MOUNTPOINT} is already exported. Returning..."
else
echo -e "\n${MOUNTPOINT} *(rw,sync,no_root_squash)" >> /etc/exports
@ -307,8 +307,8 @@ function configure_nfs_client_and_mount0 {
apt install -y nfs-common
mkdir -p ${MOUNTPOINT}
grep "^${NFS_HOST_EXPORT_PATH}" /etc/fstab > /dev/null 2>&1
if [ $? = "0" ]; then
grep -q -s "^${NFS_HOST_EXPORT_PATH}" /etc/fstab && _RET=$? || _RET=$?
if [ $_RET = "0" ]; then
echo "${NFS_HOST_EXPORT_PATH} already in /etc/fstab... skipping to add"
else
echo -e "\n${NFS_HOST_EXPORT_PATH} ${MOUNTPOINT} nfs auto 0 0" >> /etc/fstab

Просмотреть файл

@ -40,8 +40,8 @@ sudo apt-get -y install unattended-upgrades
{
check_os() {
grep ubuntu /proc/version > /dev/null 2>&1
isubuntu=${?}
grep -q -s ubuntu /proc/version && _RET=$? || _RET=$?
isubuntu=$_RET
}
scan_for_new_disks() {
@ -70,8 +70,8 @@ sudo apt-get -y install unattended-upgrades
}
create_raid0_ubuntu() {
dpkg -s mdadm
if [ ${?} -eq 1 ];
dpkg -s mdadm && _RET=$? || _RET=$?
if [ $_RET -eq 1 ];
then
echo "installing mdadm"
sudo apt-get -y -q install mdadm
@ -106,8 +106,8 @@ sudo apt-get -y install unattended-upgrades
add_to_fstab() {
UUID=${1}
MOUNTPOINT=${2}
grep "${UUID}" /etc/fstab >/dev/null 2>&1
if [ ${?} -eq 0 ];
grep -q -s "${UUID}" /etc/fstab && _RET=$? || _RET=$?
if [ $_RET -eq 0 ];
then
echo "Not adding ${UUID} to fstab again (it's already there!)"
else
@ -117,8 +117,8 @@ sudo apt-get -y install unattended-upgrades
}
configure_disks() {
ls "${MOUNTPOINT}"
if [ ${?} -eq 0 ]
ls "${MOUNTPOINT}" && _RET=$? || _RET=$?
if [ $_RET -eq 0 ]
then
return
fi
@ -178,8 +178,8 @@ sudo apt-get -y install unattended-upgrades
}
install_glusterfs_ubuntu() {
dpkg -l | grep glusterfs
if [ ${?} -eq 0 ];
dpkg -l | grep glusterfs && _RET=$? || _RET=$?
if [ $_RET -eq 0 ];
then
return
fi
@ -203,8 +203,8 @@ sudo apt-get -y install unattended-upgrades
if [ $isubuntu -eq 0 ];
then
/etc/init.d/glusterfs-server status
if [ ${?} -ne 0 ];
/etc/init.d/glusterfs-server status && _RET=$? || _RET=$?
if [ $_RET -ne 0 ];
then
install_glusterfs_ubuntu
fi
@ -213,9 +213,9 @@ sudo apt-get -y install unattended-upgrades
echo "gluster step2"
GLUSTERDIR="${MOUNTPOINT}/brick"
ls "${GLUSTERDIR}"
ls "${GLUSTERDIR}" && _RET=$? || _RET=$?
if [ ${?} -ne 0 ];
if [ $_RET -ne 0 ];
then
mkdir "${GLUSTERDIR}"
fi
@ -240,17 +240,17 @@ sudo apt-get -y install unattended-upgrades
echo $glustervm
ping -c 3 $glustervm
gluster peer probe $glustervm
if [ ${?} -ne 0 ];
gluster peer probe $glustervm && _RET=$? || _RET=$?
if [ $_RET -ne 0 ];
then
failed=1
echo "gluster peer probe $glustervm failed"
fi
gluster peer status
gluster peer status | grep $glustervm
gluster peer status | grep $glustervm && _RET=$? || _RET=$?
if [ ${?} -ne 0 ];
if [ $_RET -ne 0 ];
then
failed=1
echo "gluster peer status $glustervm failed"

Просмотреть файл

@ -20,7 +20,7 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
#set -ex
set -ex
#parameters
{

Просмотреть файл

@ -22,7 +22,7 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
#set -ex
set -ex
moodle_on_azure_configs_json_path=${1}