Skip to content
This repository has been archived by the owner on Mar 16, 2024. It is now read-only.

Not able to set the boolean arg flag to "false" when it has default value set to "true" in Acornfile. #2211

Open
sangee2004 opened this issue Oct 3, 2023 · 4 comments
Labels
kind/bug Something isn't working
Milestone

Comments

@sangee2004
Copy link
Contributor

sangee2004 commented Oct 3, 2023

acorn version v0.8.0-80-g635ea0a6+635ea0a6

Steps to reproduce the problem:

  1. 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 being 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 ()
@sangee2004 sangee2004 added the kind/bug Something isn't working label Oct 3, 2023
@cjellick cjellick added this to the Backlog milestone Nov 20, 2023
@cjellick
Copy link
Member

How is false pased? I feel like this is missing a step.

@sangee2004
Copy link
Contributor Author

@cjellick I am able to set boolean flag to "true" when it is passed with "=" like --newApp=false in the arg list.
This issue is seen only when it is passed with out "=" like --newApp false in the arg list.

In the example provided in the above issue ,

acorn run -n mytest -f Acornfilebool -- --newApp=false --newtext nnupdate --oldtext ooupdate works as expected.

The issue is seen only when we launch the app as follows without "=" for the boolean args
acorn run -n mytest -f Acornfilebool -- --newApp false --newtext nnupdate --oldtext ooupdate

@cjellick
Copy link
Member

cjellick commented Dec 5, 2023

Not a blocker. Moving to low

@cjellick
Copy link
Member

cjellick commented Dec 5, 2023

This is a limitation of the flag parsing lib we use. See: spf13/cobra#613

Not super high priority, but im tempted to go as far a dropping use of the actual bool flag and have our own string-based bool-ish flag that behaves more predictably

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
kind/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants