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

Add the ability to configure the cache directory #2757

Open
lollipopman opened this issue Sep 10, 2024 · 3 comments
Open

Add the ability to configure the cache directory #2757

lollipopman opened this issue Sep 10, 2024 · 3 comments
Labels
enhancement New feature or enhancement

Comments

@lollipopman
Copy link
Contributor

At present the cache directory is hard coded:

def self.setup_default_cache_dir
  windows_dir = windows_data_dir
  @facts_cache_dir = if windows_dir
			 File.join(windows_dir, 'PuppetLabs', 'facter', 'cache', 'cached_facts')
		       else
			 '/opt/puppetlabs/facter/cache/cached_facts'
		       end
end

It would nice to be able to set the cache directory in facter.conf

@lollipopman lollipopman added the enhancement New feature or enhancement label Sep 10, 2024
@joshcooper
Copy link
Contributor

It would nice to be able to set the cache directory in facter.conf

Could you expand on why it would be nice to have?

@scrill
Copy link

scrill commented Oct 18, 2024

I think it will be useful in the OSS version that can be installed anywhere:

$ gem install facter
Successfully installed facter-4.9.0
Parsing documentation for facter-4.9.0
Done installing documentation for facter after 1 seconds
1 gem installed

$ which facter
/Users/example/.rbenv/shims/facter

@lollipopman
Copy link
Contributor Author

It would nice to be able to set the cache directory in facter.conf

Could you expand on why it would be nice to have?

My apologies for not being more descriptive. @scrill hinted at the reason for the original request. We use the facter gem in combination with the puppet gem as part of our testing process. When running tests we get this output:

Warning: Facter: Could not write cache: Permission denied @ dir_s_mkdir - /opt/puppetlabs/facter/cache/cached_facts
Warning: Facter: Could not write cache: Permission denied @ dir_s_mkdir - /opt/puppetlabs/facter/cache/cached_facts

I looked for a way to silence this warning, or move the directory somewhere where the non-root testing user could write. This is when I discovered that the path is hard coded, which was the genesis of this feature request. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or enhancement
Projects
None yet
Development

No branches or pull requests

3 participants