Skip to content
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

Stop assuming Program Files is on C: drive #6317

Merged
merged 3 commits into from
Aug 27, 2019

Conversation

mjiderhamn
Copy link
Contributor

Required for all PRs:

  • Signed CLA.
  • Associated README.md updated.
  • Has appropriate unit tests.

Copy link
Contributor

@glinton glinton left a comment

Choose a reason for hiding this comment

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

Thanks for this

@glinton glinton added the fix pr to fix corresponding bug label Aug 27, 2019
@@ -348,7 +348,7 @@ func main() {
DisplayName: "Telegraf Data Collector Service",
Description: "Collects data using a series of plugins and publishes it to" +
"another series of plugins.",
Arguments: []string{"--config", "C:\\Program Files\\Telegraf\\telegraf.conf"},
Arguments: []string{"--config", os.Getenv("ProgramFiles") + "\\Telegraf\\telegraf.conf"},
Copy link
Contributor

Choose a reason for hiding this comment

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

What if the environment variable isn't set, I think we should fallback to C:\Program Files.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This special environment variable is implicitly set from registry values and AFAIK available in all versions of Windows since XP. Can you explain a reasonable scenario where it isn't set?

Copy link
Contributor

Choose a reason for hiding this comment

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

Are you saying it is impossible for it not to be set?

Copy link
Contributor Author

@mjiderhamn mjiderhamn Aug 27, 2019

Choose a reason for hiding this comment

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

I'm saying that I am not aware of any situation where it could be unset, since for desktop/server versions of Windows XP+ it should always be set.

Since my knowledge about Window CE/Embedded/IoT is very limited, and since I don't know the oldest Windows version Telegraf is supposed to support off the top of my head, I wanted to leave room for you to prove me wrong, considering you brought up the issue.

Unless you are aware of any such exceptions I suggest we do not clutter down the code with defaults that are never used.

Copy link
Contributor

Choose a reason for hiding this comment

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

I'd like this to be handled, any data received from outside the process needs to be checked. We could either have a fallback or exit with an error.

@danielnelson
Copy link
Contributor

Thanks @mjiderhamn, looks like we got too close to another edit, can you fix the merge conflict?

# Conflicts:
#	cmd/telegraf/telegraf.go
@danielnelson danielnelson added this to the 1.12.0 milestone Aug 27, 2019
@danielnelson danielnelson merged commit 08b903a into influxdata:master Aug 27, 2019
bitcharmer pushed a commit to bitcharmer/telegraf that referenced this pull request Oct 18, 2019
athoune pushed a commit to bearstech/telegraf that referenced this pull request Apr 17, 2020
idohalevi pushed a commit to idohalevi/telegraf that referenced this pull request Sep 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fix pr to fix corresponding bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants