Re: [Puppet Users] puppetdb org.postgresql.util.PSQLException

2014-12-23 Thread Fabio Sangiovanni

On Monday, December 22, 2014 11:36:13 PM UTC+1, Wyatt Alt wrote:
>
> Hey Fabio, 
>

hi! 
 

> Got a few questions: 
>
> Did you have PuppetDB running properly before you started seeing this 
> issue or are you still setting it up? 
>

Still setting the whole thing up.
 

> Does it persist after postgres and PuppetDB are restarted? 
>

Yes. I've also tried to move to postgresql 9.4, with no success.
 

> When you restart PDB and use it, does it immediately produce this error 
> or does it work for some time first? If it works for some time, is there 
> some event can can correlate the error to? 
>

It does work AND raise the exception in an interleaved manner: I see 
regular log entries and stack traces
like the one I posted. I tried to figure out what triggered the exeptions 
but really couldn't correlate anything
special to the issue.
 

> Is there anything in your postgres log that indicates why the connection 
> is being closed?
>

Yes, actually: I get several messages like these in postgresql log a few 
seconds before puppetdb exception:

 LOG:  incomplete message from client


> Finally, this could be your db connections timing out. Any chance you 
> see some improvement by setting conn-keep-alive to a small number like 1? 
>
> https://docs.puppetlabs.com/puppetdb/master/configure.html#conn-keep-alive 
>
>
I'll try and let you know!

Further information that might be of some use:

- my single host configuration was inside an OpenVZ container - I wonder if 
this may have some weird interaction with postgres or the JVM...
- I've also tried with a two hosts configuration: puppet master + puppetdb 
in one OpenVZ container and postgresql in a Hyper-V VM -> same results as 
before
 

> If none of that sheds light you can send me your postgres and PDB logs 
>
and we can troubleshoot from there. 
>
> Wyatt 
>
>
Thank you very much!

Fabio


>
> On 12/19/2014 02:15 AM, Fabio Sangiovanni wrote: 
> > Hi everybody, I'm incurring in an issue with puppetdb. 
> > I keep on seeing this in /var/log/puppetdb/puppetdb.log: 
> > 
> > 2014-12-19 10:45:55,957 WARN  [c.p.jdbc] Caught exception. Last 
> > attempt, throwing exception. 
> > 2014-12-19 10:45:55,961 ERROR [c.p.p.command] 
> > [f74061b8-1350-4b9e-9b77-b52f6d919ef9] [replace facts] Retrying after 
> > attempt 9, due to: org.postgresql.util.PSQLException: This connection 
> > has been closed. 
> > org.postgresql.util.PSQLException: This connection has been closed. 
> > at 
> > 
> org.postgresql.jdbc2.AbstractJdbc2Connection.checkClosed(AbstractJdbc2Connection.java:822)
>  
>
> > ~[puppetdb.jar:na] 
> > at 
> > 
> org.postgresql.jdbc2.AbstractJdbc2Connection.setAutoCommit(AbstractJdbc2Connection.java:769)
>  
>
> > ~[puppetdb.jar:na] 
> > at 
> > 
> com.jolbox.bonecp.ConnectionHandle.setAutoCommit(ConnectionHandle.java:1063) 
>
> > ~[puppetdb.jar:na] 
> > at 
> > clojure.java.jdbc.internal$transaction_STAR_.invoke(internal.clj:222) 
> > ~[na:na] 
> > at 
> > 
> com.puppetlabs.jdbc$with_transacted_connection_fn$fn__6761$fn__6762.invoke(jdbc.clj:290)
>  
>
> > ~[na:na] 
> > at 
> > 
> clojure.java.jdbc.internal$with_connection_STAR_.invoke(internal.clj:186) 
> > ~[na:na] 
> > at 
> > 
> com.puppetlabs.jdbc$with_transacted_connection_fn$fn__6761.invoke(jdbc.clj:287)
>  
>
> > ~[na:na] 
> > at 
> > 
> com.puppetlabs.jdbc$eval6739$retry_sql_STAR___6740$fn__6741$fn__6742.invoke(jdbc.clj:259)
>  
>
> > ~[na:na] 
> > at 
> > 
> com.puppetlabs.jdbc$eval6739$retry_sql_STAR___6740$fn__6741.invoke(jdbc.clj:258)
>  
>
> > ~[na:na] 
> > at 
> > com.puppetlabs.jdbc$eval6739$retry_sql_STAR___6740.invoke(jdbc.clj:250) 
> ~[na:na] 
> > at 
> > com.puppetlabs.jdbc$with_transacted_connection_fn.invoke(jdbc.clj:286) 
> > ~[na:na] 
> > at 
> > 
> com.puppetlabs.puppetdb.command$eval11543$fn__11546.invoke(command.clj:379) 
> > ~[na:na] 
> > at clojure.lang.MultiFn.invoke(MultiFn.java:231) ~[puppetdb.jar:na] 
> > at 
> > 
> com.puppetlabs.puppetdb.command$produce_message_handler$fn__11715.invoke(command.clj:647)
>  
>
> > ~[na:na] 
> > at 
> > 
> com.puppetlabs.puppetdb.command$wrap_with_discard$fn__11664$fn__11668.invoke(command.clj:554)
>  
>
> > ~[na:na] 
> > at 
> > 
> com.puppetlabs.puppetdb.command.proxy$java.lang.Object$Callable$7da976d4.call(Unknown
>  
>
> > Source) ~[na:na] 
> > at com.yammer.metrics.core.Timer.time(Timer.java:91) 
> > ~[puppetdb.jar:na] 
> > at 
> > 
> com.puppetlabs.puppetdb.command$wrap_with_discard$fn__11664.invoke(command.clj:553)
>  
>
> > ~[na:na] 
> > at 
> > 
> com.puppetlabs.puppetdb.command$wrap_with_exception_handling$fn__11649$fn__11650.invoke(command.clj:507)
>  
>
> > ~[na:na] 
> > at 
> > 
> com.puppetlabs.puppetdb.command.proxy$java.lang.Object$Callable$7da976d4.call(Unknown
>  
>
> > Source) ~[na:na] 
> > at com.yammer.metrics.core.Timer.time(Timer.java:91) 
> > ~[puppetdb.jar:na] 
> > at 
> > 
> com.puppetlabs.puppetdb.command$wrap_with_exception_handling$f

[Puppet Users] catalog-diff and create_resources not correct

2014-12-23 Thread Johan De Wit

Hi,

We wanted to use catalog diff to verify the old and new catalogs during 
conversionto hiera.  They should be both have the saem resources with 
the same paramters.
But every resource that is created in the 'new' version with 
create_resources(), gives a wrong catalog diff.


The resource is indeed in both catalogs, only the old one contains 2 
automatic attributes (file: and line:).  I suspect this is the cause.


Anyone experienced simular result ?

In the meantime, I try to understand the catalog-diff code to see where 
this could be corrected.


Grts

johan

   Catalog diff output :
   

   test_node 100.0%
   

   Total resources in old: 0
   Total resources in new: 1
   Only in new:
notify[my_test_notify]
   Catalag percentage added:   100.00
   Catalog percentage removed: 0.00
   Catalog percentage changed: 0.00
   Added and removed resources:+1 / 0
   Node percentage:100.0
   Node differences:   1
   

   1 out of 1 nodes changed. 100.0%
   

   Nodes with the most changes by percent changed:
   1. test_node 100.00%
   Nodes with the most changes by differeces:
   1. test_node  1false
   The manifest new and catalog entry
   node 'test_node' {
   $my_notify =  { 'my_test_notify' => { 'message' => 'this is a
   test notify',
 'name' => 'test_notify',
 'withpath' => 'true', }
}
   create_resources(notify, $my_notify)
   }
 {
"parameters": {
  "withpath": "true",
  "message": "this is a test notify",
  "name": "test_notify"
},
"exported": false,
"tags": [
  "notify",
  "my_test_notify",
  "node",
  "test_node",
  "class"
],
"title": "my_test_notify",
"type": "Notify"
  }
   
   The manifest OLD
   node 'test_node' {
   notify { 'my_test_notify':
 message  => 'this is a test notify',
 name => 'test_notify',
 withpath => true,
   }
   }
   
"title": "test_node",
"type": "Node"
  },
  {
"parameters": {
  "withpath": true,
  "message": "this is a test notify",
  "name": "test_notify"
},
"exported": false,
"line": 12,
"file":
   "/etc/puppetlabs/puppet/environments/rese_old/manifests/nodes/test_node.pp",
"tags": [
  "notify",
  "my_test_notify",
  "node",
  "test_node",
  "class"
],
"title": "my_test_notify",
"type": "Notify"
  }
   



--
Johan De Wit

Open Source Consultant

Red Hat Certified Engineer  (805008667232363)
Puppet Certified Professional 2013/2014 (PCP006)
_
 
Open-Future Phone +32 (0)2/255 70 70

Zavelstraat 72  Fax   +32 (0)2/255 70 71
3071 KORTENBERG Mobile+32 (0)474/42 40 73
BELGIUM http://www.open-future.be
_
 



Next Events:
Zabbix Certified Training | 
http://www.open-future.be/zabbix-certified-specialist-training-5th-till-7th-january
Zabbix Certified Professional | 
http://www.open-future.be/zabbix-certified-professional-training-8th-till-9th-janaury
Bacula Administrator 1 | 
http://www.open-future.be/bacula-administrator-i-training-13th-till-15th-january
Puppet Fundamentals | 
http://www.open-future.be/puppet-fundamentals-training-26th-till-28th-january
Puppet Architect | 
http://www.open-future.be/puppet-architect-training-29th-till-30th-january
Subscribe to our newsletter | http://eepurl.com/BUG8H

--
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/54993791.50404%40open-future.be.
For more options, visit https://groups.google.com/d/optout.


[Puppet Users] Re: Unable to collect stored resources(ipaddress) in puppet

2014-12-23 Thread jcbollinger


On Monday, December 22, 2014 8:22:40 AM UTC-6, Manjunatha T N wrote:
>
> Hi,
>
> I am using Puppet master and client 3.7 and for store configs MySql DB. 
> Here I am trying to export IPaddress from one node another. When I ran the 
> agent in client node it is executing without any error, could see the 
>  related node details in MYSQL db but not able collect it and mentioned 
> file is showing as empty. Please find the below my classes details and 
> puppet conf details. Please help me to fix this issue. Thanks in advance.
> ---
>

Looking at this code:
 

> class admin::file {
> @@file {"/tmp/ip.txt/${::ipaddress}":
> path => '/tmp/ip.txt/',
>


there are a few strange things:

   - You do not specify an 'ensure' value.  It looks like you want ensure 
   => 'file'.  This could be the source of your issue.
   - You use a path-like title but a different 'path' property.  That's not 
   an error, but it's not very useful.  I'm inclined to think that you expect 
   different behavior to result from this than you actually will get.
   - The value of the 'path' property ends with a '/' character.  That's a 
   semantic error (but not a syntax error).  The master is unlikely to 
   complain about it, but it's unclear whet the effect will be at the agent.
   
 

> content => "\ndefine('DB_HOST',\t${::ipaddress});",
> tag => "ip"
> }
> }
>
> node 'dbserver.garuda.com'
> {
> include admin::file
> }
>
> class admin { 
> File <<| tag == 'ip" |>>
> }
>


Also, you have mismatched quotes in your collector (above).  If that's the 
code actually appearing in your manifest set then the master should throw a 
parse error for any node that declares class 'admin'.  Depending on 
Puppet's configuration, the agent on such a node might in that case apply a 
cached catalog.  This also might explain your problem.


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/7d3895da-efde-4cf0-b09d-f4d6033dc1e7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[Puppet Users] Re: Nagios user lookup

