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

Ticket/MODULES-2478 Make root_home fact work on AIX using native lsuser command #515

Conversation

jfautley
Copy link
Contributor

The root_home fact returns nil on AIX due to the operating system not providing getent. The recommended replacement for this is the 'lsuser' command.

This PR adds a new fact, confined to kernel=>aix to use libuser to return root's configured home directory.

setcode do
str = Facter::Util::Resolution.exec("lsuser -C -a home root")
str && str.split("\n").each do |line|
next if line =~ /#/
Copy link
Contributor

Choose a reason for hiding this comment

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

Given your example, this should probably be matching /^#/ ? Not that I expect any sane person to have a hash in its root directory ...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good spot, done, thanks.

@DavidS
Copy link
Contributor

DavidS commented Aug 28, 2015

Hi Jon, thanks for your contribution! If you could squash that into a single commit, it would be grand to keep the git history clean.

Cheers, David

See https://git-scm.com/book/en/v2/Git-Tools-Rewriting-History#Squashing-Commits

Squashed, and amended test for comment lines.
@jfautley jfautley force-pushed the ticket/MODULES-2478-support_root_home_fact_on_AIX branch from ac82828 to 6c2a003 Compare August 28, 2015 14:21
@jfautley
Copy link
Contributor Author

Commits squashed into one, and comment-line match fixed.

DavidS added a commit that referenced this pull request Sep 1, 2015
…t_home_fact_on_AIX

(MODULES-2478) Make root_home fact work on AIX using native lsuser command
@DavidS DavidS merged commit 9352db7 into puppetlabs:master Sep 1, 2015
@DavidS
Copy link
Contributor

DavidS commented Sep 1, 2015

Thank you for your contribution!

@jfautley jfautley deleted the ticket/MODULES-2478-support_root_home_fact_on_AIX branch September 1, 2015 09:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants