-
Notifications
You must be signed in to change notification settings - Fork 104
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
(PDK-1339) Read or interview for analytics config #657
Conversation
Overall I think this is looking great @rodjek ! I think it makes a great framework to initially provide a consistent interface over a bunch of disparate config files while also letting us slowly unify/replace those config files when and where it makes sense. I know this is still WIP so I wanted to check if it was already in your plans to have PDK read the values from the Bolt config if present on first run, but then write them out to the vendor config location so that we don't lose that config if the user later uninstalls Bolt and/or deletes their Bolt config dir? Also where would you envision hooking in a prompt if we wanted to interactively ask them if they want to opt-out absent any existing config? |
Yep, it all happens in where the When the
My plan is to check for the presence of the vendor-wide config file when the CLI is instantiated but before the analytics client is instantiated. If the file doesn't exist, we'll inform the user and give them a link to the analytics documentation. It won't be an interactive prompt though, partly because that's not what's in the ticket but mostly because that would interfere with any automated |
OK, we should discuss this with @turbodog more because I think he was hoping we could have a prompt. (I think it would be reasonable to bypass the prompt on any |
Yeah I agree that we should go with the prompt route. If |
d592c47
to
bff7309
Compare
@rodjek , the text looks good to me! Let's make the URL https://puppet.com/docs/pdk/latest/pdk_install.html. |
Thanks @jbondpdx, I've updated the URL! |
There was a problem hiding this 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! I left a few small comments but nothing that should block merging.
Nowhere is actually instantiating an analytics client yet correct? So I shouldn't expect to see the debug messages yet?
post_message = _( | ||
'You can opt in or out of the usage data collection at any time by ' \ | ||
'editing the analytics configuration file at %{path} and changing ' \ | ||
"the '%{key}' value.", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should maybe pre-word wrap these at 80 characters or something. Right now the terminal will wrap in the middle of a word. :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also an extra newline after the "post_message" would help it to not get lost in the results of the actual command they ran.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've updated the logger formatter so that we can optionally word wrap the output (and indent the wrapped lines for readability) which gives us the following:
pdk (INFO): PDK collects anonymous usage information to help us understand how
it is being used and make decisions on how to improve it. You can
find out more about what data we collect and how it is used in the
PDK documentation at
https://puppet.com/docs/pdk/latest/pdk_install.html.
[Q 1/1] Do you consent to the collection of anonymous PDK usage information?
--> Yes
pdk (INFO): You can opt in or out of the usage data collection at any time by
editing the analytics configuration file at
/home/tsharpe/.config/puppet/analytics.yml and changing the
'disabled' value.
lib/pdk/config.rb
Outdated
end | ||
|
||
def self.analytics_config_path | ||
ENV['PDK_ANALYTICS_CONFIG'] || File.join(File.dirname(PDK::Util.configdir), 'puppetlabs', 'analytics.yml') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we take this opportunity to rename this to ~/.config/puppet/analytics.yml
or are there other things already using ~/.config/puppetlabs
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm 👍 to using puppet
instead of puppetlabs
This seems to not work as expected on Travis-CI: |
On the first run of PDK if the vendor-wide analytics config file is absent (
$XDG_CONFIG_HOME/puppetlabs/analytics.yml
or%LOCALAPPDATA%/puppetlabs/analytics.yml
) the user will be greeted with the following question.If PDK is not being run interactively (i.e. being called from a script) then the interview will be skipped and the user will be automatically opted out of analytics.