Jira (PUP-9786) Compiling catalog for AIX actually executes commands when managing users with group

5 views
Skip to first unread message

Dylan Ratcliffe (JIRA)

unread,
Jun 19, 2019, 10:41:03 AM6/19/19
to puppe...@googlegroups.com
Dylan Ratcliffe created an issue
 
Puppet / Bug PUP-9786
Compiling catalog for AIX actually executes commands when managing users with group
Issue Type: Bug Bug
Affects Versions: PUP 6.4.2
Assignee: Unassigned
Components: Types and Providers
Created: 2019/06/19 7:40 AM
Priority: Normal Normal
Reporter: Dylan Ratcliffe

Puppet Version: 6.4.2
Puppet Server Version: N/A
OS Name/Version: AIX (any)

When compiling a catalog for AIX, the user type causes the provider to actually execute commands using Puppet::Util::Execution.execute(). This is fine because they don't do anything and the catalog compiles fine anyway. However when we run tests on Windows with rspec-puppet, because it's pretending to be UNIX, the null_file is set to /dev/null https://github.com/puppetlabs/puppet/blob/3f7a06c50a8707811387dd60a6f7f26d94b606f4/lib/puppet/util/execution.rb#L191 and therefore ruby actually tries to read it, causing the catalog to fail with the following error:

No such file or directory @ rb_sysopen - /dev/null

This essentially means that it's impossible to test code destined for AIX on Windows if it includes a user resource that is managing groups (It's group management that causes this)

This can be proven by putting a 'pry' into the above file and running any test that involves the following puppet code:
 

user { 'foo':
  ensure => present,
  groups => ['test'],
}

You will see that it actually calls out and executes some commands, which it definitely shouldn't be doing as part of catalog compilation.

 

Add Comment Add Comment
 
This message was sent by Atlassian JIRA (v7.7.1#77002-sha1:e75ca93)
Atlassian logo

Josh Cooper (JIRA)

unread,
Jun 19, 2019, 1:49:02 PM6/19/19
to puppe...@googlegroups.com
Josh Cooper commented on Bug PUP-9786
 
Re: Compiling catalog for AIX actually executes commands when managing users with group

The error you are seeing is because rspec_puppet does more than compile a catalog. It transforms the server catalog produced by the compiler into a RAL (agent) catalog. That process triggers all of the validation, munge, provider selection that normally occurs on the agent. So it's not unexpected to see provider code being executed in rspec-puppet. This is a fundamental problem with puppet's type and provider system, which rspec-puppet attempt to paper over. You'll probably need to update rspec-puppet or your tests to stub out `Puppet::Util::Execution.execute`.

Dylan Ratcliffe (JIRA)

unread,
Jun 19, 2019, 2:45:03 PM6/19/19
to puppe...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages