Class: UffizziCore::ComposeFile::ErrorsService
- Inherits:
-
Object
- Object
- UffizziCore::ComposeFile::ErrorsService
- Defined in:
- app/services/uffizzi_core/compose_file/errors_service.rb
Constant Summary collapse
- SECRETS_ERROR_KEY =
'secret_variables'
- TEMPLATE_BUILD_ERROR_KEY =
'template_build_error'
- DOCKER_REGISTRY_CONTAINER_ERROR_KEY =
'docker_registry_container_error'
Class Method Summary collapse
- .has_error?(compose_file, error_code) ⇒ Boolean
- .has_errors?(compose_file) ⇒ Boolean
- .raise_build_error!(type, extra_errors = {}) ⇒ Object
- .reset_compose_errors!(compose_file) ⇒ Object
- .reset_error!(compose_file, error_code) ⇒ Object
- .update_compose_errors!(compose_file, errors, invalid_content) ⇒ Object
Class Method Details
.has_error?(compose_file, error_code) ⇒ Boolean
9 10 11 12 13 |
# File 'app/services/uffizzi_core/compose_file/errors_service.rb', line 9 def has_error?(compose_file, error_code) error = compose_file.payload.dig('errors', error_code) error.present? end |
.has_errors?(compose_file) ⇒ Boolean
15 16 17 |
# File 'app/services/uffizzi_core/compose_file/errors_service.rb', line 15 def has_errors?(compose_file) compose_file.payload['errors'].present? end |
.raise_build_error!(type, extra_errors = {}) ⇒ Object
49 50 51 52 |
# File 'app/services/uffizzi_core/compose_file/errors_service.rb', line 49 def raise_build_error!(type, extra_errors = {}) msg = I18n.t('compose.unprocessable_image', value: type) raise UffizziCore::ComposeFile::BuildError.new(msg, extra_errors) end |
.reset_compose_errors!(compose_file) ⇒ Object
29 30 31 32 33 34 35 36 |
# File 'app/services/uffizzi_core/compose_file/errors_service.rb', line 29 def reset_compose_errors!(compose_file) compose_file.payload['errors'] = nil compose_file.set_valid compose_file.save! compose_file end |
.reset_error!(compose_file, error_code) ⇒ Object
38 39 40 41 42 43 44 45 46 47 |
# File 'app/services/uffizzi_core/compose_file/errors_service.rb', line 38 def reset_error!(compose_file, error_code) errors = compose_file.payload['errors'] return if errors.nil? new_errors = errors.except(error_code) compose_file.payload['errors'] = new_errors compose_file.save! compose_file end |
.update_compose_errors!(compose_file, errors, invalid_content) ⇒ Object
19 20 21 22 23 24 25 26 27 |
# File 'app/services/uffizzi_core/compose_file/errors_service.rb', line 19 def update_compose_errors!(compose_file, errors, invalid_content) compose_file.payload['errors'] = errors compose_file.set_invalid if compose_file.valid_file? compose_file.content = invalid_content compose_file.save! compose_file end |