@@ -14,15 +14,15 @@ LDAP_GROUP_DN=${10}
1414ST2_USERNAME=st2admin
1515REPO=enterprise
1616
17- if [ $VERSION = " None" ]; then
17+ if [[ " $VERSION " = " None" ] ]; then
1818 VERSION=' '
1919fi
2020
21- if [ " ${PKG_ENV} " = " staging" ]; then
21+ if [[ " ${PKG_ENV} " = " staging" ] ]; then
2222 REPO=" ${PKG_ENV} -${REPO} "
2323fi
2424
25- if [ " ${RELEASE} " = " unstable" ]; then
25+ if [[ " ${RELEASE} " = " unstable" ] ]; then
2626 REPO=" ${REPO} -${RELEASE} "
2727fi
2828
@@ -55,9 +55,9 @@ install_enterprise_bits() {
5555 echo " Downloading from repo ${REPO} ..."
5656 echo " Version: $VERSION "
5757
58- if [[ ${DISTRO} = \ U BUNTU* ]]; then
58+ if [[ " ${DISTRO} " = UBUNTU* ]]; then
5959 curl -s https://${LICENSE_KEY} :@packagecloud.io/install/repositories/StackStorm/${REPO} /script.deb.sh | bash
60- if [[ -z $VERSION ]]; then
60+ if [[ -z " $VERSION " ]]; then
6161 apt-get install -y bwc-enterprise
6262 else
6363 local BWC_ENTERPRISE_PKG_VERSION=$( get_apt_pkg_latest_revision bwc-enterprise $VERSION )
@@ -85,7 +85,7 @@ install_enterprise_bits() {
8585 fi
8686 else
8787 curl -s https://${LICENSE_KEY} :@packagecloud.io/install/repositories/StackStorm/${REPO} /script.rpm.sh | sudo bash
88- if [[ -z $VERSION ]]; then
88+ if [[ -z " $VERSION " ]]; then
8989 yum install -y bwc-enterprise
9090 else
9191 yum install -y yum-utils # need repoquery
@@ -140,45 +140,44 @@ CONF
140140}
141141
142142enable_and_configure_rbac () {
143- echo " Enabling and configuring RBAC in st2.conf"
143+ echo " Enabling and configuring RBAC in st2.conf"
144144
145- if [[ ${DISTRO} = \ U BUNTU* ]]; then
145+ if [[ " ${DISTRO} " = UBUNTU* ]]; then
146146 sudo apt-get install -y crudini
147- else
147+ else
148148 sudo yum install -y crudini
149- fi
149+ fi
150150
151- # Enable RBAC
152- echo " Enabling rbac in st2.conf"
151+ # Enable RBAC
152+ echo " Enabling rbac in st2.conf"
153153
154- sudo crudini --set /etc/st2/st2.conf rbac enable ' True'
155- sudo crudini --set /etc/st2/st2.conf rbac backend ' enterprise'
154+ sudo crudini --set /etc/st2/st2.conf rbac enable ' True'
155+ sudo crudini --set /etc/st2/st2.conf rbac backend ' enterprise'
156156
157- # TODO: Move directory creation to package
158- sudo mkdir -p /opt/stackstorm/rbac/assignments/
159- sudo mkdir -p /opt/stackstorm/rbac/roles/
157+ # TODO: Move directory creation to package
158+ sudo mkdir -p /opt/stackstorm/rbac/assignments/
159+ sudo mkdir -p /opt/stackstorm/rbac/roles/
160160
161- # Write role assignment for admin user
162- ROLE_ASSIGNMENT_FILE=" /opt/stackstorm/rbac/assignments/${ST2_USERNAME} .yaml"
163- sudo bash -c " cat > ${ROLE_ASSIGNMENT_FILE} " << EOL
161+ # Write role assignment for admin user
162+ ROLE_ASSIGNMENT_FILE=" /opt/stackstorm/rbac/assignments/${ST2_USERNAME} .yaml"
163+ sudo bash -c " cat > ${ROLE_ASSIGNMENT_FILE} " << EOL
164164---
165165 username: "${ST2_USERNAME} "
166166 roles:
167167 - "system_admin"
168168EOL
169169
170- # Write role assignment for stanley (system) user
171- ROLE_ASSIGNMENT_FILE=" /opt/stackstorm/rbac/assignments/stanley.yaml"
172- sudo bash -c " cat > ${ROLE_ASSIGNMENT_FILE} " << EOL
170+ # Write role assignment for stanley (system) user
171+ ROLE_ASSIGNMENT_FILE=" /opt/stackstorm/rbac/assignments/stanley.yaml"
172+ sudo bash -c " cat > ${ROLE_ASSIGNMENT_FILE} " << EOL
173173---
174174 username: "stanley"
175175 roles:
176176 - "admin"
177177EOL
178178
179- # Sync roles and assignments
180- sudo st2-apply-rbac-definitions --config-file /etc/st2/st2.conf
181-
179+ # Sync roles and assignments
180+ sudo st2-apply-rbac-definitions --config-file /etc/st2/st2.conf
182181}
183182
184183
0 commit comments