Bug #430

require user being ignored

Added by Redmine Admin about 5 years ago. Updated almost 5 years ago.

Status:Closed Start date:
Priority:Normal Due date:
Assignee:Luke Kanies % Done:

0%

Category:exec
Target version:0.25.0
Affected Puppet version:0.25.4 Branch:
Keywords:
Votes: 0

Description

An exec object is used in order to call a shell script which needs to by run by a particular user. Although the user’s existence has been added as a dependency, puppet errors, see below for detailed description. If the user is set to root, or the required user is created by hand, it works. I would expect puppet to work out the dependency and add the user before proceeding.

The same behaviour on both 0.22.0 and 0.20.1

“Could not create /opt/foglight/script/setup.sh: No such user foglight at /etc/puppet/manifests/classes/foglight.pp:170”

Exec object code:

161         exec { "/opt/foglight/script/setup.sh":
162                 user => "foglight",
163                 cwd => "/opt/foglight/script",
164                 command => "/opt/foglight/script/setup.sh",
165                 refreshonly => true,
166                 require => [
167                         USER[[foglight]],
168                         FILE[[optfoglightscriptsetupsh]]
169                 ],
170         }

The error message continues: Jan 12 17:14:42 puptst04 puppetdr3443: Starting configuration run Jan 12 17:14:42 puptst04 puppetdr3443: Could not apply complete configuration: Could not retrieve dependency ‘Exec[/opt/foglight/script/setup.sh]’ at /etc/puppet/manifests/functions/common.pp:264

relevant code snippet from the function:

258         case "$agent_config" {
259 
260                 "true": {
261 
262                         remotefile { "$scriptdir/agents.config/$bind_name":
263                                 mode => 0755,
264                                 owner => foglight,
265                                 group => foglight,
266                                 source => "common$scriptdir/agents.config/$bind_name",
267                                 path => "$scriptdir/agents.config/$bind_name",
268                                 require => [
269                                         FILE[[$scriptdiragentsconfig]],
270                                         USER[[foglight]]
271                                 ],
272                                 before => EXEC[[$scriptdirsetupsh]],
273                                 backup => false
274                         }
275                 }
276 
277                 default: {
278 
279                 }
280 
281         }

History

Updated by Luke Kanies about 5 years ago

  • Status changed from 1 to Closed
  • 7 set to invalid

I think this is a misconfiguration, not a bug. You have to specify the user in your configuration; Puppet will not just automatically create a user that you specify as a dependency. From what I can tell, your configuration does not specify how to create the user, and therefore you can not use it as a dependency.

Updated by Redmine Admin about 5 years ago

  • Status changed from Closed to 4
  • 7 deleted (invalid)

The user is specified in a different part of the configuration along with the correct group for the user, and this should have perhaps been included with the original bug report, I’ve included the decleration here :

    user { foglight:
        name    => "foglight",
        comment => "foglight",
        home    => "/opt/foglight",
        uid     => 604,
        gid     => "foglight",
        groups  => [[staff]],
        shell   => "/bin/bash",
        ensure  => present,
    }

So, puppet should hopefully know about this user, and theoretically have created it, prior to performing the exec above.

Updated by Luke Kanies almost 5 years ago

Duh. There’s no autorequire being set up from the exec to the user. That’s silly and should be easy to fix.

Updated by Luke Kanies almost 5 years ago

  • Status changed from 4 to Closed
  • 7 set to fixed

Fixed in r2442.

Also available in: Atom PDF