fix: report config write failures instead of exiting 0
`config:set`, `config:unset` and `config:clear` discarded the result of writing the app's environment, so a write that never landed still printed `Setting config vars`, still fired the `post-config-update` trigger, still restarted the app and still exited 0. The `config-set` and `config-unset` plugin triggers behaved the same way, which meant an `app.json` `env` block that could not be persisted deployed anyway with the variables missing. The environment is now staged in a temporary file and renamed into place, so a write that fails partway leaves the previous environment intact, and that file is created at `0600` rather than being created at `0644` and chmodded afterwards. `apps:clone` and `apps:rename` never applied that chmod at all and left the new app's environment world-readable.
This commit is contained in:
11 files changed
+369
-43
No files matched your search
@@ -598,7 +598,7 @@ plugn trigger config-migrate-env
|
||||
|
||||
### `config-set`
|
||||
|
||||
- Description: Sets one or more config values for an app without restarting (when --no-restart flag is specified)
|
||||
- Description: Sets one or more config values for an app without restarting (when --no-restart flag is specified). Exits non-zero without restarting the app when the config cannot be persisted.
|
||||
- Invoked by: app-json plugin
|
||||
- Arguments: `[--no-restart] $APP $KEY1=VALUE1 [$KEY2=VALUE2 ...]`
|
||||
- Example:
|
||||
@@ -611,6 +611,21 @@ set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
# TODO
|
||||
```
|
||||
|
||||
### `config-unset`
|
||||
|
||||
- Description: Unsets a single config value for an app. Exits non-zero without restarting the app when the config cannot be persisted.
|
||||
- Invoked by: `common` when migrating deprecated config vars to plugin properties
|
||||
- Arguments: `$APP $KEY $RESTART`, or `--global $KEY $RESTART` when the `--global` flag is given
|
||||
- Example:
|
||||
|
||||
```shell
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
|
||||
plugn trigger config-unset node-js-app DEPRECATED_VAR false
|
||||
```
|
||||
|
||||
### `core-post-deploy`
|
||||
|
||||
> To avoid issues with community plugins, this plugin trigger should be used _only_ for core plugins. Please avoid using this trigger in your own plugins.
|
||||
|
||||
Reference in new issue
Block a user