Skip to content

Commit 1643e0a

Browse files
authored
Merge pull request #798 from NobodysNightmare/replace-tabs-by-spaces
Replace tabs by spaces
2 parents 1c3aeb4 + 91899c6 commit 1643e0a

File tree

1 file changed

+42
-42
lines changed

1 file changed

+42
-42
lines changed

integration_setup.sh

Lines changed: 42 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -130,42 +130,42 @@ isOpenProjectFileStorageConfigOk() {
130130
}
131131

132132
logUnhandledError() {
133-
log_error "Unhandled error while creating the file storage '${OPENPROJECT_STORAGE_NAME}'"
134-
log_error "OpenProject returned the following error: '${error_message}'"
135-
log_info "You could try deleting the file storage '${OPENPROJECT_STORAGE_NAME}' in OpenProject and run the script again."
133+
log_error "Unhandled error while creating the file storage '${OPENPROJECT_STORAGE_NAME}'"
134+
log_error "OpenProject returned the following error: '${error_message}'"
135+
log_info "You could try deleting the file storage '${OPENPROJECT_STORAGE_NAME}' in OpenProject and run the script again."
136136
}
137137

138138
logCompleteIntegrationConfiguration() {
139-
log_success "Setup of OpenProject and Nextcloud is complete."
140-
exit 0
139+
log_success "Setup of OpenProject and Nextcloud is complete."
140+
exit 0
141141
}
142142

143143
checkOpenProjectIntegrationConfiguration() {
144-
# At this point we know that the file storage already exists, so we only check if it is configured completely in OpenProject
145-
log_success "File storage name '$OPENPROJECT_STORAGE_NAME' in OpenProject already exists."
146-
status_op=$(isOpenProjectFileStorageConfigOk)
147-
if [[ "$status_op" -ne 0 ]]; then
148-
log_error "File storage '$OPENPROJECT_STORAGE_NAME' configuration is incomplete in OpenProject '${OPENPROJECT_HOST}' for integration with Nextcloud."
149-
if [[ ${SETUP_PROJECT_FOLDER} == 'true' ]]; then
150-
log_error "Or the application password has not been set in 'OpenProject' '${OPENPROJECT_HOST}'."
151-
fi
152-
log_info "You could try deleting the file storage '${OPENPROJECT_STORAGE_NAME}' in OpenProject and run the script again."
153-
exit 1
154-
fi
155-
log_success "File storage name '$OPENPROJECT_STORAGE_NAME' in OpenProject for integration with Nextcloud is configured."
144+
# At this point we know that the file storage already exists, so we only check if it is configured completely in OpenProject
145+
log_success "File storage name '$OPENPROJECT_STORAGE_NAME' in OpenProject already exists."
146+
status_op=$(isOpenProjectFileStorageConfigOk)
147+
if [[ "$status_op" -ne 0 ]]; then
148+
log_error "File storage '$OPENPROJECT_STORAGE_NAME' configuration is incomplete in OpenProject '${OPENPROJECT_HOST}' for integration with Nextcloud."
149+
if [[ ${SETUP_PROJECT_FOLDER} == 'true' ]]; then
150+
log_error "Or the application password has not been set in 'OpenProject' '${OPENPROJECT_HOST}'."
151+
fi
152+
log_info "You could try deleting the file storage '${OPENPROJECT_STORAGE_NAME}' in OpenProject and run the script again."
153+
exit 1
154+
fi
155+
log_success "File storage name '$OPENPROJECT_STORAGE_NAME' in OpenProject for integration with Nextcloud is configured."
156156
}
157157

158158
checkNextcloudIntegrationConfiguration() {
159-
status_nc=$(isNextcloudAdminConfigOk)
160-
if [[ "$status_nc" -ne 0 ]]; then
161-
log_error "Some admin configuration is incomplete in Nextcloud '${NEXTCLOUD_HOST}' for integration with OpenProject."
162-
if [[ ${SETUP_PROJECT_FOLDER} == 'true' ]]; then
163-
log_error "Or project folder setup might be missing in Nextcloud '${NEXTCLOUD_HOST}'."
164-
fi
165-
log_info "You could try deleting the file storage '${OPENPROJECT_STORAGE_NAME}' in OpenProject and run the script again."
166-
exit 1
167-
fi
168-
log_success "Admin configuration in Nextcloud for integration with OpenProject is configured."
159+
status_nc=$(isNextcloudAdminConfigOk)
160+
if [[ "$status_nc" -ne 0 ]]; then
161+
log_error "Some admin configuration is incomplete in Nextcloud '${NEXTCLOUD_HOST}' for integration with OpenProject."
162+
if [[ ${SETUP_PROJECT_FOLDER} == 'true' ]]; then
163+
log_error "Or project folder setup might be missing in Nextcloud '${NEXTCLOUD_HOST}'."
164+
fi
165+
log_info "You could try deleting the file storage '${OPENPROJECT_STORAGE_NAME}' in OpenProject and run the script again."
166+
exit 1
167+
fi
168+
log_success "Admin configuration in Nextcloud for integration with OpenProject is configured."
169169
}
170170

171171
# check if both instances are started or not
@@ -263,23 +263,23 @@ if [[ ${response_type} == "Error" ]]; then
263263
(( error_count +=1 ))
264264
done
265265
if [[ $host_already_taken != true || $name_already_taken != true || "$error_count" -ne 2 ]]; then
266-
logUnhandledError
267-
exit 1
266+
logUnhandledError
267+
exit 1
268268
fi
269-
checkOpenProjectIntegrationConfiguration
270-
checkNextcloudIntegrationConfiguration
271-
logCompleteIntegrationConfiguration
269+
checkOpenProjectIntegrationConfiguration
270+
checkNextcloudIntegrationConfiguration
271+
logCompleteIntegrationConfiguration
272272
elif [[ ${error_id} == "urn:openproject-org:api:v3:errors:PropertyConstraintViolation" ]]; then
273-
# A PropertyConstraintViolation is always a single error
274-
error_messages_grep=$(echo $create_storage_response | jq -r '.message')
275-
if [[ "$error_messages_grep" == "Host has already been taken." || "$error_messages_grep" == "Name has already been taken." ]]; then
276-
checkOpenProjectIntegrationConfiguration
277-
checkNextcloudIntegrationConfiguration
278-
logCompleteIntegrationConfiguration
279-
else
280-
logUnhandledError
281-
exit 1
282-
fi
273+
# A PropertyConstraintViolation is always a single error
274+
error_messages_grep=$(echo $create_storage_response | jq -r '.message')
275+
if [[ "$error_messages_grep" == "Host has already been taken." || "$error_messages_grep" == "Name has already been taken." ]]; then
276+
checkOpenProjectIntegrationConfiguration
277+
checkNextcloudIntegrationConfiguration
278+
logCompleteIntegrationConfiguration
279+
else
280+
logUnhandledError
281+
exit 1
282+
fi
283283
elif [[ ${error_id} == "urn:openproject-org:api:v3:errors:Unauthenticated" ]]; then
284284
log_error "Authorization failed. Ensure you have created a valid BASIC AUTH API account, e.g. utilising the following env variables:"
285285
log_info "OPENPROJECT_AUTHENTICATION_GLOBAL__BASIC__AUTH_USER=<basic_auth_api_username>"

0 commit comments

Comments
 (0)