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

(#22349) Read from user's home when non-root #531

Conversation

zaphod42
Copy link

The external facts directory always assumed that the user was root, or at
least had read access to the global facts.d directory. This created problems
for users with restricted permissions when running as non-root. Instead of
trying to handle the permissions problem, which would have made facter run,
this changes facter to follow the same non-root style as puppet, which is to
look in the home directory for a .facter/facts.d external facts directory.
Simply handling the error would have had two undesirable consequences: 1) it
would have hidden a problem from the user and 2) it would have made external
facts cumbersome to use as non-root as the user would always have to specify
--external-dir, which is not currently possible when facter is used by
puppet.

The external facts directory always assumed that the user was root, or
at least had read access to the global facts.d directory. This created
problems for users with restricted permissions when running as non-root.
Instead of trying to handle the permissions problem, which would have
made facter run, this changes facter to follow the same non-root style
as puppet, which is to look in the home directory for a .facter/facts.d
external facts directory. Simply handling the error would have had two
undesirable consequences: 1) it would have hidden a problem from the
user and 2) it would have made external facts cumbersome to use as
non-root as the user would always have to specify --external-dir, which
is not currently possible when facter is used by puppet.
@puppetcla
Copy link

CLA signed by all contributors.

end
end
end

if Facter::Util::Config.is_windows?
require 'rubygems'
require 'win32/dir'
Copy link
Contributor

Choose a reason for hiding this comment

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

You'll also need:

require 'windows/system_info'
require 'windows/security'
require 'sys/admin'

Copy link
Contributor

Choose a reason for hiding this comment

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

The Gemfile needs to be updated with sys/admin (which is already a dependency in puppet)

@joshcooper
Copy link
Contributor

Merged this into stable in commit 46bed4e

@joshcooper joshcooper closed this Sep 6, 2013
florindragos pushed a commit that referenced this pull request Jun 15, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants