aml
aml copied to clipboard
Not able to set the boolean arg flag to "false".
acorn version v0.8.0-80-g635ea0a6+635ea0a6
Steps to reproduce the problem:
- Deploy app using the following Acornfile by passing "false" to newApp - acorn run -n mytest . --newApp false --newtext nnupdate --oldtext ooupdate Acornfile used:
args: {
newApp: true
oldtext: "old"
newtext: "new"
}
containers: {
mywebnew: {
image: "nginx"
ports: publish: "80/http"
files: {
"/usr/share/nginx/html/index.html": std.ifelse(args.newApp, args.newtext, args.oldtext)
}
}
}
This results in newApp
set to true
Spec for the app shows newApp
set to true even when "false" was passed.
"spec": {
"image": "157b305f5477547cda05c29f2ff1758ac1029c9e786bcd2f16546dee15a278df",
"deployArgs": {
"newApp": true,
"newtext": "nnupdate",
"oldtext": "ooupdate"
}
},
Possibly related to type not shown for boolean args in acorn help
acorn run . --help
Volumes: <none>
Secrets: <none>
Containers: mywebnew
Ports: mywebnew:80/http
--newApp
--newtext string
--oldtext string
--profile strings Available profiles ()
This issue is seen even when the default value defined in Acornfile for the boolean arg is "false"
acorn run -n yy . --newApp false
args: {
newApp: false
oldtext: "old"
newtext: "new"
number: 1
decimal: 4.5
}
containers: {
mywebnew: {
image: "nginx"
ports: publish: "80/http"
files: {
"/usr/share/nginx/html/index.html": std.ifelse(args.newApp, args.newtext, args.oldtext)
"/usr/share/nginx/html/test.html": std.ifelse( args.number == 1, "default", "\(args.number)")
"/usr/share/nginx/html/test1.html": std.ifelse(args.decimal > 5, "default", "\(args.decimal)")
}
}
}
This results is newApp
getting set to true
The syntax for setting bools to false is --newApp=false
. What is happening here is that it's being interpreted as one flag --newApp
, which means set to true, and then an arg false
which is silently ignored.
I can change the parser to not silently ignore the extra argument.