Re: [Puppet Users] Re: access enc variables in facts

2014-03-20 Thread Cristian Falcas
Thank you for your answer.

I thought that maybe ENC data is available to facts also, sine puppet
gets the new environment from ENC before starting to run the facts.



On Wed, Mar 19, 2014 at 10:37 PM, jcbollinger john.bollin...@stjude.org wrote:


 On Wednesday, March 19, 2014 11:56:47 AM UTC-5, Cristian Falcas wrote:

 Hello,

 Is it possible to access the variables sent by ENC in facts?

 Foreman is sending in ENC some variables as location and hostgroup.
 Can I access those in my facts as variables?


 No.  Facts are computed on and by the target node, but the ENC runs on the
 master.  Furthermore, the ENC runs only after receipt of a catalog request
 (which includes all the node facts).  An ENC can use node facts, but not the
 other way around.

 It is conceivable that you could record the ENC-generated info on client
 nodes, in a file somewhere.  In that case, however, you would need to beware
 of those data becoming stale because they reflect what the ENC yielded on
 the last run, which might not be the same thing it is about to yield in
 response to the request being formulated.


 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/7a76c746-ce06-439a-a821-169f7fc157fd%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/CAMo7R_eSyY-yOPDuLyYrctSJOP%3DAFBm7%2BvqM5RQT3YaG2-mfDw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


[Puppet Users] Error installing MySQL Module : 'You must have Puppet 0.25.0 or greated' whereas I've installed version 2.7.11

2014-03-20 Thread Mayeul Rousselet
Hi,

I am on Ubuntu 12.04.2 LTS (launched in a VM).
I've installed puppet and ruby1.9.1 through apt-get.
I've installed puppet-module through gems

When I try to install the module puppetlabs-mysql (puppet module install 
puppetlabs-mysql) I have the following error : 
'You must have Puppet 0.25.0 or greater installed'
When I type puppet --version I got : 
'2.7.11'

Any Ideas?

Thx,

Mayeul

-- 
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/aa0c0a0f-a292-4b64-91fe-3bd7239dd465%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Puppet Users] Error installing MySQL Module : 'You must have Puppet 0.25.0 or greated' whereas I've installed version 2.7.11

2014-03-20 Thread Ryan Coleman
On Thu, Mar 20, 2014 at 3:19 AM, Mayeul Rousselet 
mayeul.rousse...@gmail.com wrote:

 Hi,

 I am on Ubuntu 12.04.2 LTS (launched in a VM).
 I've installed puppet and ruby1.9.1 through apt-get.
 I've installed puppet-module through gems

 When I try to install the module puppetlabs-mysql (puppet module install
 puppetlabs-mysql) I have the following error :
 'You must have Puppet 0.25.0 or greater installed'
 When I type puppet --version I got :
 '2.7.11'

 Any Ideas?


Hi Mayeul,

I cannot replicate what you're seeing. I can successfully install that
module. Here's my output.

root@ubuntu-server-12042-x64-vbox4210-nocm:~# facter operatingsystem;
facter operatingsystemrelease
Ubuntu
12.04
root@ubuntu-server-12042-x64-vbox4210-nocm:~# puppet --version
2.7.11
root@ubuntu-server-12042-x64-vbox4210-nocm:~# puppet module install
puppetlabs-mysql
Installed puppetlabs-mysql-2.2.3 into directory: mysql
root@ubuntu-server-12042-x64-vbox4210-nocm:~# cat mysql/Modulefile
name 'puppetlabs-mysql'
version '2.2.3'
source 'git://github.com/puppetlabs/puppetlabs-mysql.git'
author 'Puppet Labs'
license 'Apache 2.0'
summary 'Mysql module'
description 'Mysql module'
project_page 'http://github.com/puppetlabs/puppetlabs-mysql'
dependency 'puppetlabs/stdlib', '= 3.2.0'



Would you provide more information on what went wrong?

If you're starting from scratch with Puppet, I strongly recommend that you
configure the Puppet Labs APT repo and install the latest version of Puppet
in the 3.x series.
http://docs.puppetlabs.com/guides/installation.html#debian-and-ubuntu


-- 
Ryan Coleman | Modules  Forge | ryanycoleman on twitter  #puppet IRC

-- 
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/CAFkZv1taAquiR6yAj%3DH%3DhGa6tLKCyc8KojvVqCW5wqtOkUCweQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Puppet Users] Error installing MySQL Module : 'You must have Puppet 0.25.0 or greated' whereas I've installed version 2.7.11

2014-03-20 Thread Mayeul Rousselet
Hi Ryan,

I've added the puppet apt repo to get the last version (3.4.3) and now I 
can install the MySQL module.

Thank you very much for your quick response,

Mayeul

Le jeudi 20 mars 2014 16:49:09 UTC+1, Ryan Coleman a écrit :




 On Thu, Mar 20, 2014 at 3:19 AM, Mayeul Rousselet 
 mayeul.r...@gmail.comjavascript:
  wrote:

 Hi,

 I am on Ubuntu 12.04.2 LTS (launched in a VM).
 I've installed puppet and ruby1.9.1 through apt-get.
 I've installed puppet-module through gems

 When I try to install the module puppetlabs-mysql (puppet module install 
 puppetlabs-mysql) I have the following error : 
 'You must have Puppet 0.25.0 or greater installed'
 When I type puppet --version I got : 
 '2.7.11'

 Any Ideas?


 Hi Mayeul, 

 I cannot replicate what you're seeing. I can successfully install that 
 module. Here's my output. 

 root@ubuntu-server-12042-x64-vbox4210-nocm:~# facter operatingsystem; 
 facter operatingsystemrelease
 Ubuntu
 12.04
 root@ubuntu-server-12042-x64-vbox4210-nocm:~# puppet --version
 2.7.11
 root@ubuntu-server-12042-x64-vbox4210-nocm:~# puppet module install 
 puppetlabs-mysql
 Installed puppetlabs-mysql-2.2.3 into directory: mysql
 root@ubuntu-server-12042-x64-vbox4210-nocm:~# cat mysql/Modulefile
 name 'puppetlabs-mysql'
 version '2.2.3'
 source 'git://github.com/puppetlabs/puppetlabs-mysql.git'
 author 'Puppet Labs'
 license 'Apache 2.0'
 summary 'Mysql module'
 description 'Mysql module'
 project_page 'http://github.com/puppetlabs/puppetlabs-mysql'
 dependency 'puppetlabs/stdlib', '= 3.2.0'



 Would you provide more information on what went wrong? 

 If you're starting from scratch with Puppet, I strongly recommend that you 
 configure the Puppet Labs APT repo and install the latest version of Puppet 
 in the 3.x series. 
 http://docs.puppetlabs.com/guides/installation.html#debian-and-ubuntu


 -- 
 Ryan Coleman | Modules  Forge | ryanycoleman on twitter  #puppet IRC
  

 

-- 
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/ef374430-9572-435c-85ab-3f55b1273382%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Puppet Users] Announce: puppetdb-stencil 0.0.1

2014-03-20 Thread Nikola Petrov
This looks nice. Although I think that for the usecase you are
presenting with nagios resources it will be much easier to use
puppetdbquery[1]. The script you wrote might have other usecases. Nice
work again :)

-- 
Nikola

On Thu, Mar 13, 2014 at 02:56:18PM -0700, Daniele Sluijters wrote:
 Good news everyone,
 
 After about 4hrs of food, beer and code Ewoud Kohl van Wijngaarden (ekohl 
 on Github) and I are intoxicated to release puppetdb-stencil. 
 Puppetdb-stencil is designed to render resource types based on a template.
 
 The canonical example of this is the nagios types in Puppet:
 
 $ cd examples  python ../puppetdb-stencil.py nagios_host nagios_hostgroup
 define host {
 host_name node1.example.com
 hostgroups +mysql
 use mysql
 alias MySQL Cluster node node1.example.com
 address node1.example.com
 }
 [..]
 
 define hostgroup {
 hostgroup_name mysql
 alias MySQL Cluster 1
 }
 [..]
 
 On a PuppetDB with 600+ machines and 900+ host groups generating the files 
 for these types takes about 1s in total.
 
 Because of the templating this principle can be applied to any resource 
 available through PuppetDB as long as a template is created for that type. 
 Templating is done with the Jinja2 library allowing for inheritance and 
 many other advanced templating features.
 
 This work has been inspired by the work done by eBay/Marktplaats and Github.
 
 You can find puppetdb-stencil at: 
 https://github.com/daenney/puppetdb-stencil.
 
 We expect to shortly add:
 * packaging and availability through PyPi
 * additional configuration switches to fully configure connecting to 
 PuppetDB
 * allow for an arbitrary query to be passed in to the resource request
 * allow to specify a file to which the output will be written instead of 
 stdout
 * tests, Travis integration and the works
 
 -- 
 Daniele Sluijters
 
 -- 
 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/bcfd1735-42f5-40ca-8d33-959ebcd8e1cd%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/20140320164700.GA3582%40nikolavp-desktop.
For more options, visit https://groups.google.com/d/optout.