2014-12-23 Thread jcbollinger


On Monday, December 22, 2014 9:27:47 AM UTC-6, Jonathan Gazeley wrote:
>
>  Hi folks,
>
> I'm not sure if I'm thinking about the problem the wrong way, but I'm 
> trying to design a way to have one directory of user information in hiera 
> which feeds the creation of unix users as well as nagios contacts. I have a 
> hiera data structure like this:
>
> unifiedusers:
>   jon:
> nagiosuser: true
> comment: Jonathan
> gid: resnet
> uid: 56933
> sudo: true
> groups:
>   - resnet
>   - superadmins
>   paul:
> nagiosuser: true
> comment: Paul
> gid: resnet
> uid: 23770
> sudo: true
> groups:
>   - resnet
>   - superadmins
>   dave:
> nagiosuser: false
> comment: Dave
> gid: networks
> uid: 1234
> sudo: false
> groups:
>   - resnet
>
> I have code that works well to create unix users & groups. I'm struggling 
> more with nagios stuff. Ideally I want to end up with an array of usernames 
> for whom nagiosuser==true. So my array @nagiosusers would contain ['jon', 
> 'paul'] but not 'dave'. Is this possible?
>
>

Of course it's possible.  Puppet has enough hooks that you can plug in any 
kind of data transformation you want.

Puppet does not have a *direct* solution to this particular problem, 
however.  It would be cleanest to write a custom function to do what this 
job, but it would be quicker to do it with an inline template (which you 
can consider a proof of concept for that function) something like this:

$nagios_users_string = inline_template("<%= @unifiedusers.select { |k, 
v| v['nagiosuser'] }.keys.join(',') %>")
$nagios_users = split($nagios_users_string, ',')


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/cbb81fb4-7023-4154-9810-ba81417f2751%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[Puppet Users] Problem with facter/ipaddress with puppet client 2.7

2014-12-23 Thread puppetstan
Hi,

On my centos6 and redhat6 i have puppet client update with puppet 2.7.25-2 
and facter-1.6.18-7 version with epel repo


My problem is with ipaddress facter, now i have


# facter
ipaddress => eth0  Link encap:Ethernet  HWaddr 
00:50:12:AZ:01:F9inet adr:172.17.03.21  Bcast:172.17.11.255  
Masque:255.255.255.0  adr inet6: fe80::250:56ff:feaf:f9/64 
Scope:Lien  UP BROADCAST RUNNING MULTICAST  MTU:1500  
Metric:1  RX packets:36042965 errors:0 dropped:0 overruns:0 
frame:0  TX packets:32410578 errors:0 dropped:0 overruns:0 
carrier:0  collisions:0 lg file transmission:1000   RX 
bytes:14080706754 (13.1 GiB)  TX bytes:41166159624 (38.3 GiB)loLink 
encap:Boucle localeinet adr:127.0.0.1  
Masque:255.0.0.0  adr inet6: ::1/128 Scope:Hâ–’te  UP 
LOOPBACK RUNNING  MTU:16436  Metric:1  RX packets:10055 errors:0 
dropped:0 overruns:0 frame:0  TX packets:10055 errors:0 dropped:0 
overruns:0 carrier:0  collisions:0 lg file transmission:0   
RX bytes:626380 (611.6 KiB)  TX bytes:626380 (611.6 KiB)


before i had

# facter
ipaddress => x.x.x.x


Can you have this problem with this puppet and facter version?

regards

-- 
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/d365a395-a472-41b9-ae25-31b7ddb08f87%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Puppet Users] Re: install directory for package, and other basic questions

2014-12-23 Thread Matyas A. Sustik
I revisited the issue a few weeks later and worked on it a couple hours.

1. I managed to write the scripts and manifest files that install and 
upgrade python2.7 into the alternate /usr/local/bin location. So this was a 
WIN!

2. I am still battling with pip. I tried to install pip2.7 using the script 
method and while that works, there is a serious roadblock: puppet does not 
pick up the pip installed this way. Even though /usr/local/bin is in the 
PATH for root, puppet says it cannot find pip. I even tried putting in a 
simlink from /usr/bin/pip to /usr/local/bin/pip, but strangely enough that 
does not make a difference.

3. While the script method works for python2.7, my solution cannot be 
called elegant or efficient. The install files are created every time 
unconditionally, even when the scripts do not get to be executed. I could 
not see an easy way to resolve this problem.

For reference I have:

class ... {
file { 'install_python-2.7.8':
path=> '/tmp/install_python-2.7.8.sh',
ensure  => file,
source  => "puppet:///modules/.../scripts/install_python-2.7.8.sh",
mode=> 0755,
}

# No python2.7 exists:
exec { 'install_python-2.7.8':
command => '/tmp/install_python-2.7.8.sh',
require => [File['/tmp/install_python-2.7.8.sh'],
Package['gcc-c++']],
creates => '/usr/local/bin/python2.7',
timeout => 1200,
}
}

The exec only runs when /usr/local/bin/python2.7 does not exist, but the 
installation script gets created on the nodes unconditionally.

I posted the above in case someone finds this useful. I also welcome 
comments and suggestions.

Best,
-Matyas

On Wednesday, November 5, 2014 4:36:36 PM UTC-8, Felix.Frank wrote:
>
>  On 10/21/2014 02:07 AM, Matyas A. Sustik wrote:
>  
> I follow up to my own post in case someone else encounters the same 
> questions.
>
> On Friday, October 10, 2014 8:50:34 PM UTC-7, Matyas A. Sustik wrote: 
>>
>> I am new to Puppet. I hoped someone in this group could get me on the 
>> right track with some questions I have.
>>
>> 1. I would appreciate an example demonstrating how to tell puppet to 
>> install a specific package in a specific location? For example, how to 
>> write that python2.7 should be installed in /usr/local/bin?
>>
>>  
> Puppet is not the right tool for this task according to our local 
> puppetmaster.
>  
>
> Oh you have deployed a talking puppet master? ;-)
>
>  Though he also said it can be done when I pressed him. But consider that 
> if an expert says it is too hard and you get 0 responses on google groups 
> you should think twice before embarking on this project: you will probably 
> put a lot of effort in and get stuck at some stage with no help in sight.
>
>   
> Yeah, this would most likely require
> a) creating a package that installs to that location or
> b) making Puppet build from source, but read below
>
>   2. How to install a python module, for example pandas? From the command 
>> line one could use pip. Does puppet know about pip?
>>
>>  
> You can specify pip to be used for the install. However, if you use 
> python2.7 then you want pip2.7 as well and so you are back to problem 1.
>  
>
> Yes. You might be able to coax the puppet agent into using a pip wrapper 
> that maps to pip2.7, but not in a flexible fashion.
>
>   
>
>> 3. How to install a package from the tarballs and specify some parameters 
>> to the install process?
>>
>>  
> Ultimately you can write a script that will be executed by puppet and do 
> anything you want. However the benefits puppet brings in this case compared 
> to the rest of the effort will not justify its use.
>  
>
> Indeed. Writing a script that compiles a software or does whatever, then 
> deploying and running it through Puppet, does not stricly qualify as 
> "solving something with Puppet".
>
> So, fair assessments all.
>
> Cheers,
> Felix
>  

-- 
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/cbe71bcb-39fd-4072-9206-6be282a2a2a4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Puppet Users] Re: install directory for package, and other basic questions

2014-12-23 Thread Felix Frank
Hey, thanks for sharing your experience.

On 12/24/2014 12:18 AM, Matyas A. Sustik wrote:
> The exec only runs when /usr/local/bin/python2.7 does not exist, but
> the installation script gets created on the nodes unconditionally.

That's actually well done. Barring that I have been doing things wrong
for quite a while (which happens), it is quite normal for agent nodes to
be littered with some files that are needed during provisioning only.
It's the most direct way to have Puppet make sure that the process works
from start to finish.

