Skip to content
This repository has been archived by the owner on Nov 1, 2022. It is now read-only.

Rename --registry-scanning to --registry-disable-scanning & keep it independent from --git-readonly #2813

Merged

Conversation

2opremio
Copy link
Contributor

@2opremio 2opremio commented Feb 3, 2020

Fixes #2790

@2opremio 2opremio requested review from squaremo and hiddeco February 3, 2020 16:24
@squaremo
Copy link
Member

squaremo commented Feb 3, 2020

You didn't fix the boolean-flag-defaulting-to-true problem from #2790.

@2opremio
Copy link
Contributor Author

2opremio commented Feb 3, 2020

You didn't fix the boolean-flag-defaulting-to-true problem from #2790.

I don't really see it as a problem, but I can change it if you see it as a showstopper.

@squaremo
Copy link
Member

squaremo commented Feb 3, 2020

You didn't fix the boolean-flag-defaulting-to-true problem from #2790.

I don't really see it as a problem, but I can change it if you see it as a showstopper.

Well, perhaps either implement it as suggested in the issue, or mount an argument against doing so. My argument is essentially that it's convention to have boolean flags default to false, so having one that defaults to true will surprise some people; and, secondarily, it's a trap for future players, since boolean values (in libraries, structs, variables) default to false, and eventually someone will forget that this one flag is different, and produce unexpected results. There would probably not be a lot of fallout, but why not avoid it if you can?

@2opremio
Copy link
Contributor Author

2opremio commented Feb 3, 2020 via email

@squaremo
Copy link
Member

squaremo commented Feb 4, 2020

My only argument is that double negatives are not intuitive.

Double negatives don't arise -- you either supply

--disable-registry-scanning

to turn scanning off, or omit that flag to let it default to false, i.e., to keep the status quo.

(If the status quo were that registry scanning was off and you had to explicitly switch it on, then the recommendation would be to have --registry-scanning.)

@2opremio
Copy link
Contributor Author

2opremio commented Feb 4, 2020 via email

@2opremio
Copy link
Contributor Author

2opremio commented Feb 4, 2020

The e2e tests caught a pretty basic error which unit tests wouldn't had been able to catch (it happened in the initialization of main()). I am so happy about this :)

@2opremio 2opremio force-pushed the decouple-registryscanning-and-gitreadonly branch from dd61bc6 to 560e7b7 Compare February 4, 2020 14:52
@2opremio
Copy link
Contributor Author

2opremio commented Feb 4, 2020

Fair enough. I will change it later today

@squaremo I am changing the flag now and found another reason for not having the --disable prefix: consistency. All the other registry-related flags start with --registry

I will continue changing it anyhow since you fell strongly in favor of it. Just leaving it for the record.

@squaremo
Copy link
Member

squaremo commented Feb 4, 2020

The e2e tests caught a pretty basic error which unit tests wouldn't had been able to catch

Also a wonderful illustration of why not to introduce a boolean field which needs to be true for behaviour to stay the same. (We've all done it!)

@squaremo
Copy link
Member

squaremo commented Feb 4, 2020

another reason for not having the --disable prefix: consistency. All the other registry-related flags start with --registry

You can change the name, it's the default value I feel strongly about. --registry-disable-scanning, e.g.

@2opremio
Copy link
Contributor Author

2opremio commented Feb 4, 2020

Ah, that's better.

@2opremio
Copy link
Contributor Author

2opremio commented Feb 4, 2020

Also a wonderful illustration of why not to introduce a boolean field which needs to be true for behaviour to stay the same. (We've all done it!)

For the record, I inherited that part of the code :)

cmd/fluxctl/install_cmd.go Outdated Show resolved Hide resolved
cmd/fluxctl/install_cmd.go Outdated Show resolved Hide resolved
cmd/fluxd/main.go Show resolved Hide resolved
cmd/fluxd/main.go Show resolved Hide resolved
docs/faq.md Outdated Show resolved Hide resolved
pkg/install/install.go Show resolved Hide resolved
pkg/install/install_test.go Outdated Show resolved Hide resolved
@2opremio 2opremio changed the title Keep --registry-scanning and --git-readonly independent Rename --registry-scanning to --registry-disable scanning keep it independent from --git-readonly Feb 4, 2020
@squaremo squaremo changed the title Rename --registry-scanning to --registry-disable scanning keep it independent from --git-readonly Rename --registry-scanning to --registry-disable-scanning & keep it independent from --git-readonly Feb 4, 2020
@2opremio 2opremio force-pushed the decouple-registryscanning-and-gitreadonly branch from 48869ee to 7c88004 Compare February 4, 2020 21:29
@2opremio 2opremio added this to the 1.18.0 milestone Feb 4, 2020
@2opremio
Copy link
Contributor Author

2opremio commented Feb 5, 2020

@squaremo I think I've addressed all your comments, PTAL

@2opremio 2opremio force-pushed the decouple-registryscanning-and-gitreadonly branch from 7c88004 to cd8534e Compare February 5, 2020 00:59
@2opremio 2opremio force-pushed the decouple-registryscanning-and-gitreadonly branch from cd8534e to 40aa8b9 Compare February 5, 2020 10:59
pkg/install/go.mod Outdated Show resolved Hide resolved
@2opremio 2opremio force-pushed the decouple-registryscanning-and-gitreadonly branch from 40aa8b9 to 324d5b2 Compare February 5, 2020 12:43
Copy link
Member

@squaremo squaremo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me -- thank you for patiently following this up

@2opremio 2opremio merged commit 8b4c115 into fluxcd:master Feb 5, 2020
@2opremio 2opremio deleted the decouple-registryscanning-and-gitreadonly branch February 5, 2020 14:08
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Reformulate --registry-scanning
3 participants