saz/puppet-sudo

Facter error on Windows

jovandeginste opened this issue ยท 3 comments

First, thanks for all your work on the puppet modules! I use some of them, and appreciate it! I hope I have contributed to your projects at some point, but I'm not sure ๐Ÿ˜„

I run into a weird minor issue. I'm using the same Puppet stack to configure all my home devices, including my Windows gaming laptop. I'm a strange person, maybe. I'm also using this module.

While the module is not included on the Windows devices, the facts are added automatically.

My gaming laptop happens to have a utility called "sudo" which basically wraps whatever is "sudo" in Windows land. That utility does not have the -V parameter.

So now, this module throws an error:

Error: Facter: error while resolving custom fact "sudoversion": undefined method `[]' for nil:NilClass

There are many ways to solve this, but I see two ways this can be properly solved inside the sudo module:

  1. add a confine statement to the fact, so it doesn't run on Windows
  2. add some simple error handling at this line

I'm willing to create a PR solving this in one of the above ways, but would like feedback first!

Thanks!

saz commented

First: Thanks! ๐Ÿ˜„

I'd prefer the confine, as the fact shouldn't be running on Windows at all.
I'm happy of a PR!

Please find my PR; wondering about the CI tests, however ...

saz commented

@jovandeginste This issue should be resolved in master. Please give it a try.