[Puppet Users] conditional statement in config.pp

2014-03-20 Thread John
Below is a my current config,.pp file  I'm trying to create a condition 
that says

if (/etc/ldap.conf contains the string host1.mydomain.com or 
host2.mydomain.com)
  Then install an sshd_ldap.erb template
 else if (/etc/ldap.conf contains the string hostB.mydomain.com or 
hostA.mydomain.com)
 Then install an sshd_freeIPA.erb template
   else  install a standard template.

The code does not work as written.  Any advice to suggestions would be 
greatly appreciated.

Thanks in advance.

class ssh::config inherits ssh {
  file_content { '/etc/ldap.conf':
ensure = file,
  }
  if $file_content == host1.mydomain.com || host2.mydomain.com
  {
file { '/etc/ssh/sshd_config':
ensure = present,
owner = $owner,
group = $group,
mode = '0644',
backup = false,
content = template(sshd_config_ldap.erb),
  }
  file { '/etc/ssh/ssh_config':
ensure = present,
owner = $owner,
group = $group,
mode = '0644',
backup = false,
content = template(ssh_config_ldap.erb),
  }
  }
  elsif $file_content == hostB.mydomain.com || hostA.mydomain.com
  {
file { '/etc/ssh/sshd_config':
ensure = present,
owner = $owner,
group = $group,
mode = '0644',
backup = false,
content = template(sshd_config_ipa.erb),
  }
  file { '/etc/ssh/ssh_config':
ensure = present,
owner = $owner,
group = $group,
mode = '0644',
backup = false,
content = template(ssh_config_ipa.erb),
  }
  }
  else
  {
file { '/etc/ssh/sshd_config':
ensure = present,
owner = $owner,
group = $group,
mode = '0644',
backup = false,
content = template(sshd_config_standard.erb),
  }
  file { '/etc/ssh/ssh_config':
ensure = present,
owner = $owner,
group = $group,
mode = '0644',
backup = false,
content = template(ssh_config_standard.erb),
  }
  }
}

-- 
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/7a70eb36-0388-46a7-9988-b61e024b796d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Puppet Users] conditional statement in config.pp

2014-03-20 Thread Peter Bukowinski
On Mar 20, 2014, at 1:26 PM, John sami.st...@gmail.com wrote:

 Below is a my current config,.pp file  I'm trying to create a condition 
 that says
 
 if (/etc/ldap.conf contains the string host1.mydomain.com or 
 host2.mydomain.com)
   Then install an sshd_ldap.erb template
  else if (/etc/ldap.conf contains the string hostB.mydomain.com or 
 hostA.mydomain.com)
  Then install an sshd_freeIPA.erb template
else  install a standard template.
 
 The code does not work as written.  Any advice to suggestions would be 
 greatly appreciated.
 
 Thanks in advance.
 
 class ssh::config inherits ssh {
   file_content { '/etc/ldap.conf':
 ensure = file,
   }

I understand what you're trying to do here, but you seem to have made up some 
puppet code that it won't know how to handle. You're trying to define a 
variable by using puppet's resource language. That's not going to work.

What you'll need to do is write a custom facter fact, e.g. 'ldapserver', that 
will contain the name(s) of the configured ldap server(s). I do this in my 
environment with the following code, which I place into a puppet module named 
'custom' (as documented here 
http://docs.puppetlabs.com/guides/plugins_in_modules.html):

# ldapservers.rb
Facter.add(:ldapservers) do
setcode do
osfam = Facter.value('osfamily')
case osfam
when /RedHat/
%x{authconfig --test | grep -Fwm 1 'LDAP server' | awk -F\\ 
'{gsub(ldap:,);gsub(/,);print $2}'}.chomp
when /Debian/
%x{awk '/^uri/{print $2,$3}' /etc/ldap.conf}.chomp
end 
end 
end

With this fact in place, you can use a selector instead of an if statement to 
make your code much more concise:

class ssh::config inherits ssh {
$ssh_type = $::ldapservers ? {
/host(1|2).mydomain.com/ = ldap,
/host(B|A).mydomain.com/ = ipa,
default = standard,
}
file { '/etc/ssh/sshd_config':
ensure = present,
owner = $owner,
group = $group,
mode = '0644',
backup = false,
content = template(sshd_config_${$ssh_type}.erb),
}
file { '/etc/ssh/ssh_config':
ensure = present,
owner = $owner,
group = $group,
mode = '0644',
backup = false,
content = template(ssh_config_${$ssh_type}.erb),
}
}

   if $file_content == host1.mydomain.com || host2.mydomain.com
   {
 file { '/etc/ssh/sshd_config':
 ensure = present,
 owner = $owner,
 group = $group,
 mode = '0644',
 backup = false,
 content = template(sshd_config_ldap.erb),
   }
   file { '/etc/ssh/ssh_config':
 ensure = present,
 owner = $owner,
 group = $group,
 mode = '0644',
 backup = false,
 content = template(ssh_config_ldap.erb),
   }
   }
   elsif $file_content == hostB.mydomain.com || hostA.mydomain.com
   {
 file { '/etc/ssh/sshd_config':
 ensure = present,
 owner = $owner,
 group = $group,
 mode = '0644',
 backup = false,
 content = template(sshd_config_ipa.erb),
   }
   file { '/etc/ssh/ssh_config':
 ensure = present,
 owner = $owner,
 group = $group,
 mode = '0644',
 backup = false,
 content = template(ssh_config_ipa.erb),
   }
   }
   else
   {
 file { '/etc/ssh/sshd_config':
 ensure = present,
 owner = $owner,
 group = $group,
 mode = '0644',
 backup = false,
 content = template(sshd_config_standard.erb),
   }
   file { '/etc/ssh/ssh_config':
 ensure = present,
 owner = $owner,
 group = $group,
 mode = '0644',
 backup = false,
 content = template(ssh_config_standard.erb),
   }
   }
 }

--
Peter Bukowinski

-- 
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/B87E3C1D-B65E-4895-B7D8-C70B6F7E162F%40gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Puppet Users] How to debug catalog transfer?

2014-03-20 Thread Andy Spiegl
On 2014-03-19, 13:32, Rob Reynolds wrote:
 I meant change the puppet agent service to another user in the services
 console just to rule that out.

Oh, I see!  I just did that, used the user ADMINISTRATOR and 
... IT WORKED!

Okay, now we know that the problem has to do with the user SYSTEM.
What could he be missing?  Maybe an environment variable?

Thanks,
 Andy.


-- 
 Indeed, thanks to the Microsoft PC, the Internet has a level of
 inconvenience that would be unacceptable in any other mass-market medium.
(http://www.economist.com/editorial/)

-- 
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/20140320191354.GA19012%40spiegl.de.
For more options, visit https://groups.google.com/d/optout.


[Puppet Users] use pe-http or ad a second http server

2014-03-20 Thread Evan Hisey
This is more a better practice than can I do this question. I need
to server up the puppet agent repos and centos http install tree via
HTTP from the the same box as puppet console. It is saner to use the
pe-http or setup a second httpd instance on the same box?


Evan

-- 
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/CAEcFzYxffvhRdGbgMFE%2BXM_kZb8%2B8KRQ4LdozfD-UaQq3B%2B%2Btg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Puppet Users] How to debug catalog transfer? (new idea!)

2014-03-20 Thread Andy Spiegl
 Okay, now we know that the problem has to do with the user SYSTEM.
 What could he be missing?  Maybe an environment variable?

I have an idea!  I was playing around with foreman and noticed a new
error message:
 root@foreman:~# /etc/puppet/node.rb winpet1
 Could not send facts to Foreman: \x84 from ASCII-8BIT to UTF-8

So I started comparing the yaml files in /var/lib/puppet/yaml/facts/
and noticed that the id variable is strange when puppet is running
as user SYSTEM:

 id: winpet1\x5cadministrator
---
 id: !binary bnQtYXV0b3JpdIR0XHN5c3RlbQ==\n

If I remove this line from the yaml file /etc/puppet/node.rb does not
complain anymore!

Now the new question is: why is the ID garbled in this way?

Thanks,
 Andy.


-- 
 The supreme irony of life is that hardly anyone gets out of it alive.
   (Robert Heinlein)

-- 
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/20140320203050.GA30290%40spiegl.de.
For more options, visit https://groups.google.com/d/optout.


Re: [Puppet Users] Re: Windows msi needed to udpate dns server list

2014-03-20 Thread Josh Cooper
On Wed, Mar 19, 2014 at 6:02 AM, Paul Tötterman paul.totter...@gmail.comwrote:

 Does anyone have a suggestion of how to do this using and msi?  I plan to
 use the puppet agent to run the msi to make the updates, but if someone has
 a different suggestion on puppet to mange that list of IP addresses on
 windows, we are open to suggestions !!


 Modify the settings in registry?
 https://forge.puppetlabs.com/puppetlabs/registry

 https://serverfault.com/questions/67637/find-xp-client-dns-settings-in-the-registry



There's also Rich's module:
https://forge.puppetlabs.com/rismoney/windowsnetwork

Josh

-- 
Josh Cooper
Developer, Puppet Labs

