app icon indicating copy to clipboard operation
app copied to clipboard

docker-app inspect command should print the missing settings and warn if any setting is unused in the compose file

Open silvin-lubecki opened this issue 7 years ago • 3 comments

docker-app inspect print the settings it founds in the settings.yaml file, but some settings may be missing and should be added manually while rendering or deploying the app.

Some other settings can also be forgotten by the user during a refactoring and are now unused.

Something like this

$ cat settings-app.dockerapp
# Version of the application
version: 0.1.0
# Name of the application
name: settings-app
---
version: '3.3'

services:
  myservice:
    image: myprefix/my-image:${myservice.missing.tag}
    ports:
     - "${myservice.used.port}:80"
---
# Settings.
myservice:
  used:
    port: 8080
  unused:
    port: 8081

Inspect should print something like this:

$ docker-app inspect settings-app.dockerapp
settings-app 0.1.0

Setting                 Default
-------                 -------
myservice.used.port     8080

Missing Setting
---------------
myservice.missing.tag

Unused Setting            Default
--------------            -------
myservice.unused.port     8081

silvin-lubecki avatar Jul 27 '18 13:07 silvin-lubecki

Out of interest does validate catch this?

chris-crone avatar Aug 21 '18 15:08 chris-crone

Looks like this is mostly done?

$ cat > test.dockerapp <<EOF
# Version of the application
version: 0.1.0
# Name of the application
name: settings-app
---
version: '3.3'

services:
  myservice:
    image: myprefix/my-image:${myservice.missing.tag}
    ports:
     - "${myservice.used.port}:80"
---
# Settings.
myservice:
  used:
    port: 8080
  unused:
    port: 8081
EOF
$ ./bin/docker-app validate test
Error: failed to load Compose file: invalid interpolation format for services.myservice.image: "required variable myservice.missing.tag is missing a value". You may need to escape any $ with another $.
$ ./bin/docker-app inspect test
Error: failed to load Compose file: invalid interpolation format for services.myservice.image: "required variable myservice.missing.tag is missing a value". You may need to escape any $ with another $.

The "required variable myservice.missing.tag is missing a value" is a bit buried, but it's there.

ijc avatar Jan 21 '19 15:01 ijc

Well, validate is done, but @silvin-lubecki's request for inspect to more clearly express it remains, I guess #425 is related.

ijc avatar Jan 21 '19 15:01 ijc