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

(FACT-1346) Add default Windows facts as a custom fact #54

Merged

Conversation

glennsarti
Copy link
Contributor

Previously facter doesn't expose default Windows environment variables such as
windir or APPDATA. This commit adds a custom structured fact which exposes a
whitelisted set of windows environment variables which can be easily consumed in
manifests. Note that the environment name is purposely uppercased as Windows
env. vars are not case sensitive and it makes it easier to author Puppet
manifests if we're not constantly checking; is TMP or tmp or Tmp.

The custom facts can be accessed via the $facts hash e.g.
$appdata = $facts['windows_env']['APPDATA'].

@glennsarti
Copy link
Contributor Author

Note I didn't add tests for the fact as the code is too simple, and there's no testing on a real Windows platform so mocking is of limited value.

@glennsarti
Copy link
Contributor Author

The fact list comes from the conversation in https://tickets.puppetlabs.com/browse/FACT-1346

Previously facter doesn't expose default Windows environment variables such as
windir or APPDATA.  This commit adds a custom structured fact which exposes a
whitelisted set of windows environment variables which can be easily consumed in
manifests.  Note that the environment name is purposely uppercased as Windows
env. vars are not case sensitive and it makes it easier to author Puppet
manifests if we're not constantly checking; is TMP or tmp or Tmp.

The custom facts can be accessed via the $facts hash e.g.
$appdata = $facts['windows_env']['APPDATA'].
@glennsarti glennsarti force-pushed the fact-1346-add-windows-env-fact branch from a9380de to aa78966 Compare October 3, 2018 09:06
lib/facter/windows_env.rb Show resolved Hide resolved
README.md Show resolved Hide resolved
Copy link
Contributor

@TraGicCode TraGicCode left a comment

Choose a reason for hiding this comment

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

LGTM 👍 Thanks for this change and great job. Hope to see this in core facter soon.

@TraGicCode TraGicCode merged commit 7e3fa78 into puppetlabs:master Oct 3, 2018
@alexjfisher alexjfisher added the enhancement New feature or request label Oct 3, 2018
@Ramesh7 Ramesh7 added the feature New Feature label Aug 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request feature New Feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants