Re: [Puppet Users] foreman exec node.rb turn out: No such file or directory

2015-12-15 Thread Martin Alfke

On 15 Dec 2015, at 07:33, 辛建国  wrote:

> hi,when I exec "sudo -u puppet  /etc/puppet/node.rb puppet.server.com" 
> command on puppet server ~ it turned out that ": No such file or directory", 
> but when I run "sudo -u puppet  ruby /etc/puppet/node.rb puppet.server.com" 
> command on puppet server,it works fine. how do I resolve it? 

The command (/etc/puppet/node.rb) needs to be executable if you want to run it 
directly.
What does your puppet.conf file on the master has configured in external_nodes 
setting?


-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/87C5BF20-3553-4B57-BA52-E1B5D6011E6E%40gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Puppet Users] Re: How to include quoted string into a command

2015-12-15 Thread Vadym Chepkov


On Tuesday, December 15, 2015 at 5:48:36 PM UTC-5, Josh Cooper wrote:
>
>
> Puppet is interpreting \` as an escape sequence since it's in a 
> double-quoted string, and reporting that it's an invalid escape sequence. I 
> think you'll need to escape the backslash:
>
> $string="/var/log/syslog -C 8 -a 'kill -HUP \\`cat /var/run/syslog.pid\\`'"
>  
>

Bingo! Thank you very much
 

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/d176a1c9-0310-420d-858c-60a992d3faeb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Puppet Users] Logging output of a long running exec

2015-12-15 Thread Dayton Jones
Ah no...not in this case.  I need to see the output of the script in the 
puppet log/on screen so immediate action (if any) can be taken care of... 

I'm wondering (though I haven't been able to corroborate) if there is a 
buffer limit for the exec function and the script is just spewing too much 
for puppet to capture... 

On Tuesday, December 15, 2015 at 12:16:04 PM UTC-6, Steve Traylen wrote:
>
> In this case the screen session stays forever and you can connect to it 
> later to see the output. That may or may not be useful to you of course 
> ---
> Steve Traylen
>
> *From:* Dayton Jones >
> *Sent:* 15 Dec 2015 1:02 pm
> *To:* Puppet Users
> *Subject:* Re: [Puppet Users] Logging output of a long running exec
>
> Does that show the output during the puppet run though?  I "need" to have 
> the output of the script show up, hence the "logoutput => true" directive 
> which I don't see in your example.  The script runs just fine, I just don't 
> get any output/status from it when run via puppet.  
>
> On Tuesday, December 15, 2015 at 3:56:14 AM UTC-6, Steve Traylen wrote: 
>>
>> Example of long exec running backgrounded in a screen.
>>
>> exec { 'zrep_initial_sync': 
>> command => "screen -dmS zrep_initial_sync /usr/local/sbin/krb_me.sh 
>> /usr/local/sbin/zrep init ${src_vol} ${dst_host} ${dst_vol}", onlyif => 
>> "zfs get -H zrep:src-fs -o value ${src_vol} | grep -qv ${src_vol}", path => 
>> ['/bin/', '/sbin/' , '/usr/bin/', '/usr/sbin/', '/usr/local/bin', 
>> '/usr/local/sbin'], }
>> Sent from Nine 
>>
>> *From:* Dayton Jones 
>> *Sent:* 11 Dec 2015 9:45 pm
>> *To:* Puppet Users
>> *Subject:* [Puppet Users] Logging output of a long running exec
>>
>> I have a legacy "provisioning" script that I'm calling with puppet on 
>> brand new machines (I'm slowly taking the functionality out of the script 
>> and into puppet, but for reasons I can't do a full replacement yet) 
>>
>> I'd like to log the output of the provisioning and have included 
>> "logoutput" to the exec in the class (see below) but when I run puppet all 
>> I get for the module/class is:
>>
>> Warning: Waiting for output; will sleep 0.0 seconds
>>
>> Warning: Waiting for output; will sleep 0.5 seconds
>>
>> Warning: Could not get output
>>
>> Notice: /Stage[post]/provision/Exec[provision.sh]/returns: executed 
>> successfully
>>
>> Notice: Finished catalog run in 107.80 seconds
>>
>>
>>
>> Here is the class and exec... I'm setting a timeout of 1800 and if the 
>> catalog run finishes in 107 seconds, I'm unclear on how it's timing out. 
>>  Any suggestions?
>>
>> class provision { 
>>
>>
>>   notify {'Running provision.sh can take a while - be patient':}
>>
>>
>>   file { '/root/provision.sh' :
>>
>> ensure => file,
>>
>> owner  => 'root',
>>
>> group  => 'root',
>>
>> mode   => '0755',
>>
>> source => 'puppet:///modules/provision/provision.sh',
>>
>> notify => Exec['provision.sh'],
>>
>>   }
>>
>>
>>   exec { 'provision.sh' :
>>
>> command   => '/root/provision.sh',
>>
>> logoutput => true,
>>
>> timeout   => 1800,
>>
>> cwd   => '/root';
>>
>>   }
>>
>> }
>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Puppet Users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to puppet-users...@googlegroups.com.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/puppet-users/1a15177f-e0f1-4d1b-8c87-5f7b47d7dede%40googlegroups.com
>>  
>> 
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>> -- 
> You received this message because you are subscribed to the Google Groups 
> "Puppet Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to puppet-users...@googlegroups.com .
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/puppet-users/8dc78f95-4c00-4693-b659-9cdad3dc9ade%40googlegroups.com
>  
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/afe78121-e297-4f69-8a05-f8a45f5189d8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Puppet Users] Re: How to include quoted string into a command

2015-12-15 Thread Josh Cooper
On Tue, Dec 15, 2015 at 10:20 AM, Vadym Chepkov  wrote:

> Shell allows me to escape back-tick:
>
> $ echo "/var/log/syslog -C 8 -a 'kill -HUP \`cat /var/run/syslog.pid\`'"
> /var/log/syslog -C 8 -a 'kill -HUP `cat /var/run/syslog.pid`'
>
> puppet does like them:
>
> $string="/var/log/syslog -C 8 -a 'kill -HUP \`cat /var/run/syslog.pid\`'"
>

Puppet is interpreting \` as an escape sequence since it's in a
double-quoted string, and reporting that it's an invalid escape sequence. I
think you'll need to escape the backslash:

$string="/var/log/syslog -C 8 -a 'kill -HUP \\`cat /var/run/syslog.pid\\`'"


>
> exec{'echo string':
>   command   => "echo \" ${string} \" ",
>   logoutput => true,
>   path  => '/bin:/usr/bin',
> }
>
> Warning: Unrecognised escape sequence '\`' in file /home/vc7733/quotes.pp
> at line 1
> Warning: Unrecognised escape sequence '\`' in file /home/vc7733/quotes.pp
> at line 1
> Notice: Compiled catalog for pubdevx-dev601.bnaint.com in environment
> production in 0.36 seconds
> Notice: /Stage[main]/Main/Exec[echo string]/returns:  /var/log/syslog -C 8
> -a 'kill -HUP `cat /var/run/syslog.pid`'
>
> And as I said earlier, no, I can't use file_line
>
> Thanks,
> Vadym
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Puppet Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to puppet-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/puppet-users/aee7a6c5-307f-4b55-87ac-85f205724ff4%40googlegroups.com
> 
> .
>
> For more options, visit https://groups.google.com/d/optout.
>

-- 
Josh Cooper
Developer, Puppet Labs

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/CA%2Bu97ungmrJ3rnzt3296Pfz0SVu-nXbMYOootVLkeCQfd5jXCg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


[Puppet Users] Re: How to include quoted string into a command

2015-12-15 Thread Vadym Chepkov
Shell allows me to escape back-tick:

$ echo "/var/log/syslog -C 8 -a 'kill -HUP \`cat /var/run/syslog.pid\`'"
/var/log/syslog -C 8 -a 'kill -HUP `cat /var/run/syslog.pid`'

puppet does like them:

$string="/var/log/syslog -C 8 -a 'kill -HUP \`cat /var/run/syslog.pid\`'"

exec{'echo string':
  command   => "echo \" ${string} \" ",
  logoutput => true,
  path  => '/bin:/usr/bin',
}

Warning: Unrecognised escape sequence '\`' in file /home/vc7733/quotes.pp 
at line 1
Warning: Unrecognised escape sequence '\`' in file /home/vc7733/quotes.pp 
at line 1
Notice: Compiled catalog for pubdevx-dev601.bnaint.com in environment 
production in 0.36 seconds
Notice: /Stage[main]/Main/Exec[echo string]/returns:  /var/log/syslog -C 8 
-a 'kill -HUP `cat /var/run/syslog.pid`' 

And as I said earlier, no, I can't use file_line

Thanks,
Vadym


-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/aee7a6c5-307f-4b55-87ac-85f205724ff4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[Puppet Users] rspec-puppet 2.3.0 released

2015-12-15 Thread David Schmitt

Hi *,

I'm very happy to announce a new release of rspec-puppet, the unit test 
framework for puppet manifests:



Rspec-puppet 2.3.0 now supports testing custom types, `:undef` values in 
params, structured facts, and checks resource dependencies recursively.


The settings in `module_path` and `manifest` are now respected 
throughout the code base. The former default for `module_path` 
(`'/etc/puppet/modules'`) was dropped to avoid accidentally poisoning 
the test environment with unrelated code.


To reduce the maintenance overhead of boilerplate code, rspec-puppet now 
provides some of the code that rspec-puppet-init deployed in helper 
files that you can just `require` instead.


This release also reduces memory usage on bigger testsuites drastically 
by reducing the caching of compiled catalogs.


### Changed
- Limit the catalogue cache to 16 entries. Significant memory savings 
and reduced runtime were observed in testing this.

- Prevent Puppet 3's \_timestamp fact from invalidating cache.
- Extracted catalog cache from RSpec::Puppet::Support.
- Updated README to use the rspec 3 syntax, and additional explanations.
- `contain_file(...).with_content(...)` will now only show the diff and 
not the full contents of the file.


### Added
- Custom type testing example group and matcher.
- before/require/subscribe/notify checking now searches recursively 
through all dependencies. `File[a] -> File[b] -> File[c]` is now matched 
by `contain_file('a').that_comes_before('File[c]')`, whereas earlier 
versions would have missed that.
- `let(:params)` now allows `:undef` to pass a literal undef value 
through to the subject.

- Support structured facts with keys as symbols or strings (\#295).
- rspec-puppet-init now creates smaller files, using rspec-puppet 
helpers, instead of pasting code into the module.

- Added a list of related projects to the README.

### Fixed
- Fix #276: `compile.and_raise_error` now correctly considers successful 
compilation an error
- Puppet's `modulepath` can now contain multiple entries and 
rspec-puppet will configure puppet to load code from all of them

- Support running with rspec 2.99 again
- non-class resources are now covered by the coverage code
- Fix #323/MODULES-2374: autorequires checking doesn't abort on 
"undefined method \`[]' for nil:NilClass"

- improved documentation for hiera integration, added example spec
- document the `scope` property

### Credits

Thanks to Adrien Thebo, Alex Harvey, Brian, Dan Bode, Dominic Cleal, 
Javier Palacios, Jeff McCune, Jordan Moldow, Peter van Zetten, Raphaël 
Pinson, Simon Kohlmeyer, and Tristan Colgate for their contributions to 
this release.


  -- David Schmitt

--
You received this message because you are subscribed to the Google Groups "Puppet 
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/567057FF.9020309%40puppetlabs.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Puppet Users] Logging output of a long running exec

2015-12-15 Thread Steve Traylen
In this case the screen session stays forever and you can connect to it later 
to see the output. That may or may not be useful to you of course

---
Steve Traylen

From: Dayton Jones 
Sent: 15 Dec 2015 1:02 pm
To: Puppet Users
Subject: Re: [Puppet Users] Logging output of a long running exec

Does that show the output during the puppet run though?  I "need" to have the 
output of the script show up, hence the "logoutput => true" directive which I 
don't see in your example.  The script runs just fine, I just don't get any 
output/status from it when run via puppet.

On Tuesday, December 15, 2015 at 3:56:14 AM UTC-6, Steve Traylen wrote:

Example of long exec running backgrounded in a screen.

exec { 'zrep_initial_sync':
command => "screen -dmS zrep_initial_sync /usr/local/sbin/krb_me.sh 
/usr/local/sbin/zrep init ${src_vol} ${dst_host} ${dst_vol}", onlyif => "zfs 
get -H zrep:src-fs -o value ${src_vol} | grep -qv ${src_vol}", path => 
['/bin/', '/sbin/' , '/usr/bin/', '/usr/sbin/', '/usr/local/bin', 
'/usr/local/sbin'], }

Sent from Nine

From: Dayton Jones 
Sent: 11 Dec 2015 9:45 pm
To: Puppet Users
Subject: [Puppet Users] Logging output of a long running exec

I have a legacy "provisioning" script that I'm calling with puppet on brand new 
machines (I'm slowly taking the functionality out of the script and into 
puppet, but for reasons I can't do a full replacement yet)

I'd like to log the output of the provisioning and have included "logoutput" to 
the exec in the class (see below) but when I run puppet all I get for the 
module/class is:
Warning: Waiting for output; will sleep 0.0 seconds
Warning: Waiting for output; will sleep 0.5 seconds
Warning: Could not get output
Notice: /Stage[post]/provision/Exec[provision.sh]/returns: executed successfully
Notice: Finished catalog run in 107.80 seconds


Here is the class and exec... I'm setting a timeout of 1800 and if the catalog 
run finishes in 107 seconds, I'm unclear on how it's timing out.  Any 
suggestions?

class provision {

  notify {'Running provision.sh can take a while - be patient':}

  file { '/root/provision.sh' :
ensure => file,
owner  => 'root',
group  => 'root',
mode   => '0755',
source => 'puppet:///modules/provision/provision.sh',
notify => Exec['provision.sh'],
  }

  exec { 'provision.sh' :
command   => '/root/provision.sh',
logoutput => true,
timeout   => 1800,
cwd   => '/root';
  }
}

--
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/1a15177f-e0f1-4d1b-8c87-5f7b47d7dede%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to 
puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/8dc78f95-4c00-4693-b659-9cdad3dc9ade%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/3b2119b0-8647-4b84-b35d-cd4ade8d47b6%40cern.ch.
For more options, visit https://groups.google.com/d/optout.


[Puppet Users] Re: Hitting the wall while trying my hand at subclasses and parameters

2015-12-15 Thread jcbollinger


On Monday, December 14, 2015 at 9:42:53 AM UTC-6, Jean-Francois Gratton 
wrote:
>
> Good morning everyone,
>
> I'm trying my hand with subclasses and using parametrized (sub-)classes.
>


That's probably a mistake.  Class inheritance serves a comparatively 
special purpose in Puppet DSL, one whose importance is much less in modern 
Puppet than it was in the Puppet of five-ish years ago.  On the other hand, 
I don't think what you're doing actually has anything to do with subclasses 
/ inheritance.

 

>
> Here's the module layout, and what I'm trying to acheive:
>
> */etc/modules/users/manifests/sysadmins.pp*
> class users::sysadmins
> {
> realize (Group['sysadmins'])
> include users::sysadmins::jfg1
> include users::sysadmins::jfg2
> }
> and then I'd have, in */etc/modules/users/manifests/sysadmins/jfg1.pp* :
> class users::sysadmins::jfg1
> {
> @user   { 'jfg1' :
> comment => 'JFG1 test accnt',
> ensure => present,
> gid => 'sysadmins',
> [snip]
>  }
>realize (User['jfg1'])
> }
>
>

That's not a subclass, it's just a class whose fully-qualified name has two 
namespace segments.  Having the same first namespace segment puts that 
class and the previous one in the same module, but as far as Puppet is 
concerned, the coincidence between subsequent name segments does not imply 
any additional relationship between the two.

 

> Now, I'd want some common files to be put into $HOME, regardless of the 
> user being created. I've thought of adding this:
>
> */etc/puppet/modules/users/sysadmins/commonfiles.pp* :
> class users::sysadmins::commonfiles($homedirectory, $username)
> {
> file{ "${homedirectory}/.profile" :
> ensure => present,
> owner => "${username}",
> group => 'sysadmins',
> source => 
> "puppet:///modules/users/profiles/${username}-profile",
> }
> [snip]
> }
> ($homedirectory has to be explicitely passed to this module because $HOME 
> could be /export/home, /home/ or other combinations -> /Users/$user on OSX, 
> for instance)
>
> Now, back to /etc/modules/users/manifests/sysadmins/jfg1.pp, right after 
> the realize User[] line, I'd call the commonfiles subclass with:
>   include users::sysadmins::commonfiles("/export/home/jfg1", "jfg1")
>


If you want to bind values to your class parameters at the point where you 
declare the class, then you must use a resource-like class declaration:

class { 'users::sysadmins::commonfiles':
  homedirectory => '/export/home/jfg1',
  username  => 'jfg1'
}

But

   1. You should avoid resource-like class declarations under most 
   circumstances.  Favor automated data binding (via Hiera) instead.  And more 
   importantly,
   2. What you are trying to do appears unlikely to serve your purposes.

Expanding on the second point, if you want to be able to declare common 
files for more than one user, then you cannot use a class as you are trying 
to do, because classes are singletons.  You could not use that class to 
provide common files for more than one user.

You seem to be looking for a defined type 
 
instead. That might look something like this:

define users::sysadmins::commonfiles($homedirectory) {
  file { "${homedirectory}/.profile":
ensure => present,
owner  => "${title}",
group  => 'sysadmins',
source => "puppet:///modules/users/profiles/${title}-profile",
  }

  # ...
}

You would use it just like any other resource type, for instance

users::sysadmins::commonfiles { 'jfg1':
  homedirectory => '/export/home/jfg1'
}

Such a resource has all the properties and behavior common to resources -- 
you can chain it, collect it, declare resource defaults for it, etc..


John

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/d58eb66d-2c56-400f-9745-6649c9f7d9aa%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[Puppet Users] Re: How to include quoted string into a command

2015-12-15 Thread jcbollinger


On Monday, December 14, 2015 at 10:51:51 AM UTC-6, Vadym Chepkov wrote:
>
> I passed the single quotes bump, thank you, now I stuck on back ticks, 
> puppet actually calls the script it and doesn't allow me to escape ` symbol
>
> I need this for Solaris logadm.conf, which is a very unusual config file, 
> since logadm modifies it during each run.
> I am using the same technique PuppetLabs uses in solaris agent:
>
> # Have to use exec, since logadm adds a timestamp to the line when it 
> runs
> $sig_command = "'kill -HUP `cat /var/run/syslog.pid`'"
> exec { "${logfile} log rotation":
>   command => "/usr/bin/echo \"# ${facility} rotation rule\n${logfile} 
> -C 5 -a ${sig_command} -p 1d\" >> /etc/logadm.conf",
>   unless  => "/usr/bin/grep '^${logfile}' /etc/logadm.conf > 
> /dev/null",
> }
>
> I end up with
> /var/log/local0.log -C 5 -a 'kill -HUP 28787' -p 1d
>
>

The analysis goes along pretty much the same as before.  Given ...

$sig_command = "'kill -HUP `cat /var/run/syslog.pid`'"

... the value of variable $sig_command is all the literal characters within 
the double quotes, from single quote to single quote, inclusive: 'kill -HUP 
`cat /var/run/syslog.pid`'. That gets interpolated into the double-quoted 
command string, so the literal text of the command will be something like:

/usr/bin/echo "# local0 rotation rule
local0.log -C 5 -a 'kill -HUP `cat /var/run/syslog.pid`' -p 1d" >> /etc/
logadm.conf

Kernel.exec() will execute that via the shell, on account of the 
metacharacters within.

Note that there is exactly one argument to the echo command, and it is 
double-quoted.  As a result, the shell (not Puppet) will perform command 
substitution, among others, on the contents before before handing the 
result to echo.  Within the double quotes, the internal single quotes are 
just plain data; they do not inhibit the command substitution.

The direct solution to this problem is also along the lines I gave you 
before: get your quoting and escaping correct for execution directly by the 
shell (and test it), then quote the result appropriately for Puppet.  I 
leave this one as an exercise for you.

On the other hand, if you can do without the leading comment, then what I 
now see you are trying to do would be well served by the file_line resource 
type provided by puppetlabs-stdlib 
. That module also provides 
a wide variety of functions that you may find useful, and you may have it 
already because many other modules depend on it. It wouldn't completely 
relieve you of having to think about quoting, but it would simplify matters 
by taking the shell out of consideration.


John

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/e8696672-9a7f-49e2-9545-e54b368cf747%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[Puppet Users] foreman exec node.rb turn out: No such file or directory

2015-12-15 Thread 辛建国
hi,when I exec "sudo -u puppet  /etc/puppet/node.rb puppet.server.com" 
command on puppet server ~ it turned out that ": No such file or 
directory", but when I run "sudo -u puppet  ruby /etc/puppet/node.rb 
puppet.server.com" command on puppet server,it works fine. how do I resolve 
it? 


the node.rb is come from foreman.

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/1e320c3b-eb07-4e35-a905-64643244316d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[Puppet Users] Re: ENC

2015-12-15 Thread jcbollinger


On Monday, December 14, 2015 at 8:31:09 AM UTC-6, Sergiu Cornea wrote:
>
> Hi Doug,
>
> Thank you for your reply.
>
> This is what my ENC output looks like:
>
>
>1. classes:
>2. docker_host:
>3. docker:
>4.   extra_parameters:
>5. - "--tlsverify"
>6. - "--tlscacert=/etc/ssl/certs/my.crt"
>7. - "--tlscert=/etc/ssl/certs/new.crt"
>8. - "--tlskey=/etc/ssl/private/akey.pem"
>9. docker_certs:
>10. parameters:
>11.   docker::username: username
>12.   docker::registry: registry.com
>13.   docker::email: em...@email.com
>14.   docker::tcp_bind: tcp://0.0.0.0:
>15.   docker::password: mypassword
>16. environment: production
>
> However, I believe it is sort of working, but Puppet 
> started complaining now about the docker::username: saying that's empty and 
> couldn't be found in any Hiera files and no default has been set-up...To be 
> honest, I don't know why I am getting this error :( , I've tried spacing 
> it, remove completely the spacing but no luck. 
>
> What do you think I might be doing wrong?
>


