fix: expose remaining settable properties via :report
Adds the missing raw/global/computed report keys for ten settable properties across the ps, builder, scheduler, proxy, openresty, nginx, and scheduler-k3s plugins so external tooling can verify drift through `:report --format json`. The scheduler-k3s `token` is masked as `*******` in default stdout output and only unmasked when the report is requested via `--format json` or when the flag is queried explicitly by name; the same explicit-query unmasking rule is extended to the existing traefik `dns-provider-<env_var>` keys.
This commit is contained in:
@@ -15,18 +15,23 @@ func ReportSingleApp(appName string, format string, infoFlag string) error {
|
||||
var flags map[string]common.ReportFunc
|
||||
if appName == "--global" {
|
||||
flags = map[string]common.ReportFunc{
|
||||
"--builder-global-selected": reportGlobalSelected,
|
||||
"--builder-global-build-dir": reportGlobalBuildDir,
|
||||
"--builder-global-selected": reportGlobalSelected,
|
||||
"--builder-global-build-dir": reportGlobalBuildDir,
|
||||
"--builder-global-skip-cleanup": reportGlobalSkipCleanup,
|
||||
"--builder-computed-skip-cleanup": reportComputedSkipCleanup,
|
||||
}
|
||||
} else {
|
||||
flags = map[string]common.ReportFunc{
|
||||
"--builder-computed-selected": reportComputedSelected,
|
||||
"--builder-global-selected": reportGlobalSelected,
|
||||
"--builder-selected": reportSelected,
|
||||
"--builder-detected": reportDetected,
|
||||
"--builder-computed-build-dir": reportComputedBuildDir,
|
||||
"--builder-global-build-dir": reportGlobalBuildDir,
|
||||
"--builder-build-dir": reportBuildDir,
|
||||
"--builder-computed-selected": reportComputedSelected,
|
||||
"--builder-global-selected": reportGlobalSelected,
|
||||
"--builder-selected": reportSelected,
|
||||
"--builder-detected": reportDetected,
|
||||
"--builder-computed-build-dir": reportComputedBuildDir,
|
||||
"--builder-global-build-dir": reportGlobalBuildDir,
|
||||
"--builder-build-dir": reportBuildDir,
|
||||
"--builder-computed-skip-cleanup": reportComputedSkipCleanup,
|
||||
"--builder-global-skip-cleanup": reportGlobalSkipCleanup,
|
||||
"--builder-skip-cleanup": reportSkipCleanup,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -77,3 +82,23 @@ func reportGlobalBuildDir(appName string) string {
|
||||
func reportBuildDir(appName string) string {
|
||||
return common.PropertyGet("builder", appName, "build-dir")
|
||||
}
|
||||
|
||||
func reportComputedSkipCleanup(appName string) string {
|
||||
value := reportSkipCleanup(appName)
|
||||
if value == "" {
|
||||
value = reportGlobalSkipCleanup(appName)
|
||||
}
|
||||
if value == "" {
|
||||
value = "false"
|
||||
}
|
||||
|
||||
return value
|
||||
}
|
||||
|
||||
func reportGlobalSkipCleanup(appName string) string {
|
||||
return common.PropertyGet("builder", "--global", "skip-cleanup")
|
||||
}
|
||||
|
||||
func reportSkipCleanup(appName string) string {
|
||||
return common.PropertyGet("builder", appName, "skip-cleanup")
|
||||
}
|
||||
|
||||
@@ -97,6 +97,9 @@ cmd-nginx-report-single() {
|
||||
"--nginx-nginx-conf-sigil-path: $(fn-nginx-nginx-conf-sigil-path "$APP")"
|
||||
"--nginx-computed-nginx-conf-sigil-path: $(fn-nginx-computed-nginx-conf-sigil-path "$APP")"
|
||||
"--nginx-global-nginx-conf-sigil-path: $(fn-nginx-global-nginx-conf-sigil-path "$APP")"
|
||||
"--nginx-nginx-service-command: $(fn-nginx-nginx-service-command "$APP")"
|
||||
"--nginx-computed-nginx-service-command: $(fn-nginx-computed-nginx-service-command "$APP")"
|
||||
"--nginx-global-nginx-service-command: $(fn-nginx-global-nginx-service-command "$APP")"
|
||||
"--nginx-proxy-buffer-size: $(fn-nginx-proxy-buffer-size "$APP")"
|
||||
"--nginx-computed-proxy-buffer-size: $(fn-nginx-computed-proxy-buffer-size "$APP")"
|
||||
"--nginx-global-proxy-buffer-size: $(fn-nginx-global-proxy-buffer-size "$APP")"
|
||||
|
||||
@@ -80,6 +80,8 @@ cmd-openresty-report-single() {
|
||||
"--openresty-computed-letsencrypt-email: $(fn-openresty-computed-letsencrypt-email)"
|
||||
"--openresty-global-letsencrypt-server: $(fn-openresty-global-letsencrypt-server)"
|
||||
"--openresty-computed-letsencrypt-server: $(fn-openresty-computed-letsencrypt-server)"
|
||||
"--openresty-global-log-level: $(fn-openresty-global-log-level)"
|
||||
"--openresty-computed-log-level: $(fn-openresty-computed-log-level)"
|
||||
)
|
||||
else
|
||||
verify_app_name "$APP"
|
||||
@@ -107,6 +109,8 @@ cmd-openresty-report-single() {
|
||||
"--openresty-computed-letsencrypt-email: $(fn-openresty-computed-letsencrypt-email)"
|
||||
"--openresty-global-letsencrypt-server: $(fn-openresty-global-letsencrypt-server)"
|
||||
"--openresty-computed-letsencrypt-server: $(fn-openresty-computed-letsencrypt-server)"
|
||||
"--openresty-global-log-level: $(fn-openresty-global-log-level)"
|
||||
"--openresty-computed-log-level: $(fn-openresty-computed-log-level)"
|
||||
"--openresty-lingering-timeout: $(fn-openresty-lingering-timeout "$APP")"
|
||||
"--openresty-proxy-buffer-size: $(fn-openresty-proxy-buffer-size "$APP")"
|
||||
"--openresty-proxy-buffering: $(fn-openresty-proxy-buffering "$APP")"
|
||||
|
||||
@@ -190,6 +190,23 @@ fn-openresty-computed-letsencrypt-server() {
|
||||
echo "$value"
|
||||
}
|
||||
|
||||
fn-openresty-global-log-level() {
|
||||
declare desc="get the raw configured log level"
|
||||
|
||||
fn-plugin-property-get-default "openresty" "--global" "log-level" ""
|
||||
}
|
||||
|
||||
fn-openresty-computed-log-level() {
|
||||
declare desc="get the effective log level, falling back to ERROR"
|
||||
local value
|
||||
|
||||
value="$(fn-openresty-global-log-level)"
|
||||
if [[ -z "$value" ]]; then
|
||||
value="ERROR"
|
||||
fi
|
||||
echo "$value"
|
||||
}
|
||||
|
||||
fn-openresty-log-root() {
|
||||
declare desc="get the openresty log root"
|
||||
local OPENRESTY_LOG_ROOT="/var/log/nginx"
|
||||
|
||||
@@ -23,3 +23,50 @@ func getComputedProxyType(appName string) string {
|
||||
func getGlobalProxyType() string {
|
||||
return common.PropertyGet("proxy", "--global", "type")
|
||||
}
|
||||
|
||||
func getAppProxyPort(appName string) string {
|
||||
return common.PropertyGet("proxy", appName, "proxy-port")
|
||||
}
|
||||
|
||||
func getGlobalProxyPort() string {
|
||||
return common.PropertyGet("proxy", "--global", "proxy-port")
|
||||
}
|
||||
|
||||
func getComputedProxyPort(appName string) string {
|
||||
value := getAppProxyPort(appName)
|
||||
if value == "" {
|
||||
value = getGlobalProxyPort()
|
||||
}
|
||||
|
||||
return value
|
||||
}
|
||||
|
||||
func getAppProxySSLPort(appName string) string {
|
||||
return common.PropertyGet("proxy", appName, "proxy-ssl-port")
|
||||
}
|
||||
|
||||
func getGlobalProxySSLPort() string {
|
||||
return common.PropertyGet("proxy", "--global", "proxy-ssl-port")
|
||||
}
|
||||
|
||||
func getComputedProxySSLPort(appName string) string {
|
||||
value := getAppProxySSLPort(appName)
|
||||
if value == "" {
|
||||
value = getGlobalProxySSLPort()
|
||||
}
|
||||
|
||||
return value
|
||||
}
|
||||
|
||||
func getAppDisabled(appName string) string {
|
||||
return common.PropertyGet("proxy", appName, "disabled")
|
||||
}
|
||||
|
||||
func getComputedDisabled(appName string) string {
|
||||
value := getAppDisabled(appName)
|
||||
if value == "" {
|
||||
value = "false"
|
||||
}
|
||||
|
||||
return value
|
||||
}
|
||||
|
||||
@@ -15,15 +15,27 @@ func ReportSingleApp(appName string, format string, infoFlag string) error {
|
||||
var flags map[string]common.ReportFunc
|
||||
if appName == "--global" {
|
||||
flags = map[string]common.ReportFunc{
|
||||
"--proxy-computed-type": reportComputedType,
|
||||
"--proxy-global-type": reportGlobalType,
|
||||
"--proxy-computed-proxy-port": reportComputedProxyPort,
|
||||
"--proxy-computed-proxy-ssl-port": reportComputedProxySSLPort,
|
||||
"--proxy-computed-type": reportComputedType,
|
||||
"--proxy-global-proxy-port": reportGlobalProxyPort,
|
||||
"--proxy-global-proxy-ssl-port": reportGlobalProxySSLPort,
|
||||
"--proxy-global-type": reportGlobalType,
|
||||
}
|
||||
} else {
|
||||
flags = map[string]common.ReportFunc{
|
||||
"--proxy-enabled": reportEnabled,
|
||||
"--proxy-computed-type": reportComputedType,
|
||||
"--proxy-global-type": reportGlobalType,
|
||||
"--proxy-type": reportType,
|
||||
"--proxy-computed-disabled": reportComputedDisabled,
|
||||
"--proxy-computed-proxy-port": reportComputedProxyPort,
|
||||
"--proxy-computed-proxy-ssl-port": reportComputedProxySSLPort,
|
||||
"--proxy-computed-type": reportComputedType,
|
||||
"--proxy-disabled": reportDisabled,
|
||||
"--proxy-enabled": reportEnabled,
|
||||
"--proxy-global-proxy-port": reportGlobalProxyPort,
|
||||
"--proxy-global-proxy-ssl-port": reportGlobalProxySSLPort,
|
||||
"--proxy-global-type": reportGlobalType,
|
||||
"--proxy-proxy-port": reportProxyPort,
|
||||
"--proxy-proxy-ssl-port": reportProxySSLPort,
|
||||
"--proxy-type": reportType,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -58,3 +70,35 @@ func reportGlobalType(appName string) string {
|
||||
func reportType(appName string) string {
|
||||
return getAppProxyType(appName)
|
||||
}
|
||||
|
||||
func reportDisabled(appName string) string {
|
||||
return getAppDisabled(appName)
|
||||
}
|
||||
|
||||
func reportComputedDisabled(appName string) string {
|
||||
return getComputedDisabled(appName)
|
||||
}
|
||||
|
||||
func reportProxyPort(appName string) string {
|
||||
return getAppProxyPort(appName)
|
||||
}
|
||||
|
||||
func reportGlobalProxyPort(appName string) string {
|
||||
return getGlobalProxyPort()
|
||||
}
|
||||
|
||||
func reportComputedProxyPort(appName string) string {
|
||||
return getComputedProxyPort(appName)
|
||||
}
|
||||
|
||||
func reportProxySSLPort(appName string) string {
|
||||
return getAppProxySSLPort(appName)
|
||||
}
|
||||
|
||||
func reportGlobalProxySSLPort(appName string) string {
|
||||
return getGlobalProxySSLPort()
|
||||
}
|
||||
|
||||
func reportComputedProxySSLPort(appName string) string {
|
||||
return getComputedProxySSLPort(appName)
|
||||
}
|
||||
|
||||
@@ -20,24 +20,33 @@ func ReportSingleApp(appName string, format string, infoFlag string) error {
|
||||
if appName == "--global" {
|
||||
flags = map[string]common.ReportFunc{
|
||||
"--ps-computed-procfile-path": reportComputedProcfilePath,
|
||||
"--ps-computed-skip-deploy": reportComputedSkipDeploy,
|
||||
"--ps-computed-stop-timeout-seconds": reportComputedStopTimeoutSeconds,
|
||||
"--ps-global-procfile-path": reportGlobalProcfilePath,
|
||||
"--ps-global-skip-deploy": reportGlobalSkipDeploy,
|
||||
"--ps-global-stop-timeout-seconds": reportGlobalStopTimeoutSeconds,
|
||||
}
|
||||
} else {
|
||||
flags = map[string]common.ReportFunc{
|
||||
"--deployed": reportDeployed,
|
||||
"--processes": reportProcesses,
|
||||
"--ps-can-scale": reportCanScale,
|
||||
"--ps-restart-policy": reportRestartPolicy,
|
||||
"--ps-computed-procfile-path": reportComputedProcfilePath,
|
||||
"--ps-global-procfile-path": reportGlobalProcfilePath,
|
||||
"--ps-procfile-path": reportProcfilePath,
|
||||
"--restore": reportRestore,
|
||||
"--running": reportRunningState,
|
||||
"--ps-global-stop-timeout-seconds": reportGlobalStopTimeoutSeconds,
|
||||
"--ps-computed-stop-timeout-seconds": reportComputedStopTimeoutSeconds,
|
||||
"--ps-stop-timeout-seconds": reportStopTimeoutSeconds,
|
||||
"--deployed": reportDeployed,
|
||||
"--processes": reportProcesses,
|
||||
"--ps-can-scale": reportCanScale,
|
||||
"--ps-computed-dockerfile-start-cmd": reportComputedDockerfileStartCmd,
|
||||
"--ps-computed-procfile-path": reportComputedProcfilePath,
|
||||
"--ps-computed-skip-deploy": reportComputedSkipDeploy,
|
||||
"--ps-computed-start-cmd": reportComputedStartCmd,
|
||||
"--ps-computed-stop-timeout-seconds": reportComputedStopTimeoutSeconds,
|
||||
"--ps-dockerfile-start-cmd": reportDockerfileStartCmd,
|
||||
"--ps-global-procfile-path": reportGlobalProcfilePath,
|
||||
"--ps-global-skip-deploy": reportGlobalSkipDeploy,
|
||||
"--ps-global-stop-timeout-seconds": reportGlobalStopTimeoutSeconds,
|
||||
"--ps-procfile-path": reportProcfilePath,
|
||||
"--ps-restart-policy": reportRestartPolicy,
|
||||
"--ps-skip-deploy": reportSkipDeploy,
|
||||
"--ps-start-cmd": reportStartCmd,
|
||||
"--ps-stop-timeout-seconds": reportStopTimeoutSeconds,
|
||||
"--restore": reportRestore,
|
||||
"--running": reportRunningState,
|
||||
}
|
||||
|
||||
extraFlags := addStatusFlags(appName, infoFlag)
|
||||
@@ -99,6 +108,14 @@ func reportCanScale(appName string) string {
|
||||
return canScale
|
||||
}
|
||||
|
||||
func reportComputedDockerfileStartCmd(appName string) string {
|
||||
return reportDockerfileStartCmd(appName)
|
||||
}
|
||||
|
||||
func reportDockerfileStartCmd(appName string) string {
|
||||
return common.PropertyGet("ps", appName, "dockerfile-start-cmd")
|
||||
}
|
||||
|
||||
func reportComputedProcfilePath(appName string) string {
|
||||
value := reportProcfilePath(appName)
|
||||
if value == "" {
|
||||
@@ -150,6 +167,34 @@ func reportRestore(appName string) string {
|
||||
return common.PropertyGetDefault("ps", appName, "restore", "true")
|
||||
}
|
||||
|
||||
func reportComputedSkipDeploy(appName string) string {
|
||||
value := reportSkipDeploy(appName)
|
||||
if value == "" {
|
||||
value = reportGlobalSkipDeploy(appName)
|
||||
}
|
||||
if value == "" {
|
||||
value = "false"
|
||||
}
|
||||
|
||||
return value
|
||||
}
|
||||
|
||||
func reportGlobalSkipDeploy(appName string) string {
|
||||
return common.PropertyGet("ps", "--global", "skip-deploy")
|
||||
}
|
||||
|
||||
func reportSkipDeploy(appName string) string {
|
||||
return common.PropertyGet("ps", appName, "skip-deploy")
|
||||
}
|
||||
|
||||
func reportComputedStartCmd(appName string) string {
|
||||
return reportStartCmd(appName)
|
||||
}
|
||||
|
||||
func reportStartCmd(appName string) string {
|
||||
return common.PropertyGet("ps", appName, "start-cmd")
|
||||
}
|
||||
|
||||
func reportRunningState(appName string) string {
|
||||
return getRunningState(appName)
|
||||
}
|
||||
|
||||
@@ -332,11 +332,3 @@ func TriggerPsGetProperty(appName string, property string) error {
|
||||
fmt.Println(fn(appName))
|
||||
return nil
|
||||
}
|
||||
|
||||
func reportComputedSkipDeploy(appName string) string {
|
||||
value := common.PropertyGet("ps", appName, "skip-deploy")
|
||||
if value == "" {
|
||||
value = common.PropertyGet("ps", "--global", "skip-deploy")
|
||||
}
|
||||
return value
|
||||
}
|
||||
|
||||
@@ -7,6 +7,9 @@ import (
|
||||
"github.com/dokku/dokku/plugins/common"
|
||||
)
|
||||
|
||||
// tokenMask is shown in place of the raw token value in default stdout output.
|
||||
const tokenMask = "*******"
|
||||
|
||||
// ReportSingleApp is an internal function that displays the scheduler-k3s report for one or more apps
|
||||
func ReportSingleApp(appName string, format string, infoFlag string) error {
|
||||
if appName != "--global" {
|
||||
@@ -17,6 +20,12 @@ func ReportSingleApp(appName string, format string, infoFlag string) error {
|
||||
|
||||
var flags map[string]common.ReportFunc
|
||||
if appName == "--global" {
|
||||
tokenFlag := "--scheduler-k3s-global-token"
|
||||
tokenReportFunc := reportMaskedGlobalToken
|
||||
if format == "json" || infoFlag == tokenFlag {
|
||||
tokenReportFunc = reportGlobalToken
|
||||
}
|
||||
|
||||
flags = map[string]common.ReportFunc{
|
||||
"--scheduler-k3s-computed-deploy-timeout": reportComputedDeployTimeout,
|
||||
"--scheduler-k3s-global-deploy-timeout": reportGlobalDeployTimeout,
|
||||
@@ -44,6 +53,7 @@ func ReportSingleApp(appName string, format string, infoFlag string) error {
|
||||
"--scheduler-k3s-global-rollback-on-failure": reportGlobalRollbackOnFailure,
|
||||
"--scheduler-k3s-computed-shm-size": reportComputedShmSize,
|
||||
"--scheduler-k3s-global-shm-size": reportGlobalShmSize,
|
||||
tokenFlag: tokenReportFunc,
|
||||
}
|
||||
} else {
|
||||
flags = map[string]common.ReportFunc{
|
||||
@@ -267,3 +277,15 @@ func reportGlobalShmSize(appName string) string {
|
||||
func reportShmSize(appName string) string {
|
||||
return getShmSize(appName)
|
||||
}
|
||||
|
||||
func reportGlobalToken(appName string) string {
|
||||
return getGlobalGlobalToken()
|
||||
}
|
||||
|
||||
func reportMaskedGlobalToken(appName string) string {
|
||||
value := getGlobalGlobalToken()
|
||||
if value == "" {
|
||||
return ""
|
||||
}
|
||||
return tokenMask
|
||||
}
|
||||
|
||||
@@ -17,12 +17,17 @@ func ReportSingleApp(appName string, format string, infoFlag string) error {
|
||||
flags = map[string]common.ReportFunc{
|
||||
"--scheduler-computed-selected": reportComputedSelected,
|
||||
"--scheduler-global-selected": reportGlobalSelected,
|
||||
"--scheduler-computed-shell": reportComputedShell,
|
||||
"--scheduler-global-shell": reportGlobalShell,
|
||||
}
|
||||
} else {
|
||||
flags = map[string]common.ReportFunc{
|
||||
"--scheduler-computed-selected": reportComputedSelected,
|
||||
"--scheduler-global-selected": reportGlobalSelected,
|
||||
"--scheduler-selected": reportSelected,
|
||||
"--scheduler-computed-shell": reportComputedShell,
|
||||
"--scheduler-global-shell": reportGlobalShell,
|
||||
"--scheduler-shell": reportShell,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -56,3 +61,20 @@ func reportGlobalSelected(appName string) string {
|
||||
func reportSelected(appName string) string {
|
||||
return common.PropertyGet("scheduler", appName, "selected")
|
||||
}
|
||||
|
||||
func reportComputedShell(appName string) string {
|
||||
value := reportShell(appName)
|
||||
if value == "" {
|
||||
value = reportGlobalShell(appName)
|
||||
}
|
||||
|
||||
return value
|
||||
}
|
||||
|
||||
func reportGlobalShell(appName string) string {
|
||||
return common.PropertyGet("scheduler", "--global", "shell")
|
||||
}
|
||||
|
||||
func reportShell(appName string) string {
|
||||
return common.PropertyGet("scheduler", appName, "shell")
|
||||
}
|
||||
|
||||
@@ -111,7 +111,7 @@ cmd-traefik-report-single() {
|
||||
key="$(echo "$line" | cut -d' ' -f1)"
|
||||
value="$(echo "$line" | cut -d' ' -f2-)"
|
||||
if [[ -n "$key" ]]; then
|
||||
if [[ "$FORMAT" == "json" ]]; then
|
||||
if [[ "$FORMAT" == "json" ]] || [[ "$INFO_FLAG" == "--traefik-${key}" ]]; then
|
||||
flag_map+=("--traefik-${key}: ${value}")
|
||||
else
|
||||
flag_map+=("--traefik-${key}: *******")
|
||||
|
||||
Reference in New Issue
Block a user