-
Notifications
You must be signed in to change notification settings - Fork 494
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-2832) Use full path for augparse command #2135
Conversation
command = if RbConfig::CONFIG['host_os'] =~ /mswin|msys|mingw|cygwin|bccwin|wince|emc/ | ||
'augparse' | ||
else | ||
'/opt/puppetlabs/puppet/bin/augparse' |
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.
Do we want to have this fact only in a puppet-agent context? What if i want to use the augeas fact with standalone facter and i install augeas
to have augparse
command?
For example installing augeas-tools and cfacter 3.11.0 on ubuntu-20.04 i can have the augeas fact.
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 changed the behaviour as follows:
1st: check if the path from puppet-agent's augparse
exists and is readable; If not
2st: call 'augparse' without path and hope it is in path; If this command returns empty string
3rd: try requiring augeas gem and calling Augeas cli method to determine it's version.
So if augeas is present on the system, facter will determine it's version, even if it isn't in path or if it was installed manually and not shipped in puppet-agent context.
CLA signed by all contributors. |
@@ -4,9 +4,11 @@ | |||
subject(:augeas) { Facter::Resolvers::Augeas } | |||
|
|||
let(:log_spy) { instance_spy(Facter::Log) } | |||
let(:executable?) { false } |
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.
usually variables do not have ?
in name, that is a convention only for boolean methods
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.
changed
Description of the problem: On unix like systems and linux operating systems, the call:
::Augeas.open
is very time consuming. Alsoaugparse
command is not found because the puppet directories are not in path.Description of the fix: On unix like and linux systems, call augparse with the full path and avoid calling the method
::Augeas.open
.Note: Augeas is shipped in puppet-agent packages except Windows ones (that's is why this change is not affecting Windows behaviour)