The 'parameters' key in the ENC output format is for specifying a hash 
whose entries will be exposed to the catalog compiler *as top-scope 
variables*.  You appear to be trying instead to use it to give class 
parameters for class 'docker'.  Oddly, however, not for *all* the 
parameters of class 'docker' -- you are giving a value for class parameter 
$docker::extra_parameters in the proper way.

It appears that you want your ENC to produce something more like:

classes:
  docker_host:
  docker:
username: username
registry: registry.com
email: em...@email.com
tcp_bind: tcp://0.0.0.0:
password: mypassword
extra_parameters:
  - "--tlsverify"
  - "--tlscacert=/etc/ssl/certs/my.crt"
  - "--tlscert=/etc/ssl/certs/new.crt"
  - "--tlskey=/etc/ssl/private/akey.pem"
  docker_certs:
environment: production


I have removed the 'parameters' key because no entries remained in it, but 
that's not strictly necessary.  Puppet ENC behavior and output format is 
covered 
well  by the 
PuppetLabs documentation.


John

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/2726f674-76eb-4f66-8995-4b6fb6b65ac8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Puppet Users] Logging output of a long running exec

2015-12-15 Thread Dayton Jones
Does that show the output during the puppet run though?  I "need" to have 
the output of the script show up, hence the "logoutput => true" directive 
which I don't see in your example.  The script runs just fine, I just don't 
get any output/status from it when run via puppet.  

On Tuesday, December 15, 2015 at 3:56:14 AM UTC-6, Steve Traylen wrote:
>
> Example of long exec running backgrounded in a screen.
>
> exec { 'zrep_initial_sync': 
> command => "screen -dmS zrep_initial_sync /usr/local/sbin/krb_me.sh 
> /usr/local/sbin/zrep init ${src_vol} ${dst_host} ${dst_vol}", onlyif => 
> "zfs get -H zrep:src-fs -o value ${src_vol} | grep -qv ${src_vol}", path => 
> ['/bin/', '/sbin/' , '/usr/bin/', '/usr/sbin/', '/usr/local/bin', 
> '/usr/local/sbin'], }
> Sent from Nine 
>
> *From:* Dayton Jones >
> *Sent:* 11 Dec 2015 9:45 pm
> *To:* Puppet Users
> *Subject:* [Puppet Users] Logging output of a long running exec
>
> I have a legacy "provisioning" script that I'm calling with puppet on 
> brand new machines (I'm slowly taking the functionality out of the script 
> and into puppet, but for reasons I can't do a full replacement yet) 
>
> I'd like to log the output of the provisioning and have included 
> "logoutput" to the exec in the class (see below) but when I run puppet all 
> I get for the module/class is:
>
> Warning: Waiting for output; will sleep 0.0 seconds
>
> Warning: Waiting for output; will sleep 0.5 seconds
>
> Warning: Could not get output
>
> Notice: /Stage[post]/provision/Exec[provision.sh]/returns: executed 
> successfully
>
> Notice: Finished catalog run in 107.80 seconds
>
>
>
> Here is the class and exec... I'm setting a timeout of 1800 and if the 
> catalog run finishes in 107 seconds, I'm unclear on how it's timing out. 
>  Any suggestions?
>
> class provision { 
>
>
>   notify {'Running provision.sh can take a while - be patient':}
>
>
>   file { '/root/provision.sh' :
>
> ensure => file,
>
> owner  => 'root',
>
> group  => 'root',
>
> mode   => '0755',
>
> source => 'puppet:///modules/provision/provision.sh',
>
> notify => Exec['provision.sh'],
>
>   }
>
>
>   exec { 'provision.sh' :
>
> command   => '/root/provision.sh',
>
> logoutput => true,
>
> timeout   => 1800,
>
> cwd   => '/root';
>
>   }
>
> }
>
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Puppet Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to puppet-users...@googlegroups.com .
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/puppet-users/1a15177f-e0f1-4d1b-8c87-5f7b47d7dede%40googlegroups.com
>  
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/8dc78f95-4c00-4693-b659-9cdad3dc9ade%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Puppet Users] Logging output of a long running exec

2015-12-15 Thread Steve Traylen
Example of long exec running backgrounded in a screen.

exec { 'zrep_initial_sync':
command => "screen -dmS zrep_initial_sync /usr/local/sbin/krb_me.sh 
/usr/local/sbin/zrep init ${src_vol} ${dst_host} ${dst_vol}", onlyif => "zfs 
get -H zrep:src-fs -o value ${src_vol} | grep -qv ${src_vol}", path => 
['/bin/', '/sbin/' , '/usr/bin/', '/usr/sbin/', '/usr/local/bin', 
'/usr/local/sbin'], }

Sent from Nine

From: Dayton Jones 
Sent: 11 Dec 2015 9:45 pm
To: Puppet Users
Subject: [Puppet Users] Logging output of a long running exec

I have a legacy "provisioning" script that I'm calling with puppet on brand new 
machines (I'm slowly taking the functionality out of the script and into 
puppet, but for reasons I can't do a full replacement yet)

I'd like to log the output of the provisioning and have included "logoutput" to 
the exec in the class (see below) but when I run puppet all I get for the 
module/class is:
Warning: Waiting for output; will sleep 0.0 seconds
Warning: Waiting for output; will sleep 0.5 seconds
Warning: Could not get output
Notice: /Stage[post]/provision/Exec[provision.sh]/returns: executed successfully
Notice: Finished catalog run in 107.80 seconds


Here is the class and exec... I'm setting a timeout of 1800 and if the catalog 
run finishes in 107 seconds, I'm unclear on how it's timing out.  Any 
suggestions?

class provision {

  notify {'Running provision.sh can take a while - be patient':}

  file { '/root/provision.sh' :
ensure => file,
owner  => 'root',
group  => 'root',
mode   => '0755',
source => 'puppet:///modules/provision/provision.sh',
notify => Exec['provision.sh'],
  }

  exec { 'provision.sh' :
command   => '/root/provision.sh',
logoutput => true,
timeout   => 1800,
cwd   => '/root';
  }
}

--
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to 
puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/1a15177f-e0f1-4d1b-8c87-5f7b47d7dede%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/4391113f-1763-47ad-a4ca-f0e54c3b2b6f%40cern.ch.
For more options, visit https://groups.google.com/d/optout.