Closed Brantone closed 7 years ago
Is there a way to make this idempotent so it does't convert on every run?
Yeah, I'd actually debated doing that. Essentially the check would be hitting brew analytics state
to see if it aligns with desired attribute, then setting if it does not ... which means it's still having to do a call to brew analytics
every run anyway.
In Brew, the underlying code (https://github.com/Homebrew/brew/blob/master/Library/Homebrew/cmd/analytics.rb#L32) for the on/off toggle currently uses git --config
(which in turn hits .git/config
for a string) ... I was reluctant to use that method in case the Brew code itself changes to a different method.
That being said, I'm not averse to changing it, just requires some extra string parsing on the output of brew analytics state
.
Technically it is idempotent because the underlying command will just keep setting it to what it's already set to (meaning, unless attribute is changed it'll keep running brew analytics off
, for example) ...
However, a side comment was recently made that not having that in a conditional means it'll show up as an extra resource being updated. ... I'll get the code touched up.
Homebrew sends analytics, it does so by default with an opt-out strategy. This defaults to follow that strategy; however, allows for actually opting out after it's installed.
Signed-off-by: Brenton Bartel brenton@letrabb.com