With that said, there is some cool work in progress to allow Puppet to
do that, and *not* define each state as permanent:
https://forge.puppetlabs.com/puppetlabs/transition

You should not use that in production yet, but more elegant solutions
are likely feasible in the foreseeable future.

Regards,
Felix

-- 
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/5499FDF5.1020106%40Alumni.TU-Berlin.de.
For more options, visit https://groups.google.com/d/optout.


Re: [Puppet Users] Problem with facter/ipaddress with puppet client 2.7

2014-12-23 Thread Felix Frank
On 12/23/2014 07:21 PM, puppetstan wrote:
>
> Can you have this problem with this puppet and facter version?

No, that's a pretty serious issue. Please note that Facter 1.6.x is
obsolete - from my gut feeling, it's even more dusty than Puppet 2.7.
Any chance for you to get Facter 1.7?

-- 
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/5499FE9E.3050604%40Alumni.TU-Berlin.de.
For more options, visit https://groups.google.com/d/optout.


Re: [Puppet Users] catalog-diff and create_resources not correct

2014-12-23 Thread Felix Frank
On 12/23/2014 10:36 AM, Johan De Wit wrote:
> The resource is indeed in both catalogs, only the old one contains 2
> automatic attributes (file: and line:).  I suspect this is the cause.

Hi Johan,

good call - I believe those are hints that the compiler adds, so that
the agent can give more helpful error output in case a resource fails
its validation checks.

Are you in a position to filter those from the "old" style catalogs
prior to diffing?

sed -i '/"line":|"file":/d' 

comes to mind :-)

HTH,
Felix

-- 
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/5499FFE3.4070409%40Alumni.TU-Berlin.de.
For more options, visit https://groups.google.com/d/optout.


Re: [Puppet Users] custom facts

2014-12-23 Thread Felix Frank
On 12/22/2014 04:39 PM, kaustubh chaudhari wrote:
> I was expecting o/p as.
>
> Disk_Size C: 30GB

So what do you get instead?

Have you added debug logging to your script to find out whether Facter
invokes it at all?

-- 
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/549A0280.20207%40Alumni.TU-Berlin.de.
For more options, visit https://groups.google.com/d/optout.


Re: [Puppet Users] Is it possible to run a custom function on irb (Interactive Ruby console)?

2014-12-23 Thread Felix Frank
On 12/20/2014 04:45 AM, Francois Lafont wrote:
> Hi,
>
> In a personal module of my puppetmaster (in the production environment),
> I have a custom function which I would like to run on irb (to make
> quick test, it would be so convenient). Is it possible?

Hmm, I honestly don't know, but the idea sounds sort of horrible to me :-)

Can you not solve this the other way around? Put the code you need in a
Ruby class that is globally available on your system.

require 'my/data_validator'
My::DataValidator.validate(@some_value)

The class is defined in /some/ruby/lib/dir/my/data_validator.rb

You can then refactor your parser function to use a variation of just
that pseudo code above.

HTH,
Felix

-- 
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/549A0526.6040006%40Alumni.TU-Berlin.de.
For more options, visit https://groups.google.com/d/optout.


Re: [Puppet Users] Issue with Defined Resource on Windows and Powershell

2014-12-23 Thread Felix Frank
On 12/19/2014 06:51 PM, Paul Ponzeka wrote:
>
> class win_ad_sites::install {
>
>  
>
>  realize (Win_ad_sites::Resource['SanFrancisco'])
>
>  
>
>  
>
>  }
>

Phew, this was difficult to read, at least in Thunderbird.

I believe your class should declare:

win_ad_sites::resource {
'SanFrancisco': ;
'NewYork': ;
'Uppsala': ;
}

Also, if you want to use the parameter as $adsite then it should not be
called $adsitevar.

define win_ad_sites::resource($adsite = $title) { ... }

This looks fine otherwise. Please note that with a sufficiently recent
Puppet master, you can get rid of anchors by using

