Problem by calling puppet script on LINUX

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Problem by calling puppet script on LINUX

Wei Chen
Hi,

I created a job in Jenkins which will start the puppet agent with command:
puppet agent -t

This command works fine under LINUX.

But as I build the job in Jenkins I got following errors:
...
Started by user anonymous
Building in workspace /var/lib/jenkins/jobs/TestPuppet/workspace
[workspace] $ /bin/sh -xe /tmp/hudson50649338283499454.sh
+ puppet agent -t
 [1;35merr: /File[/home/jenkins/.puppet]/ensure: change from absent to directory failed: Cannot create /home/jenkins/.puppet; parent directory /home/jenkins does not exist [0m
 [0;36mnotice: /File[/home/jenkins/.puppet/ssl]: Dependency File[/home/jenkins/.puppet] has failures: true [0m
 [0;33mwarning: /File[/home/jenkins/.puppet/ssl]: Skipping because of failed dependencies [0m
 [0;36mnotice: /File[/home/jenkins/.puppet/ssl/private]: Dependency File[/home/jenkins/.puppet] has failures: true [0m
 [0;33mwarning: /File[/home/jenkins/.puppet/ssl/private]: Skipping because of failed dependencies [0m
 [0;36mnotice: /File[/home/jenkins/.puppet/ssl/certificate_requests]: Dependency File[/home/jenkins/.puppet] has failures: true [0m
 [0;33mwarning: /File[/home/jenkins/.puppet/ssl/certificate_requests]: Skipping because of failed dependencies [0m
 [0;36mnotice: /File[/home/jenkins/.puppet/var]: Dependency File[/home/jenkins/.puppet] has failures: true [0m
 [0;33mwarning: /File[/home/jenkins/.puppet/var]: Skipping because of failed dependencies [0m
 [0;36mnotice: /File[/home/jenkins/.puppet/var/log]: Dependency File[/home/jenkins/.puppet] has failures: true [0m
 [0;33mwarning: /File[/home/jenkins/.puppet/var/log]: Skipping because of failed dependencies [0m
 [0;36mnotice: /File[/home/jenkins/.puppet/var/facts]: Dependency File[/home/jenkins/.puppet] has failures: true [0m
 [0;33mwarning: /File[/home/jenkins/.puppet/var/facts]: Skipping because of failed dependencies [0m
 [0;36mnotice: /File[/home/jenkins/.puppet/var/clientbucket]: Dependency File[/home/jenkins/.puppet] has failures: true [0m
 [0;33mwarning: /File[/home/jenkins/.puppet/var/clientbucket]: Skipping because of failed dependencies [0m
 [0;36mnotice: /File[/home/jenkins/.puppet/var/state]: Dependency File[/home/jenkins/.puppet] has failures: true [0m
 [0;33mwarning: /File[/home/jenkins/.puppet/var/state]: Skipping because of failed dependencies [0m
 [0;36mnotice: /File[/home/jenkins/.puppet/var/state/graphs]: Dependency File[/home/jenkins/.puppet] has failures: true [0m
 [0;33mwarning: /File[/home/jenkins/.puppet/var/state/graphs]: Skipping because of failed dependencies [0m
 [0;36mnotice: /File[/home/jenkins/.puppet/var/lib]: Dependency File[/home/jenkins/.puppet] has failures: true [0m
 [0;33mwarning: /File[/home/jenkins/.puppet/var/lib]: Skipping because of failed dependencies [0m
 [0;36mnotice: /File[/home/jenkins/.puppet/var/client_data]: Dependency File[/home/jenkins/.puppet] has failures: true [0m
 [0;33mwarning: /File[/home/jenkins/.puppet/var/client_data]: Skipping because of failed dependencies [0m
 [0;36mnotice: /File[/home/jenkins/.puppet/ssl/private_keys]: Dependency File[/home/jenkins/.puppet] has failures: true [0m
 [0;33mwarning: /File[/home/jenkins/.puppet/ssl/private_keys]: Skipping because of failed dependencies [0m
 [0;36mnotice: /File[/home/jenkins/.puppet/var/client_yaml]: Dependency File[/home/jenkins/.puppet] has failures: true [0m
 [0;33mwarning: /File[/home/jenkins/.puppet/var/client_yaml]: Skipping because of failed dependencies [0m
 [0;36mnotice: /File[/home/jenkins/.puppet/var/run]: Dependency File[/home/jenkins/.puppet] has failures: true [0m
 [0;33mwarning: /File[/home/jenkins/.puppet/var/run]: Skipping because of failed dependencies [0m
 [0;36mnotice: /File[/home/jenkins/.puppet/ssl/public_keys]: Dependency File[/home/jenkins/.puppet] has failures: true [0m
 [0;33mwarning: /File[/home/jenkins/.puppet/ssl/public_keys]: Skipping because of failed dependencies [0m
 [0;36mnotice: /File[/home/jenkins/.puppet/ssl/certs]: Dependency File[/home/jenkins/.puppet] has failures: true [0m
 [0;33mwarning: /File[/home/jenkins/.puppet/ssl/certs]: Skipping because of failed dependencies [0m
Could not prepare for execution: Got 1 failure(s) while initializing: change from absent to directory failed: Cannot create /home/jenkins/.puppet; parent directory /home/jenkins does not exist
Build step 'Execute shell' marked build as failure
Finished: FAILURE




Can someone help?


Regards

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/8019b8f0-bcdd-486d-a3f7-457efdca0589%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Problem by calling puppet script on LINUX

Dirk Heinrichs
Am 29.10.2015 um 14:41 schrieb Wei Chen:
[workspace] $ /bin/sh -xe /tmp/hudson50649338283499454.sh
+ puppet agent -t
 [1;35merr: /File[/home/jenkins/.puppet]/ensure: change from absent to directory failed: Cannot create /home/jenkins/.puppet; parent directory /home/jenkins does not exist [0m

If the puppet agent doesn't run as root, it creates a data folder under $HOME/.puppet. If $HOME doesn't exist, .puppet can't be created.

However, it doesn't make much sense to run the puppet agent as non-root user (it won't be able to install any package, for example), so what you would likely want to do is setup sudo so that the user "jenkins" can execute "puppet agent -t" (and only this) as root w/o providing a password, then call "sudo puppet agent -t".

See "man sudoers" for details.

HTH...

    Dirk
--

Dirk Heinrichs, Senior Systems Engineer, Engineering Solutions
Recommind GmbH, Von-Liebig-Straße 1, 53359 Rheinbach
Tel: +49 2226 1596666 (Ansage) 1149
Email: [hidden email]
Skype: dirk.heinrichs.recommind
www.recommind.com

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/563226F5.1080005%40recommind.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Problem by calling puppet script on LINUX

R. Tyler Croy
In reply to this post by Wei Chen
(replies inline)

On Thu, 29 Oct 2015, Wei Chen wrote:

> Hi,
>
> I created a job in Jenkins which will start the puppet agent with command:
> puppet agent -t
>
>
> Could not prepare for execution: Got 1 failure(s) while initializing: change from absent to directory failed: Cannot create /home/jenkins/.puppet; parent directory /home/jenkins does not exist
> Build step 'Execute shell' marked build as failure
> Finished: FAILURE


This looks to me to definitely be a Puppet code problem, since the following
code will not recursively create a directory:

    file { '/foo/bar': ensure => directory; }



- R. Tyler Croy

------------------------------------------------------
     Code: <https://github.com/rtyler>
  Chatter: <https://twitter.com/agentdero>

  % gpg --keyserver keys.gnupg.net --recv-key 3F51E16F
------------------------------------------------------

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/20151029140349.GC2450%40blackberry.coupleofllamas.com.
For more options, visit https://groups.google.com/d/optout.

signature.asc (188 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Problem by calling puppet script on LINUX

Dirk Heinrichs
Am 29.10.2015 um 15:03 schrieb R. Tyler Croy:

This looks to me to definitely be a Puppet code problem,

Nope. It's a problem of running "puppet agent" as non-root user w/o existing $HOME for that user.

Bye...

    Dirk
--

Dirk Heinrichs, Senior Systems Engineer, Engineering Solutions
Recommind GmbH, Von-Liebig-Straße 1, 53359 Rheinbach
Tel: +49 2226 1596666 (Ansage) 1149
Email: [hidden email]
Skype: dirk.heinrichs.recommind
www.recommind.com

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/563228B1.6090804%40recommind.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Problem by calling puppet script on LINUX

R. Tyler Croy
(replies inline)

On Thu, 29 Oct 2015, Dirk Heinrichs wrote:

> Am 29.10.2015 um 15:03 schrieb R. Tyler Croy:
>
> > This looks to me to definitely be a Puppet code problem,
>
> Nope. It's a problem of running "puppet agent" as non-root user w/o
> existing $HOME for that user.


Yeah, I saw your message after I sent mine. Interesting! I've never seen that
error in my own puppet agents before, must be lucky I guess :)


>

- R. Tyler Croy

------------------------------------------------------
     Code: <https://github.com/rtyler>
  Chatter: <https://twitter.com/agentdero>

  % gpg --keyserver keys.gnupg.net --recv-key 3F51E16F
------------------------------------------------------

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/20151029142227.GD2450%40blackberry.coupleofllamas.com.
For more options, visit https://groups.google.com/d/optout.

signature.asc (188 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Problem by calling puppet script on LINUX

Felipe Grucci
In reply to this post by Wei Chen
I have the same error, but when I run the "puppet agent -t" command with a Jenkins job in a Windows environment

In Jenkins I have a Job with Powershell scripts that calls the PUPPET AGENT -T

Thanks in Advanced

Em quinta-feira, 29 de outubro de 2015 11:41:47 UTC-2, Wei Chen escreveu:
Hi,

I created a job in Jenkins which will start the puppet agent with command:
puppet agent -t

This command works fine under LINUX.

But as I build the job in Jenkins I got following errors:
...
Started by user <a href="http://172.23.17.40:8080/user/null" style="word-wrap:break-word;text-decoration:underline;color:rgb(92,53,102)" target="_blank" rel="nofollow" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2F172.23.17.40%3A8080%2Fuser%2Fnull\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHcMdO9VIHqT2uEbyJ3Q_kQ7FsD8A&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2F172.23.17.40%3A8080%2Fuser%2Fnull\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHcMdO9VIHqT2uEbyJ3Q_kQ7FsD8A&#39;;return true;">anonymous
Building in workspace /var/lib/jenkins/jobs/TestPuppet/workspace
[workspace] $ /bin/sh -xe /tmp/hudson50649338283499454.sh
+ puppet agent -t
 [1;35merr: /File[/home/jenkins/.puppet]/ensure: change from absent to directory failed: Cannot create /home/jenkins/.puppet; parent directory /home/jenkins does not exist [0m
 [0;36mnotice: /File[/home/jenkins/.puppet/ssl]: Dependency File[/home/jenkins/.puppet] has failures: true [0m
 [0;33mwarning: /File[/home/jenkins/.puppet/ssl]: Skipping because of failed dependencies [0m
 [0;36mnotice: /File[/home/jenkins/.puppet/ssl/private]: Dependency File[/home/jenkins/.puppet] has failures: true [0m
 [0;33mwarning: /File[/home/jenkins/.puppet/ssl/private]: Skipping because of failed dependencies [0m
 [0;36mnotice: /File[/home/jenkins/.puppet/ssl/certificate_requests]: Dependency File[/home/jenkins/.puppet] has failures: true [0m
 [0;33mwarning: /File[/home/jenkins/.puppet/ssl/certificate_requests]: Skipping because of failed dependencies [0m
 [0;36mnotice: /File[/home/jenkins/.puppet/var]: Dependency File[/home/jenkins/.puppet] has failures: true [0m
 [0;33mwarning: /File[/home/jenkins/.puppet/var]: Skipping because of failed dependencies [0m
 [0;36mnotice: /File[/home/jenkins/.puppet/var/log]: Dependency File[/home/jenkins/.puppet] has failures: true [0m
 [0;33mwarning: /File[/home/jenkins/.puppet/var/log]: Skipping because of failed dependencies [0m
 [0;36mnotice: /File[/home/jenkins/.puppet/var/facts]: Dependency File[/home/jenkins/.puppet] has failures: true [0m
 [0;33mwarning: /File[/home/jenkins/.puppet/var/facts]: Skipping because of failed dependencies [0m
 [0;36mnotice: /File[/home/jenkins/.puppet/var/clientbucket]: Dependency File[/home/jenkins/.puppet] has failures: true [0m
 [0;33mwarning: /File[/home/jenkins/.puppet/var/clientbucket]: Skipping because of failed dependencies [0m
 [0;36mnotice: /File[/home/jenkins/.puppet/var/state]: Dependency File[/home/jenkins/.puppet] has failures: true [0m
 [0;33mwarning: /File[/home/jenkins/.puppet/var/state]: Skipping because of failed dependencies [0m
 [0;36mnotice: /File[/home/jenkins/.puppet/var/state/graphs]: Dependency File[/home/jenkins/.puppet] has failures: true [0m
 [0;33mwarning: /File[/home/jenkins/.puppet/var/state/graphs]: Skipping because of failed dependencies [0m
 [0;36mnotice: /File[/home/jenkins/.puppet/var/lib]: Dependency File[/home/jenkins/.puppet] has failures: true [0m
 [0;33mwarning: /File[/home/jenkins/.puppet/var/lib]: Skipping because of failed dependencies [0m
 [0;36mnotice: /File[/home/jenkins/.puppet/var/client_data]: Dependency File[/home/jenkins/.puppet] has failures: true [0m
 [0;33mwarning: /File[/home/jenkins/.puppet/var/client_data]: Skipping because of failed dependencies [0m
 [0;36mnotice: /File[/home/jenkins/.puppet/ssl/private_keys]: Dependency File[/home/jenkins/.puppet] has failures: true [0m
 [0;33mwarning: /File[/home/jenkins/.puppet/ssl/private_keys]: Skipping because of failed dependencies [0m
 [0;36mnotice: /File[/home/jenkins/.puppet/var/client_yaml]: Dependency File[/home/jenkins/.puppet] has failures: true [0m
 [0;33mwarning: /File[/home/jenkins/.puppet/var/client_yaml]: Skipping because of failed dependencies [0m
 [0;36mnotice: /File[/home/jenkins/.puppet/var/run]: Dependency File[/home/jenkins/.puppet] has failures: true [0m
 [0;33mwarning: /File[/home/jenkins/.puppet/var/run]: Skipping because of failed dependencies [0m
 [0;36mnotice: /File[/home/jenkins/.puppet/ssl/public_keys]: Dependency File[/home/jenkins/.puppet] has failures: true [0m
 [0;33mwarning: /File[/home/jenkins/.puppet/ssl/public_keys]: Skipping because of failed dependencies [0m
 [0;36mnotice: /File[/home/jenkins/.puppet/ssl/certs]: Dependency File[/home/jenkins/.puppet] has failures: true [0m
 [0;33mwarning: /File[/home/jenkins/.puppet/ssl/certs]: Skipping because of failed dependencies [0m
Could not prepare for execution: Got 1 failure(s) while initializing: change from absent to directory failed: Cannot create /home/jenkins/.puppet; parent directory /home/jenkins does not exist
Build step 'Execute shell' marked build as failure
Finished: FAILURE




Can someone help?


Regards

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/60422f5c-0872-487b-aa1b-5c2e56693fdf%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.