*Join us at PuppetConf 2014, September 23-24 in San Francisco* -*
http://bit.ly/pupconf14
http://bit.ly/pupconf14*
Register now and save $350!

-- 
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%2Bu97u%3DLeKLSUMUj3_k3wkkus5ucGeX1tYbtLGqX48otxL2HvA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Puppet Users] append registry array (REG_MULTI_SZ) with puppet

2014-03-20 Thread Josh Cooper
Hi Helen,


On Wed, Mar 12, 2014 at 9:24 AM, Helen Paterson helen.pater...@gmail.comwrote:


 Hi,

 When add values to a key using the below puppet code it clears the current
 values on the server. Is there away to simply append a reg key value ?


Not currently. Please file a ticket at
https://tickets.puppetlabs.com/browse/MODULES and add 'registry' as the
component.











 *class winregistry {  registry_value {
 'hklm\SYSTEM\CurrentControlSet\Control\Lsa\MSV1_0\BackConnectionHostNames':
 ensure = present,type = array,data =
 ['myservername2.mydomain.com http://myservername2.mydomain.com',
 'myservername3.mydomain.com
 http://myservername3.mydomain.com','myservername4.mydomain.com
 http://myservername4.mydomain.com'],
 }}*









  --
 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/337dac52-9f31-41ea-8679-2d3096457e60%40googlegroups.comhttps://groups.google.com/d/msgid/puppet-users/337dac52-9f31-41ea-8679-2d3096457e60%40googlegroups.com?utm_medium=emailutm_source=footer
 .
 For more options, visit https://groups.google.com/d/optout.


Josh

-- 
Josh Cooper
Developer, Puppet Labs

*Join us at PuppetConf 2014, September 23-24 in San Francisco* -*
http://bit.ly/pupconf14
http://bit.ly/pupconf14*
Register now and save $350!

-- 
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%2Bu97u%3DXp%2BKFfWw5dKMQPUhoUfVMAVGSqvG2rj1XM9RvwZrcAg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Puppet Users] Create variable as result of command execution

2014-03-20 Thread Roman Alekseev
Thank you!

This is also working:

/usr/sbin/nginx -V 21  | /bin/grep -oP http-proxy-temp-path=.*?\s | 
/usr/bin/awk -F\'=\' {\'print $2\'}

среда, 19 марта 2014 г., 17:31:45 UTC+4 пользователь jcbollinger написал:



 On Wednesday, March 19, 2014 4:03:26 AM UTC-5, Roman Alekseev wrote:

 Hi,

 I created fact but it doesn't work. What did I make wrong?







 *# nginx_arg.rbFacter.add(nginx_arg) do  setcode do
 Facter::Util::Resolution.exec(/usr/sbin/nginx -V 2 /etc/puppet/nginx.args 
 | /bin/cat /etc/puppet/nginx.args | /usr/bin/awk 
 -F'--http-proxy-temp-path=' {'print $2'} | /usr/bin/awk {'print $1'}  | 
 /bin/grep '\/')  endend*



 There are a couple of weird things about that, but before that:

- What does doesn't work mean, specifically?
- Where is the file located on the master?
- Do you have pluginsync enabled on the agents?
- Is the fact value output by facter -p on agent nodes that have 
synced the fact?

 With respect to the command itself,

- which output stream from /usr/sbin/nginx are you trying to use?  
(You are using stderr (via a temp file), but you are also piping stdout 
 and 
ignoring it.)
- the unquoted curly braces in the command will be parsed by the 
shell, not passed to awk.
- Setting awk's field separator to '--http-proxy-temp-path=' will 
probably not do anything sensible if there are other options listed after 
than one in nginx's output.
- If you need a temp file, you should put it in /tmp or /var/tmp and 
give it an unpredictable name.  But you don't need one for what it looks 
like you're trying to do.

 Were I writing a command to do what I *think* yours is trying to do, it 
 would look something like this:

 Facter::Util::Resolution.exec(
   /usr/sbin/nginx -V 21 1/dev/null | /bin/sed -n 
 's,.*--http-proxy-temp-path=\(/\S\+\).*,\1,p'
 )

 That pipes the stderr stream of the nginx command into sed, discarding the 
 stdout.  Sed then filters out everything except any strings of 
 non-whitespace beginning with a slash character (/) and directly following 
 the string --http-proxy-temp-path=.  The output does not include the 
 --http-proxy-temp-path=.  If you need to allow for whitespace either 
 before or after the '=' character then the pattern can be adjusted to 
 achieve that.


 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/04d6b5ad-2c4b-4166-bebb-a2044fe85c4f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.