contain win_ad_sites::install

instead of

include win_ad_sites::install

which even today you should prefer over class { 'win_ad_sites::install':
} ;-)

HTH,
Felix

-- 
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/549A0758.3080708%40Alumni.TU-Berlin.de.
For more options, visit https://groups.google.com/d/optout.


Re: [Puppet Users] multiple user creation with puppet module .

2014-12-23 Thread Felix Frank
Hi,

welcome to the list then.

On 12/19/2014 02:20 AM, Krushna Chandra Sahu wrote:
> In manifest folder, I have single file called  init.pp
>
> class users (
>
> )
>
> {
> group { "nextadmin":
> ensure => present,
> }
>
> define users::add ( $username , $groupname = "" , $shell = "",
>  $ensure  , $login =  )  {
> user { "$username":
> ensure => "$ensure" ,
> groups => "$groupname"  ,
> shell =>  "$shell" ,
> require => Group["nextadmin"]  ,
> }
> }
> }
>

First off, the define ... { } block should not be nested in the class
users { ... } block.

Create a manifests/add.pp file that holds only the define.

Verbs like "add" are misleading resource type names, for they imply an
action. You seldomly define actions in Puppet manifests. Instead, you
declare *state* that Puppet will manage for you. I suggest you go for
users::user or users::instance instead.

>
> Now to I have to create multiple user . Where and how to declare the
> username ,groupname etc in the same file ?

Once you have structured the manifests in a suitable fashion (as
described above), you can put this in a node { } block or any other
suitable manifest location:

users::user {
'jack':
ensure => present,
username => 'jack',
groupname => 'admins',
shell => '/bin/bash',
}
users::user {
'jill':
ensure => present,
username => 'jill',
groupname => 'operators',
shell => '/bin/bash',
}

HTH,
Felix

-- 
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/549A0A3D.10108%40Alumni.TU-Berlin.de.
For more options, visit https://groups.google.com/d/optout.


Re: [Puppet Users] catalog-diff and create_resources not correct

2014-12-23 Thread Johan De Wit

On 24/12/14 00:50, Felix Frank wrote:

On 12/23/2014 10:36 AM, Johan De Wit wrote:

The resource is indeed in both catalogs, only the old one contains 2
automatic attributes (file: and line:).  I suspect this is the cause.

Hi Johan,

good call - I believe those are hints that the compiler adds, so that
the agent can give more helpful error output in case a resource fails
its validation checks.

Are you in a position to filter those from the "old" style catalogs
prior to diffing?

sed -i '/"line":|"file":/d' 

comes to mind :-)

HTH,
Felix


Hi Felix,

That is a good idea as quick fix.  And why did I not think to that !! :)
Long term, such attributes should get excluded from the diff.

Time to delve into the ruby world :)

Grts

Johan


--
Johan De Wit

Open Source Consultant

Red Hat Certified Engineer  (805008667232363)
Puppet Certified Professional 2013/2014 (PCP006)
_
 
Open-Future Phone +32 (0)2/255 70 70

Zavelstraat 72  Fax   +32 (0)2/255 70 71
3071 KORTENBERG Mobile+32 (0)474/42 40 73
BELGIUM http://www.open-future.be
_
 


Next Events:
Zabbix Certified Training | 
http://www.open-future.be/zabbix-certified-specialist-training-5th-till-7th-january
Zabbix Certified Professional | 
http://www.open-future.be/zabbix-certified-professional-training-8th-till-9th-janaury
Bacula Administrator 1 | 
http://www.open-future.be/bacula-administrator-i-training-13th-till-15th-january
Puppet Fundamentals | 
http://www.open-future.be/puppet-fundamentals-training-26th-till-28th-january
Puppet Architect | 
http://www.open-future.be/puppet-architect-training-29th-till-30th-january
Subscribe to our newsletter | http://eepurl.com/BUG8H

--
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/549A5EFB.3070906%40open-future.be.
For more options, visit https://groups.google.com/d/optout.