[Puppet Users] Fact precedence in modules

2012-11-05 Thread Abhijeet R

Hi guys,

I am trying to understand fact precedence and pluginsync.
Documentation says, by default, the weight of a fact is the number of 
confines for that fact, so that more specific facts are evaluated first.


1. I made a module "core" which adds a facter "test" and has filename 
test.rb. (in location modules/core/lib/facter/test/test.rb). Note that 
facter is in "test" folder.

2. This above module "core" is included in all nodes.
3. Another module "newmod" also adds the facter "test" & has the 
filename test.rb but this time, location is modules/core/lib/facter/test.rb.


In all the nodes, first "include core" comes and then "include newmod" 
comes. When I see the facter value, the newmod's file is run. Why?


Pluginsync syncs both files and one exists in root of 
"/var/lib/puppet/lib/facter" while the other exists in 
"/var/lib/puppet/lib/facter/test" folder. Running strace reveals that 
facter command opens both test.rbs but somehow selects the correct one.


The behaviour that's happening is expected but I am trying to understand 
why is this happening.  Please note that nowhere in the code of adding 
facts, I am using has_weight.


--
Cheers,
Abhijeet R
http://blog.abhijeetr.com

--
You received this message because you are subscribed to the Google Groups "Puppet 
Users" group.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.



Re: [Puppet Users] Bug when using array in file resource?

2012-11-05 Thread pdurkin
Thanks John, I'll inline my responses

Paul

On Monday, November 5, 2012 6:26:55 PM UTC+4, jcbollinger wrote:
>
>
>
> On Monday, November 5, 2012 12:37:45 AM UTC-6, pdurkin wrote:
>>
>> I'm not convinced that Justin wasn't correct about this being a bug.  I'm 
>> having a similar issue
>>
>
>
> How many people do you need to tell you that the behavior you observe is 
> intended?  File a ticket against the documentation if you like, but the 
> behavior is as designed, well-entrenched, broadly relied-upon, and useful.
>
I think I understand where my confusion comes from.  I read the same 
document as Justin, at: 
http://docs.puppetlabs.com/guides/language_guide.html the section on 
Resources states " Resources describe some aspect of a system; it might be 
a file, a service, a package" then further in the same section: "Most 
resources have an attribute (often called simply name) whose value will 
default to the title if you don’t specify it. (Internally, this is called 
the “namevar.”) For the file type, the path will default to the title".  It 
uses "name", "title" and "namevar" but these are not referring to variables 
but to attributes and parts of the resource.  They are referred to later as 
variables on the same page but only in respect to defined resources and 
classes, so I guess that is why I assumed they were variables everywhere.

In answer to your question of how many people, so far you are the first to 
say it is intended and a misinterpretation of the documentation.  Nans post 
simply said that $name is not the file resource title, nothing about 
intentions or design, and I'm obviously not alone on my misinterpretation 
of the documentation since this thread and the blog post both have the same 
point.

>
>  
>
>>
>> class myclass (...) {
>>
>>   # some extra stuff here
>>
>>   $file_list = [ 'a', 'b' ..., 'n' ]
>>   file { $file_list : 
>>ensure => 'file',
>>source => "puppet://modules/myclass/$title",
>>path   => "/tmp/$title"
>>   }
>>
>> results in the "cannot alias file [a] to [/tmp/myclass]".  For some 
>> reason the resource title in my file is resolving to the class name rather 
>> than the file name.
>>
>
>
> Yes.  That's as it should be.  Variables are always resolved in the 
> innermost scope in which they appear.  Other than the top-level scope, 
> scopes are established only by node bocks, definition bodies, and class 
> bodies.  In particular, they are *not* established by resource 
> declarations such as your example file declaration.  Nor is there a 
> functionality gap -- Nan already explained how to get the behavior you want.
>
>  
>
>>
>> The solution provided above seems to change the semantics.  myclass 
>> becomes a defined type instead and the list of files is moved outside and 
>> passed in as multiple instances are created.  That's a work around.
>>
>
>
> You are hypothesizing an implementation to criticize, instead of 
> considering how to model your problem in a way that harmonizes with 
> Puppet.  Consider this:
>
> define mymodule::modulefile() {
>   file { $name : 
> ensure => 'file',
> source => "puppet:///mymodule/$name",
> path   => "/tmp/$name"
>   }
> }
>
> class mymodule::myclass {
>   $file_list = [ 'a', 'b' ..., 'n' ]
>   mymodule::modulefile { $file_list : }
> }
>
> Your class remains a class, and continues to define the file list itself.  
> The definition 'mymodule::modulefile' represents a type of file that has 
> the particular relationship you want between its 'path' and 'source'.
>  
>
Yes, you are correct, sorry.  I'm not trying to hypothesize, I didn't find 
Nans solution as clear as you have written it here.  It seemed to me that 
he was suggesting rewriting the class as a defined type rather than 
creating a new defined type and using it in the class.  The solution 
provided uses a defined type to create a new scope so that the variable 
'name' gets the value required.  Name can then be used in the resource 
declaration as I tried to do it directly in the class.

It's a pity there's no way to refer to the title of a resource in the 
declaration since that would be a more concise (and presumably then 
clearer) way to have defined all the files.  I understand your analogy 
below about functions and resource declarations however I'm not yet adept 
enough with puppet to start recognising how it is implemented, for the 
moment I'm still having to read documentation and ask questions.

>
>> Another would be to not use a list and simply define each file separately 
>> in the class, that avoids having to use the $title to abstract the 
>> definition into a single resource definition.  I can do that quite easily 
>> but in my case I have about 100 files so it makes this much less readable.  
>> Found someone had already explained the issue here: 
>> http://www.nico.schottelius.org/blog/puppet-name-is-not-as-expected-but-classname/
>> .
>>
>> Does anyone have an answer as to why $title in this case is resolving to 

[Puppet Users] Re: Class dependencies

2012-11-05 Thread Hiu
Thanks for the info.


Do you have more descriptive explanation on the anchor pattern? From what 
you have pasted on this link isn't sound descriptive. Or can you give me a 
pattern of codes instead? thanks!



On Tuesday, 6 November 2012 13:07:53 UTC+8, Nick Fagerlund wrote:
>
> Yup, this is the classes-can't-contain-classes problem. It sucks, everyone 
> runs into it eventually, and it's explained in detail here: 
>
>
> http://docs.puppetlabs.com/puppet/3/reference/lang_containment.html#known-issues
>
> http://projects.puppetlabs.com/issues/8040
>
> You'll need to use the "anchor pattern" (
> http://docs.puppetlabs.com/puppet/3/reference/lang_containment.html#workaround-the-anchor-pattern)
>  
> to ensure that the interior classes get "held" in place inside their 
> wrapper class. 
>
> The platform development team uses votes in our issue tracker to help 
> decide what they'll focus on next. If this problem bothered you a lot, 
> please vote for issue 8040 here: 
> http://projects.puppetlabs.com/issues/8040
>
> Sorry for the inconvenience, and good luck. 
>
> N
>
> On Monday, November 5, 2012 8:51:28 PM UTC-8, Hiu wrote:
>>
>> hi all,
>>
>> How are you? I have a question on the class dependencies.
>>
>> This is my init.pp script looks like
>>
>> class mapr {
>> Class['mapr::install'] -> Class["mapr::config"]
>>
>> include mapr::install,
>> mapr::config
>>
>> }
>>
>> In my mapr::install class i have another few lines of includes statement 
>> to install different packages. Same goes to mapr::config. My Class 
>> dependency is not working at all when i put 
>>
>>  Class['mapr::install'] -> Class["mapr::config"]
>>
>> It executed config first before install, which is the one that i wish to 
>> do. 
>>
>> can anyone educate me on this? thanks! 
>>
>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/puppet-users/-/OQwkgM7kEPEJ.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.



[Puppet Users] Re: Class dependencies

2012-11-05 Thread Nick Fagerlund
Yup, this is the classes-can't-contain-classes problem. It sucks, everyone 
runs into it eventually, and it's explained in detail here: 

http://docs.puppetlabs.com/puppet/3/reference/lang_containment.html#known-issues

http://projects.puppetlabs.com/issues/8040

You'll need to use the "anchor pattern" 
(http://docs.puppetlabs.com/puppet/3/reference/lang_containment.html#workaround-the-anchor-pattern)
 
to ensure that the interior classes get "held" in place inside their 
wrapper class. 

The platform development team uses votes in our issue tracker to help 
decide what they'll focus on next. If this problem bothered you a lot, 
please vote for issue 8040 here: http://projects.puppetlabs.com/issues/8040

Sorry for the inconvenience, and good luck. 

N

On Monday, November 5, 2012 8:51:28 PM UTC-8, Hiu wrote:
>
> hi all,
>
> How are you? I have a question on the class dependencies.
>
> This is my init.pp script looks like
>
> class mapr {
> Class['mapr::install'] -> Class["mapr::config"]
>
> include mapr::install,
> mapr::config
>
> }
>
> In my mapr::install class i have another few lines of includes statement 
> to install different packages. Same goes to mapr::config. My Class 
> dependency is not working at all when i put 
>
>  Class['mapr::install'] -> Class["mapr::config"]
>
> It executed config first before install, which is the one that i wish to 
> do. 
>
> can anyone educate me on this? thanks! 
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/puppet-users/-/rsa7EtHZLUsJ.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.



[Puppet Users] Class dependencies

2012-11-05 Thread Hiu
hi all,

How are you? I have a question on the class dependencies.

This is my init.pp script looks like

class mapr {
Class['mapr::install'] -> Class["mapr::config"]

include mapr::install,
mapr::config

}

In my mapr::install class i have another few lines of includes statement to 
install different packages. Same goes to mapr::config. My Class dependency 
is not working at all when i put 

 Class['mapr::install'] -> Class["mapr::config"]

It executed config first before install, which is the one that i wish to 
do. 

can anyone educate me on this? thanks! 


-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/puppet-users/-/P4lthJvxmsgJ.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.



[Puppet Users] Announce: Puppet Dashboard 1.2.13 Available

2012-11-05 Thread Matthaus Owens
Puppet Dashboard 1.2.13 is a maintenance and bugfix release of Puppet Dashboard.

This release is available for download at:
https://downloads.puppetlabs.com/dashboard/puppet-dashboard-1.2.13.tar.gz

Debian packages are available at
https://apt.puppetlabs.com

RPM packages are available at
https://yum.puppetlabs.com

See the Verifying Puppet Download section at:
http://projects.puppetlabs.com/projects/puppet/wiki/Downloading_Puppet

Please report feedback via the Puppet Labs Redmine site, using an
affected version of 1.2.13:
http://projects.puppetlabs.com/projects/dashboard

Documentation is available at:
http://docs.puppetlabs.com/dashboard/index.html

===
## Puppet Dashboard 1.2.13 Bug Fixes ##
===
(#17161) Fix stylesheet URLs for IE colorbox images
The colorbox CSS looks for the IE images in
/images/internet_explorer. The correct location is
/stylesheets/images/internet_explorer.

Update debian and redhat init script to use INT instead of term to stop

Previously the debian init script didn't pass --signal to the
start-stop-daemon, which defaults to TERM. Dashboard runs out of webrick by
default, which catches and ignores TERM, but will respond to INT and stop
sanely. Currently, running 'service puppet-dashboard stop' returns

[2012-03-27 10:24:17] ERROR SignalException: SIGTERM
/usr/lib/ruby/1.8/webrick/server.rb:91:in `select'

and then waits for the retry timeout, at which point
start-stop-daemon SIGKILLs
the ruby process. If --signal is set to INT in the init script, running
'service puppet-dashboard stop' returns

[2012-03-27 10:28:35] INFO  going to shutdown ...
[2012-03-27 10:28:35] INFO  WEBrick::HTTPServer#start done.
Exiting

which is the expected behavior.

The redhat init script suffered from a similar problem, adding -INT to the
killproc call speeds up the `service puppet-dashboard stop` call as killproc
doesn't need to wait and see if the process has ended, as INT is
responded to
immediately by webrick.

(#9296) Fix loading rack for rubygems >= 1.8

Rubygems version 1.8 broke some of the ways vendored gems used to
work in Rails
2. This commit updates the config/environment.rb to add all of the
gem libs to
the rails autoload_paths. It also updates the actionpack action_controller
library to not call out to gem explicitly. We know that the correct rack
version is being supplied in the vendored gems, so the following
require 'rack'
line will succeed.

This also munges the load path in config/boot.rb because boot.rb
doesn't load
environment.rb right away, and so can't find rack, due to the same
gem problem.
So this uses the same loop as in environment.rb, but instead of the rails
autoload_paths, it adds the libs to $:, or $LOAD_PATH.

===
## Puppet Dashboard 1.2.13 Changelog ##
===

Branan Purvine-Riley (1):
  c2e4a4a (#17161) Fix stylesheet URLs for IE colorbox images

Matthaus Owens (3):
  a3f2588 (#9296) Fix loading rack for rubygems >= 1.8
  5378b46 Update debian and redhat init script to use INT instead
of term to stop
  7a38e19 Updating CHANGELOG, VERSION for 1.2.13. Updating .gitignore

Moses Mendoza (1):
  ee6d3c3 Update VERSION, CHANGELOG for 1.2.13-rc1

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.



[Puppet Users] Re: Puppet 3 on OSX, using Puppet gem and running as sudo requires puppet group/user

2012-11-05 Thread Eric Sorenson
Hi Jean, you can track this issue under bug #9862 
- https://projects.puppetlabs.com/issues/9862

So, yes you will need root or sudo to edit /etc/shells, that is just unix 
permissions at work; as an immediate workaround to the error you see with 
sudo you can run with '--group 0' (a number zero/null) on your command line.

-=Eric

On Friday, November 2, 2012 4:26:04 AM UTC-7, JeanMertz wrote:
>
> I'm trying to setup a Puppet script that bootstraps my development machine 
> with some basic installs like Zsh shell, Vim, etc…
>
> I have these things working without using sudo to run puppet. However, now 
> I need to modify /etc/shells to add the zsh shell to this list, but to edit 
> this file, I need root rights, or else Puppet complaints:
>
> Error: Permission denied - /etc/shells.puppettmp_133
> Error: /Stage[main]/Terminal/File[/etc/shells]/content: change from 
> {md5}5fdb14bf853cd42fddc0ad142f09ca0f to 
> {md5}296f3802eb243ce49756d1380f997cba failed: Permission denied - 
> /etc/shells.puppettmp_133
>
> Because of this, I tried running puppet as sudo, but now Puppet complaints 
> that there is no "puppet" group present.
>
> Error: /File[/var/lib/puppet/log]: Could not evaluate: Could not find 
> group puppet
> Debug: Finishing transaction 70276890808620
> Error: Got 1 failure(s) while initializing: Could not evaluate: Could not 
> find group puppet
>
> (I also tried setting the --logdest parameter to something that is 
> accessible by any user, but that didn't work either)
>
>
> I'd like to keep my installation clean, and would love for puppet to run 
> without having to add extra users/groups to my OS X installation. However, 
> I guess it would be possible to create the user/group and remove them after 
> the installation, but then the command listed on the installation page for 
> puppet doesn't work:
>
> sudo puppet resource user puppet ensure=present gid=puppet 
> shell='/sbin/nologin'
> # => Error: Could not run: undefined method `string' for nil:NilClass
>
> So my question is this: is there any way to run puppet on a single machine 
> without using the puppet user/group (it worked without sudo, but doesn't 
> when using sudo). And if not, what would be the best way to get things 
> running and reset to a clean slate (ie. no extra users/groups/folders) 
> after the installation is done?
>

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/puppet-users/-/tlYxvXQXFEkJ.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.



[Puppet Users] Re: Run Exec without notifying Puppet as a change

2012-11-05 Thread llowder


On Monday, November 5, 2012 3:03:57 PM UTC-6, Thomas Biddle wrote:
>
> I just switched from an in-house APT module to the Puppetlabs one thinking 
> that it may solve this, but after looking at the code (And installing to 
> confirm) it did not.
>
> Seeing Puppet be notified of a "change" just when `apt-get update` is run 
> is a bit annoying to me. I was wondering if there was a way to avoid 
> notifying Puppet of a change when an Exec command is run? (Or if there's 
> another way we can run this)
>  
>
TJ
>

ONly way I know of is to use a fake exec (calling /bin/true or /bin/false 
(so it'll raise an error if it does get called) or something like that.) 
and use an only if with the real command (the update).

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/puppet-users/-/rSh7yc3i0psJ.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.



[Puppet Users] Re: Apply multiple defines in sequence

2012-11-05 Thread Erwin Bogaard
John and Tim, thanks for your replies and patience.
In the end, the solution of Tim seems to work great! That was what I was 
looking for: a relatively straight solution to a relatively straight 
problem (at least, that was what I thought to improve the previous 
situation).
As a novice to intermediate Puppet user, I've again learned a lot about 
writing some nice manifests and getting things done the way I want to.


On Thursday, November 1, 2012 3:27:10 PM UTC+1, Erwin Bogaard wrote:
>
> I'm having trouble getting the following scenario to work:
> - I have two defines, for example 'sugar' and 'wordpress'.
> - Some nodes need to have both applied, others only sugar.
> - Because you can't use the same resource twice (not that I want to), I 
> can't figure out how to apply two separate defines to one resource
>
> At  the moment I use the following workaround: I have two defines, one 
> with only sugar and one with both sugar and wordpress. As I have to change 
> both files if I change something for Sugar, this really isn't optimal.
> Anyone a suggestion?
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/puppet-users/-/rrpE72obmHwJ.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.



[Puppet Users] Re: Apply multiple defines in sequence

2012-11-05 Thread jcbollinger


On Monday, November 5, 2012 2:17:11 PM UTC-6, Erwin Bogaard wrote:
>
> As I'm in over my head, let's supply you with (part of) the manifests in 
> question:
>
> The define:
>
> define sugar::definitions_sug_wp (
>   $template   = 'sugar/etc/httpd/conf.d/sugar6x.conf.erb',
>   $client_domain  = "$title",
>   $mysql_rootpwd  = "$mysql_password",
>   $mysql_dbname,
>   $mysql_pwd,
>   $sugar_admin,
>   $sugar_pwd,
>
> ) {
>
> # This is for example to create the httpd.conf and the sugar-folder. So 
> this has to be in both. As you can see, I parametrized the httpd-conf, so I 
> can specify it in my class. Also, the  ${client_domain}-variable is used 
> throughout this define.
> file {
> "/etc/httpd/conf.d/sug-${client_domain}.conf":
>   content => template($template),
>   owner   => 'root',
>   group   => 'root',
>   mode=> '0644',
>   notify  => Service['httpd'];
> "/var/log/sugar/${client_domain}":
>   ensure  => 'directory';
>}
>
>
> # The following is specific to the WordPress-installation and doesn't need 
> to be applied to every machine. So this part isn't in the define 'define 
> sugar::definitions_sug'.
> file {
> # Configuratie van publieke html
> "/var/www/html/${client_domain}":
>   owner   => 'apache',
>   group   => 'apache',
>   mode=> '0744',
>   ensure  => 'directory';
> # Configuratiefile WordPress
> "/var/www/html/${client_domain}/wp-config.php":
>   owner   => 'apache',
>   group   => 'apache',
>   mode=> '0744',
>   require => File["/var/www/html/${client_domain}"],
>   content => template('sugar/wordpress/wp-config.php.erb');
>
> I call both defines ('sugar::definitions_sug_wp' and 'define 
> sugar::definitions_sug') in the following class:
> class sugar::instances {
>
> sugar::definitions_sug {
> # SugarCRM - ECM2
> 'node1':
>   mysql_dbname => 'dbname1',
>   mysql_pwd=> 'password1';
>
> sugar::definitions_sug_wp {
> 'node2':
>   sugar_admin  => 'text1',
>   sugar_pwd=> 'password2',
>   mysql_dbname => 'dbname2',
>   mysql_pwd=> 'password3';
>
> I include this class on one node to get several sugar-only vhosts and 
> several sugar+wordpress-nodes on that node.
>
> Hope this helps you explain things to me!
>
>

You're still making me guess about what the actual problem is.  Have you 
actually tried anything, or is this all hypothetical?  If you tried and 
failed, then what error messages were produced?

Bits and pieces of your manifests are not particularly helpful.  I'm 
looking for something manageable that provides a complete example of the 
problem.  Ideally something as stripped-down as possible.  If you are 
totally new to Puppet then you might consider playing with a simplified 
model before moving on to a full-blown solution.

My best guess at this point is that the problem -- if there is one -- 
concerns resources that both your definitions declare, such that you get 
duplicate resource declarations if you try to instantiate some combinations 
of those definitions.  I suggested such a problem a couple of posts ago, 
however, and you more or less ignored it.

If duplicate resource declarations are indeed the problem then the solution 
is simple: don't do that!  Every managed resource should have exactly one 
owner -- generally either a class or defined-type instance.  Resources 
should be declared only by their owners.  If you stick to that -- 
remembering that defined-type instances are themselves resources -- then 
you will not have problems with duplicate resource declarations.

So, what obstacles must you overcome to (re-)structure your manifests so 
that each resource has exactly one owner?  (Not a rhetorical question.)  
Virtual resources and conditionals are some of the tools at your disposal 
for overcoming such obstacles, but it's all about how you use them.  In 
particular, just making a declaration virtual does not inherently prevent 
duplicate declaration issues.

Tim's suggestion of combining the definitions and using a parameter to 
direct whether to include WordPress components would be one possible 
solution.  There are several others.  Which would be best depends on the 
details of the problem.


John

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/puppet-users/-/XGFuEULdHvcJ.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.



Re: [Puppet Users] Re: err: Could not request certificate when I run "puppet device"

2012-11-05 Thread fatmcgav
Try changing the file owner/group to match what you're running puppet as...

Gav

On 5 November 2012 20:51, meiji wang  wrote:

> Although I change the mode to 0777, Puppet forces the mode to 0750
>
> debug: /File[/var/opt/lib/pe-puppet/devices/certname/state]: Autorequiring
> File[/var/opt/lib/pe-puppet/devices/certname]
> debug: /File[/var/opt/lib/pe-puppet/devices/certname/clientbucket]/mode:
> mode changed '0777' to '0750'
> debug: /File[/var/opt/lib/pe-puppet/devices/certname/ssl]/mode: mode
> changed '0777' to '0771'
> debug: /File[/var/opt/lib/pe-puppet/devices/certname/ssl/private]/mode:
> mode changed '0777' to '0750'
> debug: /File[/var/opt/lib/pe-puppet/devices/certname/state]/mode: mode
> changed '0777' to '1755'
> debug:
> /File[/var/opt/lib/pe-puppet/devices/certname/ssl/private_keys]/mode: mode
> changed '0777' to '0750'
> debug: /File[/var/opt/lib/pe-puppet/devices/certname/client_yaml]/mode:
> mode changed '0777' to '0750'
> debug: /File[/var/opt/lib/pe-puppet/devices/certname/client_data]/mode:
> mode changed '0777' to '0750'
> info: Creating a new SSL key for certname
> ..
> err: Could not request certificate: Could not write
> /var/opt/lib/pe-puppet/devices/certname/ssl/private_keys/certname.pem to
> privatekeydir: Permission denied -
> /var/opt/lib/pe-puppet/devices/certname/ssl/private_keys/certname.pem
>
>
> then Puppet throws error message..
>
> Meiji
>
>
> On Monday, November 5, 2012 8:18:03 AM UTC-8, meiji wang wrote:
>>
>> 1.   I get the following error when I run “puppet device’
>>
>> err: Could not request certificate: Could not write
>> /var/opt/lib/pe-puppet/**devices/certname/ssl/private_**keys/certname.pem
>> to privatekeydir: Permission denied - /var/opt/lib/pe-puppet/**
>> devices/certname/ssl/private_**keys/certname.pem
>>
>> Any thought?
>>
>>
>> Thanks,
>>
>  --
> You received this message because you are subscribed to the Google Groups
> "Puppet Users" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/puppet-users/-/CEDQ4q9o5uEJ.
> To post to this group, send email to puppet-users@googlegroups.com.
> To unsubscribe from this group, send email to
> puppet-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/puppet-users?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.



[Puppet Users] Run Exec without notifying Puppet as a change

2012-11-05 Thread Thomas Biddle
I just switched from an in-house APT module to the Puppetlabs one thinking 
that it may solve this, but after looking at the code (And installing to 
confirm) it did not.

Seeing Puppet be notified of a "change" just when `apt-get update` is run 
is a bit annoying to me. I was wondering if there was a way to avoid 
notifying Puppet of a change when an Exec command is run? (Or if there's 
another way we can run this)

TJ

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/puppet-users/-/fN1guXxULUMJ.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.



[Puppet Users] Re: err: Could not request certificate when I run "puppet device"

2012-11-05 Thread meiji wang
Although I change the mode to 0777, Puppet forces the mode to 0750

debug: /File[/var/opt/lib/pe-puppet/devices/certname/state]: Autorequiring 
File[/var/opt/lib/pe-puppet/devices/certname]
debug: /File[/var/opt/lib/pe-puppet/devices/certname/clientbucket]/mode: 
mode changed '0777' to '0750'
debug: /File[/var/opt/lib/pe-puppet/devices/certname/ssl]/mode: mode 
changed '0777' to '0771'
debug: /File[/var/opt/lib/pe-puppet/devices/certname/ssl/private]/mode: 
mode changed '0777' to '0750'
debug: /File[/var/opt/lib/pe-puppet/devices/certname/state]/mode: mode 
changed '0777' to '1755'
debug: 
/File[/var/opt/lib/pe-puppet/devices/certname/ssl/private_keys]/mode: mode 
changed '0777' to '0750'
debug: /File[/var/opt/lib/pe-puppet/devices/certname/client_yaml]/mode: 
mode changed '0777' to '0750'
debug: /File[/var/opt/lib/pe-puppet/devices/certname/client_data]/mode: 
mode changed '0777' to '0750'
info: Creating a new SSL key for certname
..
err: Could not request certificate: Could not write 
/var/opt/lib/pe-puppet/devices/certname/ssl/private_keys/certname.pem to 
privatekeydir: Permission denied - 
/var/opt/lib/pe-puppet/devices/certname/ssl/private_keys/certname.pem


then Puppet throws error message..

Meiji


On Monday, November 5, 2012 8:18:03 AM UTC-8, meiji wang wrote:
>
> 1.   I get the following error when I run “puppet device’
>
> err: Could not request certificate: Could not write 
> /var/opt/lib/pe-puppet/devices/certname/ssl/private_keys/certname.pem to 
> privatekeydir: Permission denied - 
> /var/opt/lib/pe-puppet/devices/certname/ssl/private_keys/certname.pem
>
> Any thought?
>
>
> Thanks,
>

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/puppet-users/-/CEDQ4q9o5uEJ.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.



[Puppet Users] Re: shouldn't this be considered a bug?

2012-11-05 Thread jcbollinger


On Monday, November 5, 2012 2:06:09 PM UTC-6, Jist Anidiot wrote:
>
> So I thought puppet didn't care about the order of things unless 
> specifically told.  However I've come across one case where it apparently 
> does care.
>


You had a serious misunderstanding.  Puppet has numerous sensitivities to 
the order in which it parses declarations in your manifests.  You were 
probably thinking about how Puppet does not promise to apply resources in 
any particular order unless you tell it otherwise by declaring 
relationships, but there it's *you* who may not care, not Puppet.

 

>
> This "works" as expected:
>
> node /^univ\d+\.foo\.edu$/ {
>
> $myvar = "foo"
>
> include module_that_uses_myvar
>
> }
>
>
> This one doesn't "work" as expected
>
>
> node /^univ\d+\.foo\.edu$/ {
>
> include module_that_uses_myvar
>
> $myvar = "foo"
>
> }
>
> In the 2nd one, module_that_uses_myvar seems to think $myvar is undef or 
> null or something that is most certainly not "foo" If it matters any, 
> $myvar is actually used in an erb template that the module has.  Our puppet 
> master is 2.7.12 and the client is 2.6.17.
>
> I didn't see any bug reports about this.  Is this a known problem or just 
> not considered a bug?
>


It is not considered a bug.  It is the manifest author's responsibility to 
ensure that any reference to a class, resource, or variable is preceded by 
a declaration of that entity in Puppet's parse order.

Use of dynamically-scoped variables is considered poor practice, however, 
including any use of node-scoped variables outside their node blocks.  Your 
v. 2.7 master ought to be emitting warnings about that.


John

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/puppet-users/-/28RuMye2nc8J.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.



Re: [Puppet Users] Re: Apply multiple defines in sequence

2012-11-05 Thread Tim Mooney

In regard to: [Puppet Users] Re: Apply multiple defines in sequence, Erwin...:


Thanks again for you reply, but it seems like you don't fully understand
what I'm having problems with. So I'll try to clarify it a little more:
1. The current way of using two defines is working flawlessly. So I (at
least partly) understand the concepts surrounding those.
2. Because I have two types of machines: some with just sugar and some with
sugar and wordpress, I now use two defines that overlap in part (define1
contains all kinds of info about creating sugar db + unpacking tar, etc,
while define2 contains all the sugar info of define1 + stuff about creating
a wordpress db + unpacking wp tar, etc), this means editing two files when
I change something in the sugar define.


So have one additional parameter to your define,

sugar_with_wordpress => 'no'

and then in the body of your define, after you've done all the necessary
setup for sugar, that is always present, have

  if $sugar_with_wordpress == 'yes' {
 # wordpress-specific stuff here
  }

I use yes/no strings instead of boolean true/false because you'll
eventually want to have those settings come from hiera, and as things
currently stand booleans from hiera are just a trap for the unwary.

I would actually do the wordpress stuff as a separate class, which has
its own wordpress::instance define, and then call that define from within
your sugar::instance define.

Tim
--
Tim Mooney tim.moo...@ndsu.edu
Enterprise Computing & Infrastructure  701-231-1076 (Voice)
Room 242-J6, IACC Building 701-231-8541 (Fax)
North Dakota State University, Fargo, ND 58105-5164

--
You received this message because you are subscribed to the Google Groups "Puppet 
Users" group.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.



[Puppet Users] Re: Apply multiple defines in sequence

2012-11-05 Thread Erwin Bogaard
After my previous post, I did some more thinking and reasearch. What do you 
think about:
- using an if/else-conditional. Would that work?
- using virtual resources? would that work?

On Monday, November 5, 2012 9:17:11 PM UTC+1, Erwin Bogaard wrote:
>
> As I'm in over my head, let's supply you with (part of) the manifests in 
> question:
>
> The define:
>
> define sugar::definitions_sug_wp (
>   $template   = 'sugar/etc/httpd/conf.d/sugar6x.conf.erb',
>   $client_domain  = "$title",
>   $mysql_rootpwd  = "$mysql_password",
>   $mysql_dbname,
>   $mysql_pwd,
>   $sugar_admin,
>   $sugar_pwd,
>
> ) {
>
> # This is for example to create the httpd.conf and the sugar-folder. So 
> this has to be in both. As you can see, I parametrized the httpd-conf, so I 
> can specify it in my class. Also, the  ${client_domain}-variable is used 
> throughout this define.
> file {
> "/etc/httpd/conf.d/sug-${client_domain}.conf":
>   content => template($template),
>   owner   => 'root',
>   group   => 'root',
>   mode=> '0644',
>   notify  => Service['httpd'];
> "/var/log/sugar/${client_domain}":
>   ensure  => 'directory';
>}
>
>
> # The following is specific to the WordPress-installation and doesn't need 
> to be applied to every machine. So this part isn't in the define 'define 
> sugar::definitions_sug'.
> file {
> # Configuratie van publieke html
> "/var/www/html/${client_domain}":
>   owner   => 'apache',
>   group   => 'apache',
>   mode=> '0744',
>   ensure  => 'directory';
> # Configuratiefile WordPress
> "/var/www/html/${client_domain}/wp-config.php":
>   owner   => 'apache',
>   group   => 'apache',
>   mode=> '0744',
>   require => File["/var/www/html/${client_domain}"],
>   content => template('sugar/wordpress/wp-config.php.erb');
>
> I call both defines ('sugar::definitions_sug_wp' and 'define 
> sugar::definitions_sug') in the following class:
> class sugar::instances {
>
> sugar::definitions_sug {
> # SugarCRM - ECM2
> 'node1':
>   mysql_dbname => 'dbname1',
>   mysql_pwd=> 'password1';
>
> sugar::definitions_sug_wp {
> 'node2':
>   sugar_admin  => 'text1',
>   sugar_pwd=> 'password2',
>   mysql_dbname => 'dbname2',
>   mysql_pwd=> 'password3';
>
> I include this class on one node to get several sugar-only vhosts and 
> several sugar+wordpress-nodes on that node.
>
> Hope this helps you explain things to me!
>
>
>
> On Monday, November 5, 2012 3:41:37 PM UTC+1, jcbollinger wrote:
>>
>>
>>
>> On Monday, November 5, 2012 3:48:58 AM UTC-6, Erwin Bogaard wrote:
>>>
>>> Thanks again for you reply, but it seems like you don't fully understand 
>>> what I'm having problems with. So I'll try to clarify it a little more:
>>> 1. The current way of using two defines is working flawlessly. So I (at 
>>> least partly) understand the concepts surrounding those.
>>> 2. Because I have two types of machines: some with just sugar and some 
>>> with sugar and wordpress, I now use two defines that overlap in part 
>>> (define1 contains all kinds of info about creating sugar db + unpacking 
>>> tar, etc, while define2 contains all the sugar info of define1 + stuff 
>>> about creating a wordpress db + unpacking wp tar, etc), this means editing 
>>> two files when I change something in the sugar define. As this can lead to 
>>> differing configurations because of editing errors (and always twice the 
>>> work), I would like to be able to split the defines up, so I can call 
>>> define1 (sugar) on all machines and define1 (sugar) and sefine 2 
>>> (wordpress) on the other machines.
>>> 3. Some of the variables are shared, for example the mysqld_pwd is used 
>>> twice, and I add a different suffix for sugar and wordpress to get two 
>>> databases. For the httpd-configuration, I specify a different template, 
>>> which is easy to to with defines. So all instances have unique resources, 
>>> hence the choice for defines, not classes.
>>>
>>> Does this help you help me?
>>>
>>
>>
>> No, not really.  You have been relatively clear about what you are trying 
>> to accomplish, but I don't understand what is preventing you from 
>> accomplishing it.  Perhaps that means you're stumbling over something that 
>> seems trivial to me.  For example, if the real question is how to share 
>> data between two or more defined types, then you have at least three 
>> choices:
>>
>>1. Define the data in a class, and have each definition reference the 
>>class variables instead of taking that data in the form of parameters.
>>2. Externalize the data (e.g. into an Hiera data store), and have 
>>each definition reference the needed values by the same fixed key.
>>3. Record the data in global variables, and have each definition 
>>reference the global values.  (I wouldn't recommend this one except as a 
>>temporary hack.)
>>
>> If tha

[Puppet Users] Re: Apply multiple defines in sequence

2012-11-05 Thread Erwin Bogaard
As I'm in over my head, let's supply you with (part of) the manifests in 
question:

The define:

define sugar::definitions_sug_wp (
  $template   = 'sugar/etc/httpd/conf.d/sugar6x.conf.erb',
  $client_domain  = "$title",
  $mysql_rootpwd  = "$mysql_password",
  $mysql_dbname,
  $mysql_pwd,
  $sugar_admin,
  $sugar_pwd,

) {

# This is for example to create the httpd.conf and the sugar-folder. So 
this has to be in both. As you can see, I parametrized the httpd-conf, so I 
can specify it in my class. Also, the  ${client_domain}-variable is used 
throughout this define.
file {
"/etc/httpd/conf.d/sug-${client_domain}.conf":
  content => template($template),
  owner   => 'root',
  group   => 'root',
  mode=> '0644',
  notify  => Service['httpd'];
"/var/log/sugar/${client_domain}":
  ensure  => 'directory';
   }


# The following is specific to the WordPress-installation and doesn't need 
to be applied to every machine. So this part isn't in the define 'define 
sugar::definitions_sug'.
file {
# Configuratie van publieke html
"/var/www/html/${client_domain}":
  owner   => 'apache',
  group   => 'apache',
  mode=> '0744',
  ensure  => 'directory';
# Configuratiefile WordPress
"/var/www/html/${client_domain}/wp-config.php":
  owner   => 'apache',
  group   => 'apache',
  mode=> '0744',
  require => File["/var/www/html/${client_domain}"],
  content => template('sugar/wordpress/wp-config.php.erb');

I call both defines ('sugar::definitions_sug_wp' and 'define 
sugar::definitions_sug') in the following class:
class sugar::instances {

sugar::definitions_sug {
# SugarCRM - ECM2
'node1':
  mysql_dbname => 'dbname1',
  mysql_pwd=> 'password1';

sugar::definitions_sug_wp {
'node2':
  sugar_admin  => 'text1',
  sugar_pwd=> 'password2',
  mysql_dbname => 'dbname2',
  mysql_pwd=> 'password3';

I include this class on one node to get several sugar-only vhosts and 
several sugar+wordpress-nodes on that node.

Hope this helps you explain things to me!



On Monday, November 5, 2012 3:41:37 PM UTC+1, jcbollinger wrote:
>
>
>
> On Monday, November 5, 2012 3:48:58 AM UTC-6, Erwin Bogaard wrote:
>>
>> Thanks again for you reply, but it seems like you don't fully understand 
>> what I'm having problems with. So I'll try to clarify it a little more:
>> 1. The current way of using two defines is working flawlessly. So I (at 
>> least partly) understand the concepts surrounding those.
>> 2. Because I have two types of machines: some with just sugar and some 
>> with sugar and wordpress, I now use two defines that overlap in part 
>> (define1 contains all kinds of info about creating sugar db + unpacking 
>> tar, etc, while define2 contains all the sugar info of define1 + stuff 
>> about creating a wordpress db + unpacking wp tar, etc), this means editing 
>> two files when I change something in the sugar define. As this can lead to 
>> differing configurations because of editing errors (and always twice the 
>> work), I would like to be able to split the defines up, so I can call 
>> define1 (sugar) on all machines and define1 (sugar) and sefine 2 
>> (wordpress) on the other machines.
>> 3. Some of the variables are shared, for example the mysqld_pwd is used 
>> twice, and I add a different suffix for sugar and wordpress to get two 
>> databases. For the httpd-configuration, I specify a different template, 
>> which is easy to to with defines. So all instances have unique resources, 
>> hence the choice for defines, not classes.
>>
>> Does this help you help me?
>>
>
>
> No, not really.  You have been relatively clear about what you are trying 
> to accomplish, but I don't understand what is preventing you from 
> accomplishing it.  Perhaps that means you're stumbling over something that 
> seems trivial to me.  For example, if the real question is how to share 
> data between two or more defined types, then you have at least three 
> choices:
>
>1. Define the data in a class, and have each definition reference the 
>class variables instead of taking that data in the form of parameters.
>2. Externalize the data (e.g. into an Hiera data store), and have each 
>definition reference the needed values by the same fixed key.
>3. Record the data in global variables, and have each definition 
>reference the global values.  (I wouldn't recommend this one except as a 
>temporary hack.)
>
> If that doesn't help then perhaps you should try reducing the problem to 
> the simplest possible example that captures the issue.  Often such an 
> exercise will itself help you work out the problem, but if it doesn't then 
> we can be a lot more helpful to you with actual (simple) manifests to 
> critique.
>
>
> John
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To view this 

Re: [Puppet Users] shouldn't this be considered a bug?

2012-11-05 Thread Christopher Wood
To the best of my knowledge, it is resources that can be applied in any order, 
not scoped variables.

Your puppet agent will create these files in any order, given that the file 
resources have no require/before dependencies:

node myserver {
  file { '/tmp/1':
content => "123\n",
  }
  file { '/tmp/2':
content => "456\n",
  }
}

But here, no file will contain the string "what":

node myserver {
  file { '/tmp/1':
content => "${what}123\n",
  }
  file { '/tmp/2':
content => "${what}456\n",
  }
  $var = 'what'
}

On Mon, Nov 05, 2012 at 12:06:08PM -0800, Jist Anidiot wrote:
>So I thought puppet didn't care about the order of things unless
>specifically told.  However I've come across one case where it apparently
>does care.
> 
>This "works" as expected:
> 
>node /^univ\d+\.foo\.edu$/ {
> 
>$myvar = "foo"
> 
>include module_that_uses_myvar
> 
>}
> 
>This one doesn't "work" as expected
> 
>node /^univ\d+\.foo\.edu$/ {
> 
>include module_that_uses_myvar
> 
>$myvar = "foo"
> 
>}
> 
>In the 2nd one, module_that_uses_myvar seems to think $myvar is undef or
>null or something that is most certainly not "foo" If it matters any,
>$myvar is actually used in an erb template that the module has.  Our
>puppet master is 2.7.12 and the client is 2.6.17.
> 
>I didn't see any bug reports about this.  Is this a known problem or just
>not considered a bug?
> 
>--
>You received this message because you are subscribed to the Google Groups
>"Puppet Users" group.
>To view this discussion on the web visit
>[1]https://groups.google.com/d/msg/puppet-users/-/Q_pDE14z0CYJ.
>To post to this group, send email to puppet-users@googlegroups.com.
>To unsubscribe from this group, send email to
>puppet-users+unsubscr...@googlegroups.com.
>For more options, visit this group at
>http://groups.google.com/group/puppet-users?hl=en.
> 
> References
> 
>Visible links
>1. https://groups.google.com/d/msg/puppet-users/-/Q_pDE14z0CYJ

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.



[Puppet Users] shouldn't this be considered a bug?

2012-11-05 Thread Jist Anidiot
So I thought puppet didn't care about the order of things unless 
specifically told.  However I've come across one case where it apparently 
does care.

This "works" as expected:

node /^univ\d+\.foo\.edu$/ {

$myvar = "foo"

include module_that_uses_myvar

}


This one doesn't "work" as expected


node /^univ\d+\.foo\.edu$/ {

include module_that_uses_myvar

$myvar = "foo"

}

In the 2nd one, module_that_uses_myvar seems to think $myvar is undef or 
null or something that is most certainly not "foo" If it matters any, 
$myvar is actually used in an erb template that the module has.  Our puppet 
master is 2.7.12 and the client is 2.6.17.

I didn't see any bug reports about this.  Is this a known problem or just 
not considered a bug?

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/puppet-users/-/Q_pDE14z0CYJ.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.



Re: [Puppet Users] mco status returns different number of hosts each time I run it

2012-11-05 Thread Bill James
posted reply in mcollective-users group. Sorry for duplicate posts.

On Friday, November 2, 2012 11:34:39 AM UTC-7, R.I. Pienaar wrote:
>
>
>
> - Original Message - 
> > From: "Bill James" > 
> > To: puppet...@googlegroups.com  
> > Sent: Friday, November 2, 2012 6:07:00 PM 
> > Subject: [Puppet Users] mco status returns different number of hosts 
> each time I run it 
> > 
> > trying to use mco to run commands on hosts I don't get the full list 
> > of hosts. Doing a command like "mco puppetd --with-fact domain=
> test.j2noc.com 
> > status" returns a different number of hosts each time. 
> > 
> > How do I get it to use the full list? 
>
> Will need to see some debug logs, when you run this command and you 
> have a node that does not respond in debug logging mode what do you 
> see in the logs. 
>
> Do you see the same behaviour with 'mco ping' when using the same filter? 
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/puppet-users/-/3MVFv1Z4nxQJ.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.



[Puppet Users] Re: Puppet NetApp Network device management...

2012-11-05 Thread Gavin Williams
Looks like the below error was caused by some locally cached code that 
hadn't been updated by my Git pull :s

Resolved that, and now am getting the following:

$ sudo puppet device -v
> Info: starting applying configuration to actint-star-nactl01 at 
> actint-star-nactl01
> Warning: Local environment: "production" doesn't match server specified 
> node environment "development", switching agent to "development".
> Info: Retrieving plugin
> /File[/var/lib/puppet/devices/actint-star-nactl01/lib/puppet]/mode: mode 
> changed '0775' to '0755'
> /File[/var/lib/puppet/devices/actint-star-nactl01/lib/puppet/provider]/mode: 
> mode changed '0775' to '0755'
> /File[/var/lib/puppet/devices/actint-star-nactl01/lib/puppet/provider/netapp.rb]/content:
>  
> content changed '{md5}399796914d8aeb68387455de5b24f735' to 
> '{md5}3be2121ab99116c4bc89db21d5d4b54b'
> /File[/var/lib/puppet/devices/actint-star-nactl01/lib/puppet/provider/netapp_volume/netapp_volume.rb]/content:
>  
> content changed '{md5}46b2a0004e0245c577974e7a645e08f7' to 
> '{md5}1b06628868826a8ea64744a7ae8ec8da'
> /File[/var/lib/puppet/devices/actint-star-nactl01/lib/puppet/type]/mode: 
> mode changed '0775' to '0755'
> /File[/var/lib/puppet/devices/actint-star-nactl01/lib/puppet/type/netapp_volume.rb]/content:
>  
> content changed '{md5}ebe14c73783c97063d9b6ae0bc791896' to 
> '{md5}2fb244482c7d760e6cc132f104be619d'
> /File[/var/lib/puppet/devices/actint-star-nactl01/lib/puppet/util/network_device/netapp/facts.rb]/content:
>  
> content changed '{md5}c7e59e79e19486cba9ae7e5314b2a061' to 
> '{md5}b0c912dc663d5251219bbad895455834'
> /File[/var/lib/puppet/devices/actint-star-nactl01/lib/puppet/util/network_device/netapp/device.rb]/content:
>  
> content changed '{md5}7354a748bd41582fcf76bf2643098fcd' to 
> '{md5}9d2e26f97c7ea6ea16177acb8df85714'
> /File[/var/lib/puppet/devices/actint-star-nactl01/lib/puppet/util/network_device/netapp/NaServer.rb]/content:
>  
> content changed '{md5}cd815964f9a2dfe757f5365a848b80d5' to 
> '{md5}63f12abed9d1145b6d326c9fc06eb0c0'
> Info: Caching catalog for actint-star-nactl01
> Info: Applying configuration version '1352132516'
> Error: 
> /Stage[main]//Node[actint-star-nactl01]/Netapp_volume[v_puppet_test]: Could 
> not evaluate: undefined method `transport' for 
> #
> Finished catalog run in 0.11 seconds
>

If I change *provider/netapp_volume/netapp_volume.rb *as follows*:*

>
> /File[/var/lib/puppet/lib/puppet/provider/netapp_volume/netapp_volume.rb]/content:
> --- /var/lib/puppet/lib/puppet/provider/netapp_volume/netapp_volume.rb  
> 2012-11-05 17:26:56.257616498 +
> +++ /tmp/puppet-file20121105-8521-10tepn6-0 2012-11-05 
> 17:40:16.440612301 +
> @@ -19,7 +19,7 @@
>
>def exists?
>  Puppet.debug("Puppet::Provider::Netapp_volume: checking existance of 
> Netapp Volume #{resource[:name]}")
> -transport.invoke("volume-list-info").include?(resource[:name])
> +@transport.invoke("volume-list-info").include?(resource[:name])
>end
>
I get:

>  Info: starting applying configuration to actint-star-nactl01 at 
> actint-star-nactl01
> Warning: Local environment: "production" doesn't match server specified 
> node environment "development", switching agent to "development".
> Info: Retrieving plugin
> /File[/var/lib/puppet/devices/actint-star-nactl01/lib/puppet/provider/netapp_volume/netapp_volume.rb]/content:
>  
> content changed '{md5}1b06628868826a8ea64744a7ae8ec8da' to 
> '{md5}feb535835cefd0921c8be5d0af6e11f2'
> Info: Caching catalog for actint-star-nactl01
> Info: Applying configuration version '1352132516'
> Error: 
> /Stage[main]//Node[actint-star-nactl01]/Netapp_volume[v_puppet_test]: Could 
> not evaluate: undefined method `invoke' for nil:NilClass
> Finished catalog run in 0.20 seconds
>

So not sure why it's not working either way... 

Any ideas???

Cheers
Gavin  
 

On Monday, 5 November 2012 16:44:15 UTC, Gavin Williams wrote:
>
> Ok, moving on then... 
>
> I've created a 'netapp_volume' type and provider, and am trying to test it 
> against one of the existing NetApp device nodes:
> *manifests/site.pp* contains:
>
> node 'actint-star-nactl01' {
>>
>> # Test NetApp volume provider
>> netapp_volume { 'v_puppet_test':
>> ensure => present,
>> }
>>
>> }
>>
>>
> When running *'puppet device -v'*, I get:
>
>> $ sudo puppet device -v
>> Info: starting applying configuration to actint-star-nactl01 at 
>> actint-star-nactl01
>> Warning: Local environment: "production" doesn't match server specified 
>> node environment "development", switching agent to "development".
>> Info: Retrieving plugin
>> /File[/var/lib/puppet/devices/actint-star-nactl01/lib/puppet/type/netapp_volume.rb]/content:
>>  
>> content changed '{md5}2f3e20a3878f9ed94a5fffc4a9811ef7' to 
>> '{md5}ebe14c73783c97063d9b6ae0bc791896'
>> Error: Could not autoload puppet/provider/netapp_volume/netapp_volume: 
>> uninitialized constant Puppet::Provider::Netapp
>> Error: Could not autoload puppet/typ

Re: [Puppet Users] Re: puppetdb postgresql Connection refused

2012-11-05 Thread Nikola Petrov
On Mon, Nov 05, 2012 at 07:52:02AM -0800, linux@bami wrote:
> Hi,
> 
> we solved the problem. removed all files from /etc/puppetdb/ssl and 
> ran /usr/sbin/puppetdb-ssl-setup.
> 
> Thanks for the support!!
> 
> greetings
> 
> Daniel
> 

I am glad that you managed to solve it.

Best, Nikola

> Am Montag, 5. November 2012 16:07:43 UTC+1 schrieb nikolavp:
> >
> > On Mon, Nov 05, 2012 at 05:36:39AM -0800, linux@bami wrote: 
> > > Hi Nikola, 
> > > 
> > > yes on the puppet master there ist a routes.yaml 
> > > 
> > > [root@lx1ml puppet]# cat routes.yaml 
> > > --- 
> > > master: 
> > >   facts: 
> > > terminus: puppetdb 
> > > cache: yaml 
> > > 
> > > And the puppet agent -t runs fine on the puppetdb if we remove the 
> > > storeconfig settings from our master puppet.conf 
> > > 
> > > Is it possible to increase the jetty log, because we don't the any 
> > > connection attempts or Connection refused. 
> >
> > Well on my machine the file is at /etc/puppetdb/log4j.properties. There 
> > you can configure the logging level which in my case is INFO and this 
> > should 
> > be more than enough. Did you check the system log for your environment 
> > for problems. For example on my ubuntu machine most of the messages from 
> > the master go to /var/log/syslog. 
> >
> > Where are you looking for the puppetdb and puppet logs 
> >
> > > 
> > > 
> > > greetings 
> > > 
> > > daniel 
> >
> > Best, Nikola 
> >
> > > 
> > > 
> > > Am Montag, 5. November 2012 10:40:18 UTC+1 schrieb linux@bami: 
> > > > 
> > > > Greetings, 
> > > > 
> > > > we are trying to setup puppetdb, nut our clients get the following 
> > error: 
> > > > 
> > > > Warning: Unable to fetch my node definition, but the agent run will 
> > > > continue: 
> > > > Warning: Error 400 on SERVER: Could not retrieve facts for 
> > lxa7t.unix.lan: 
> > > > Failed to submit 'replace facts' command for lxa7t.unix.lan to 
> > PuppetDB at 
> > > > puppetdb:8081: Connection refused - connect(2) 
> > > > Info: Retrieving plugin 
> > > > Info: Loading facts in /var/lib/puppet/lib/facter/bmemoryhugepages.rb 
> > > > Info: Loading facts in 
> > /var/lib/puppet/lib/facter/bstoragemanufacturer.rb 
> > > > Info: Loading facts in /var/lib/puppet/lib/facter/bmemoryshmmax.rb 
> > > > Info: Loading facts in /var/lib/puppet/lib/facter/bmemoryshmall.rb 
> > > > Error: Could not retrieve catalog from remote server: Error 400 on 
> > SERVER: 
> > > > Failed to submit 'replace facts' command for lxa7t.unix.lan to 
> > PuppetDB at 
> > > > puppetdb:8081: Connection refused - connect(2) 
> > > > Warning: Not using cache on failed catalog 
> > > > Error: Could not retrieve catalog; skipping run 
> > > > 
> > > > 
> > > > The puppetdb is remote for the puppetmaster and is using postgresql. 
> > > > 
> > > > Direct connect from puppetmaster to the postgresql puppetdb is vaild. 
> > > > 
> > > > We don't see any hint in the logfiles. 
> > > > 
> > > > 
> > > > R/ Daniel 
> > > > 
> > > > 
> > > 
> > > -- 
> > > You received this message because you are subscribed to the Google 
> > Groups "Puppet Users" group. 
> > > To view this discussion on the web visit 
> > https://groups.google.com/d/msg/puppet-users/-/OxMm0hZvrTcJ. 
> > > To post to this group, send email to 
> > > puppet...@googlegroups.com. 
> >
> > > To unsubscribe from this group, send email to 
> > puppet-users...@googlegroups.com . 
> > > For more options, visit this group at 
> > http://groups.google.com/group/puppet-users?hl=en. 
> > > 
> >
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Puppet Users" group.
> To view this discussion on the web visit 
> https://groups.google.com/d/msg/puppet-users/-/QuC4XBMIDjoJ.
> To post to this group, send email to puppet-users@googlegroups.com.
> To unsubscribe from this group, send email to 
> puppet-users+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/puppet-users?hl=en.
> 

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.



Re: [Puppet Users] intercept/pre-process cert request?

2012-11-05 Thread Dean Wilson
On Mon, Oct 29, 2012 at 04:36:44PM -0700, Lou wrote:

Hi Lou,

> I'm assuming this is possible, but I can't find a good starting point 
> anywhere, so I'm hoping someone here can help. What I want to do is, 
> somewhere in the cert approval process, run an extra check before saying 
> yes.

> Is this even possible, and if so, how do I accomplish it? Even pointers to 
> the code that gets executed would help, but I'd really like to avoid 
> mucking with the ca code itself and just add something in the chain. 
> Filtering on domain in autosign.conf is not sufficient.

I've got some sample code to do this (in puppet 2.6) that might be helpful

https://groups.google.com/forum/?fromgroups=#!topic/puppet-dev/FR0KCOCIrrE

It's an intrusive change to the code base so it might not be a good fit
but it might give you some hints.

  Dean
-- 
Dean Wilson
http://www.unixdaemon.net   @unixdaemon
http://www.puppetcookbook.com   @puppetcookbook

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.



[Puppet Users] Re: Puppet NetApp Network device management...

2012-11-05 Thread Gavin Williams
Ok, moving on then... 

I've created a 'netapp_volume' type and provider, and am trying to test it 
against one of the existing NetApp device nodes:
*manifests/site.pp* contains:

node 'actint-star-nactl01' {
>
> # Test NetApp volume provider
> netapp_volume { 'v_puppet_test':
> ensure => present,
> }
>
> }
>
>
When running *'puppet device -v'*, I get:

> $ sudo puppet device -v
> Info: starting applying configuration to actint-star-nactl01 at 
> actint-star-nactl01
> Warning: Local environment: "production" doesn't match server specified 
> node environment "development", switching agent to "development".
> Info: Retrieving plugin
> /File[/var/lib/puppet/devices/actint-star-nactl01/lib/puppet/type/netapp_volume.rb]/content:
>  
> content changed '{md5}2f3e20a3878f9ed94a5fffc4a9811ef7' to 
> '{md5}ebe14c73783c97063d9b6ae0bc791896'
> Error: Could not autoload puppet/provider/netapp_volume/netapp_volume: 
> uninitialized constant Puppet::Provider::Netapp
> Error: Could not autoload puppet/type/netapp_volume: Could not autoload 
> puppet/provider/netapp_volume/netapp_volume: uninitialized constant 
> Puppet::Provider::Netapp
> Error: Could not retrieve catalog from remote server: Could not intern 
> from pson: Could not autoload puppet/type/netapp_volume: Could not autoload 
> puppet/provider/netapp_volume/netapp_volume: uninitialized constant 
> Puppet::Provider::Netapp
> Using cached catalog
> Info: Applying configuration version '1352132516'
> Error: 
> /Stage[main]//Node[actint-star-nactl01]/Netapp_volume[v_puppet_test]: Could 
> not evaluate: No ability to determine if netapp_volume exists
> Finished catalog run in 0.21 seconds
>
>
So it's failing to autoload my new provider, however I'm not sure what 
'uninitialised constant' means :s 
The class *Puppet::Provider::Netapp* is defined in *
lib/puppet/provider/netapp.rb*. 

I've pushed the latest edits into 
Github. 


Ideas welcome. 

Cheers
Gavin 

On Monday, 5 November 2012 15:26:08 UTC, Gavin Williams wrote:
>
> Me again... 
>
> I pressed on using the /var/lib/puppet... configdir for the time-being, 
> and with a bit more jiggery pokery, I've managed to successfully register a 
> NetApp device, and extract some facts from it... And here's the 
> photographic proof :) :D http://ow.ly/i/15SLN
>
> Now to start looking at how to handle the next steps, such as volume 
> creation, quota creation, export creation... :D
>
> Latest code has been pushed to 
> Github
> ...
>
> Still need to work out how to use a central confdir rather than agent 
> specific ones, but can come back to that :) 
>
> Cheers
> Gavin 
>
> On Monday, 5 November 2012 11:35:26 UTC, Gavin Williams wrote:
>>
>> Ok, have fixed that error aswell... 
>>
>> Replaced *':configdir' *with *':confdir'*. 
>> However it's now failing due to the netapp.yml file not being present... 
>> What's confused me is the path it's come up with for *':confdir'*. 
>> According to the debug output, it's trying to use 
>>
>> ESC[0;36mDebugESC[0m: Puppet::Device::Netapp: connecting to Netapp device 
>>> actint-star-nactl01.
>>> ESC[0;36mDebugESC[0m: Puppet::Device::Netapp: configdir is 
>>> /var/lib/puppet/devices/actint-star-nactl01.
>>>
>>
>> However I would prefer it to use */etc/puppet* on the master...  
>> Any way I could do this, other than hard-coding? 
>>
>> Cheers
>> Gavin
>>
>> On Monday, 5 November 2012 11:24:16 UTC, Gavin Williams wrote:
>>>
>>> Ok, after a bit more googling, have solved the NaElement load error... 
>>>
>>> Tweaked the NaServer.rb file as follows:
>>>
>>> #require 'NaElement'
 require File.dirname(__FILE__) + "/NaElement"

>>>
>>> I've now successfully loaded the require Netapp SDK files, and started 
>>> working through the connection process...
>>> Though it looks like it's hit another error:
>>>
>>> Debug: Puppet::Device::Netapp: connecting to Netapp device 
 actint-star-nactl01.
 Debug: Puppet::Device::Netapp: configdir is .
 Error: Can't load netapp for actint-star-nactl01: undefined method `+' 
 for nil:NilClass

>>>
>>> Tracked the above back to *device.rb*, where it's attempting to use *
>>> 'Puppet[:configdir]'* but is failing to find the value... 
>>>
>>> So now to work out what's going on there :) 
>>>
>>> Cheers
>>> Gav
>>>
>>> On Monday, 5 November 2012 10:47:56 UTC, Gavin Williams wrote:

 Hi all

 Following on from my previous post Puppet Network 
 Devices..I've
  now started work on creating a NetApp network device provider for 
 Puppet... 

 I'm trying to start simply by just gathering some facts from our 
 filers. 

 The code soo far is available here: 
 https://github.com/fatmcgav/shrug-netapp/ Credit to the original 
 author shrug for setting out the framework... 

 Anyhow

[Puppet Users] Re: err: Could not request certificate when I run "puppet device"

2012-11-05 Thread Gavin Williams
Looks like a file permissions error - I had similar when I started playing 
with puppet device... 

Check if the user you're running puppet as has permissions to write to 
'/var/opt/lib/pe-puppet/devices'.

HTH

Gav

On Monday, 5 November 2012 16:18:03 UTC, meiji wang wrote:
>
> 1.   I get the following error when I run “puppet device’
>
> err: Could not request certificate: Could not write 
> /var/opt/lib/pe-puppet/devices/certname/ssl/private_keys/certname.pem to 
> privatekeydir: Permission denied - 
> /var/opt/lib/pe-puppet/devices/certname/ssl/private_keys/certname.pem
>
> Any thought?
>
>
> Thanks,
>

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/puppet-users/-/BOdba0ATai4J.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.



[Puppet Users] err: Could not request certificate when I run "puppet device"

2012-11-05 Thread meiji wang


1.   I get the following error when I run “puppet device’

err: Could not request certificate: Could not write 
/var/opt/lib/pe-puppet/devices/certname/ssl/private_keys/certname.pem to 
privatekeydir: Permission denied - 
/var/opt/lib/pe-puppet/devices/certname/ssl/private_keys/certname.pem

Any thought?


Thanks,

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/puppet-users/-/rcg_UPtqyEsJ.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.



Re: [Puppet Users] Puppet 3.0 rspec and custom resources

2012-11-05 Thread Nathan Huff
So I dug into this a little more.  It has something to do with how puppet 
is loading the type definitions. 
There appears to be some kind of cache that gets loaded with type 
definitions when the first manifest gets processed.
If the first test that gets run is for a class that contains all the types 
necessary for classes that get tested later everything runs fine.
If on the other hand if the first test run is for a class that doesn't 
contain all the types used in later classes the later test fails. 

Given the example I posted
This works correctly.
rspec spec/classes/test_spec.rb spec/classes/test__c_spec.rb
This doesn't
rspec spec/classes/test__c_spec.rb spec/classes/test_spec.rb

Running them both separately works too.

On Monday, October 29, 2012 2:48:25 PM UTC-5, Nathan Huff wrote:
>
> Looks like the subnamespace thing isn't important either.  Just having two 
> classes triggers this as well.
>
> On Monday, October 29, 2012 1:13:05 PM UTC-5, Nathan Huff wrote:
>>
>> OK so I have what I think is a minimal test case here:
>>
>> https://github.com/nhuff/spec-failure
>>
>> The readme has a list of gems I have installed in it.
>>
>> You seem to need spec tests for two classes, one of which is in a sub 
>> namespace of the other.
>> In this case 'test' and 'test::c'.  With both spec files in place the 
>> system complains about anchor not being defined.
>> If you remove the test file for test::c the test for class test will pass.
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/puppet-users/-/6MSfkla3fzMJ.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.



[Puppet Users] tags and template

2012-11-05 Thread Fabrice Bacchella
I'm trying to use tags in templates.

I have a resource declared as :

define apache::instance($instance_name=$title,$mpm='worker') {
tag("declared-apache-$instance_name")
...
}

this resource is called in the class apache :

class apache{
...
   apache::instance{$instances: }
}

and then a class declared is called after the apache class :
class{'declared::log':
require => Class['apache']
}

this class create a file :
class declared::log {
file {'/var/lib/puppet/declared.txt':
content => template('declared/declared.txt.erb'),
mode=> '0640',
owner   => 'root',
group   => '0',
}
}

And then in declared.txt.erb, I enumerated every tags :
<% all_tags.sort.each do |tag| -%>
The tag <%= tag %> is defined
<% end -%>
<% tags.sort.each do |tag| -%>
The tag <%= tag %> is part of the current scope
<% end -%>


So the file /var/lib/puppet/declared.txt is created after the tag 
"declared-apache-$instance_name" has been created.

But in the file /var/lib/puppet/declared.txt, I can't see this tag. I see all 
the implicite tags, for example :
...
The tag apache is defined
...

So I'm sure it have been created in the right order, after the class apache.

But my manually declared tag is nowhere to be seen. Does someone have any idea 
what am i doing wrong ?



-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.



Re: [Puppet Users] Re: puppetdb postgresql Connection refused

2012-11-05 Thread linux@bami
Hi,

we solved the problem. removed all files from /etc/puppetdb/ssl and 
ran /usr/sbin/puppetdb-ssl-setup.

Thanks for the support!!

greetings

Daniel

Am Montag, 5. November 2012 16:07:43 UTC+1 schrieb nikolavp:
>
> On Mon, Nov 05, 2012 at 05:36:39AM -0800, linux@bami wrote: 
> > Hi Nikola, 
> > 
> > yes on the puppet master there ist a routes.yaml 
> > 
> > [root@lx1ml puppet]# cat routes.yaml 
> > --- 
> > master: 
> >   facts: 
> > terminus: puppetdb 
> > cache: yaml 
> > 
> > And the puppet agent -t runs fine on the puppetdb if we remove the 
> > storeconfig settings from our master puppet.conf 
> > 
> > Is it possible to increase the jetty log, because we don't the any 
> > connection attempts or Connection refused. 
>
> Well on my machine the file is at /etc/puppetdb/log4j.properties. There 
> you can configure the logging level which in my case is INFO and this 
> should 
> be more than enough. Did you check the system log for your environment 
> for problems. For example on my ubuntu machine most of the messages from 
> the master go to /var/log/syslog. 
>
> Where are you looking for the puppetdb and puppet logs 
>
> > 
> > 
> > greetings 
> > 
> > daniel 
>
> Best, Nikola 
>
> > 
> > 
> > Am Montag, 5. November 2012 10:40:18 UTC+1 schrieb linux@bami: 
> > > 
> > > Greetings, 
> > > 
> > > we are trying to setup puppetdb, nut our clients get the following 
> error: 
> > > 
> > > Warning: Unable to fetch my node definition, but the agent run will 
> > > continue: 
> > > Warning: Error 400 on SERVER: Could not retrieve facts for 
> lxa7t.unix.lan: 
> > > Failed to submit 'replace facts' command for lxa7t.unix.lan to 
> PuppetDB at 
> > > puppetdb:8081: Connection refused - connect(2) 
> > > Info: Retrieving plugin 
> > > Info: Loading facts in /var/lib/puppet/lib/facter/bmemoryhugepages.rb 
> > > Info: Loading facts in 
> /var/lib/puppet/lib/facter/bstoragemanufacturer.rb 
> > > Info: Loading facts in /var/lib/puppet/lib/facter/bmemoryshmmax.rb 
> > > Info: Loading facts in /var/lib/puppet/lib/facter/bmemoryshmall.rb 
> > > Error: Could not retrieve catalog from remote server: Error 400 on 
> SERVER: 
> > > Failed to submit 'replace facts' command for lxa7t.unix.lan to 
> PuppetDB at 
> > > puppetdb:8081: Connection refused - connect(2) 
> > > Warning: Not using cache on failed catalog 
> > > Error: Could not retrieve catalog; skipping run 
> > > 
> > > 
> > > The puppetdb is remote for the puppetmaster and is using postgresql. 
> > > 
> > > Direct connect from puppetmaster to the postgresql puppetdb is vaild. 
> > > 
> > > We don't see any hint in the logfiles. 
> > > 
> > > 
> > > R/ Daniel 
> > > 
> > > 
> > 
> > -- 
> > You received this message because you are subscribed to the Google 
> Groups "Puppet Users" group. 
> > To view this discussion on the web visit 
> https://groups.google.com/d/msg/puppet-users/-/OxMm0hZvrTcJ. 
> > To post to this group, send email to 
> > puppet...@googlegroups.com. 
>
> > To unsubscribe from this group, send email to 
> puppet-users...@googlegroups.com . 
> > For more options, visit this group at 
> http://groups.google.com/group/puppet-users?hl=en. 
> > 
>

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/puppet-users/-/QuC4XBMIDjoJ.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.



[Puppet Users] Re: Puppet NetApp Network device management...

2012-11-05 Thread Gavin Williams
Me again... 

I pressed on using the /var/lib/puppet... configdir for the time-being, and 
with a bit more jiggery pokery, I've managed to successfully register a 
NetApp device, and extract some facts from it... And here's the 
photographic proof :) :D http://ow.ly/i/15SLN

Now to start looking at how to handle the next steps, such as volume 
creation, quota creation, export creation... :D

Latest code has been pushed to 
Github
...

Still need to work out how to use a central confdir rather than agent 
specific ones, but can come back to that :) 

Cheers
Gavin 

On Monday, 5 November 2012 11:35:26 UTC, Gavin Williams wrote:
>
> Ok, have fixed that error aswell... 
>
> Replaced *':configdir' *with *':confdir'*. 
> However it's now failing due to the netapp.yml file not being present... 
> What's confused me is the path it's come up with for *':confdir'*. 
> According to the debug output, it's trying to use 
>
> ESC[0;36mDebugESC[0m: Puppet::Device::Netapp: connecting to Netapp device 
>> actint-star-nactl01.
>> ESC[0;36mDebugESC[0m: Puppet::Device::Netapp: configdir is 
>> /var/lib/puppet/devices/actint-star-nactl01.
>>
>
> However I would prefer it to use */etc/puppet* on the master...  
> Any way I could do this, other than hard-coding? 
>
> Cheers
> Gavin
>
> On Monday, 5 November 2012 11:24:16 UTC, Gavin Williams wrote:
>>
>> Ok, after a bit more googling, have solved the NaElement load error... 
>>
>> Tweaked the NaServer.rb file as follows:
>>
>> #require 'NaElement'
>>> require File.dirname(__FILE__) + "/NaElement"
>>>
>>
>> I've now successfully loaded the require Netapp SDK files, and started 
>> working through the connection process...
>> Though it looks like it's hit another error:
>>
>> Debug: Puppet::Device::Netapp: connecting to Netapp device 
>>> actint-star-nactl01.
>>> Debug: Puppet::Device::Netapp: configdir is .
>>> Error: Can't load netapp for actint-star-nactl01: undefined method `+' 
>>> for nil:NilClass
>>>
>>
>> Tracked the above back to *device.rb*, where it's attempting to use *
>> 'Puppet[:configdir]'* but is failing to find the value... 
>>
>> So now to work out what's going on there :) 
>>
>> Cheers
>> Gav
>>
>> On Monday, 5 November 2012 10:47:56 UTC, Gavin Williams wrote:
>>>
>>> Hi all
>>>
>>> Following on from my previous post Puppet Network 
>>> Devices..I've
>>>  now started work on creating a NetApp network device provider for 
>>> Puppet... 
>>>
>>> I'm trying to start simply by just gathering some facts from our filers. 
>>>
>>> The code soo far is available here: 
>>> https://github.com/fatmcgav/shrug-netapp/ Credit to the original author 
>>> shrug for setting out the framework... 
>>>
>>> Anyhow, onto my first challenge. 
>>>
>>> I've downloaded and added the relevant NetApp SDK files into *
>>> modules/shrug-netapp/lib/puppet/util/network_device/netapp/* as shown 
>>> below:
>>>
>>> $ ls -l modules/shrug-netapp/lib/puppet/util/network_device/netapp/
 total 88
 -rw-r--r--. 1 puppet puppet   924 Nov  2 17:13 device.rb
 -rw-r--r--. 1 puppet puppet  8229 Nov  2 17:16 DfmErrno.rb
 -rw-r--r--. 1 puppet puppet   228 Nov  2 17:00 facts.rb
 -rw-r--r--. 1 puppet puppet  9451 Nov  2 17:16 NaElement.rb
 -rw-r--r--. 1 puppet puppet 36089 Nov  2 17:15 NaErrno.rb
 -rw-r--r--. 1 puppet puppet 19036 Nov  2 17:15 NaServer.rb

>>>  
>>> The NaServer class is then included within the device.rb file above. 
>>> However Puppet is currently failing with:
>>>
 Info: starting applying configuration to actint-star-nactl01 at 
 actint-star-nactl01
 Error: Could not run: no such file to load -- NaElement

>>>
>>> This NaElement file is require'd by the NaServer class. 
>>> However it seems to be failing due to the include path not including the 
>>> NaElement.rb file... 
>>> Therefore I'm guessing that Puppet/Ruby is looking for the NaElement 
>>> file in some default location, rather than the same location as the 
>>> NaServer class... 
>>>
>>> I've generated the same error on some tests scripts by moving the NetApp 
>>> SDK files into a sdk sub folder, and then just *"require sdk/NaServer"*in 
>>> my script, which generates a very similar error:
>>>
 ruby hello_ontapi.rb  192.168.35.118 root xxx
 ./sdk/NaServer.rb:21:in `require': no such file to load -- NaElement 
 (LoadError)
 from ./sdk/NaServer.rb:21
 from hello_ontapi.rb:24:in `require'
 from hello_ontapi.rb:24

>>>
>>> Any ideas how I could work around this? 
>>>
>>> Cheers
>>> Gavin 
>>>  
>>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/puppet-users/-/tYRDCDwxjlsJ.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
pu

Re: [Puppet Users] Re: puppetdb postgresql Connection refused

2012-11-05 Thread Nikola Petrov
On Mon, Nov 05, 2012 at 06:26:35AM -0800, linux@bami wrote:
> Hi,
> 
> so we figured out the first problem.
> We had an alias puppetdb.fqdn which was pointing to out puppet dashboard 
> db. It seems that despite from the entry in the puppetdb.conf, puppet uses 
> puppetdb as database server.
> 
> we changed the alias and now we are getting an ssl error:
> 
> Error: Could not retrieve catalog from remote server: Error 400 on SERVER: 
> Failed to submit 'replace facts' command for lxa7t.unix.lan to PuppetDB at 
> puppetdb:8081: SSL_connect returned=1 errno=0 state=SSLv3 read server 
> certificate B: certificate verify failed: [unable to get local issuer 
> certificate for /CN=lxj2j.unix.lan]
> Warning: Not using cache on failed catalog
> Error: Could not retrieve catalog; skipping run
> 

This looks like an SSL error to me. Try to remove the storeconfigs and
make a clean

puppet agent -t

from puppetdb host before you enable it again.

> any idea ?! 
> 
> thanks and greetings.
> 
> Daniel
> 
> Am Montag, 5. November 2012 14:36:39 UTC+1 schrieb linux@bami:
> >
> > Hi Nikola,
> >
> > yes on the puppet master there ist a routes.yaml
> >
> > [root@lx1ml puppet]# cat routes.yaml
> > ---
> > master:
> >   facts:
> > terminus: puppetdb
> > cache: yaml
> >
> > And the puppet agent -t runs fine on the puppetdb if we remove the 
> > storeconfig settings from our master puppet.conf
> >
> > Is it possible to increase the jetty log, because we don't the any 
> > connection attempts or Connection refused.
> >
> >
> > greetings 
> >
> > daniel
> >
> >
> > Am Montag, 5. November 2012 10:40:18 UTC+1 schrieb linux@bami:
> >>
> >> Greetings,
> >>
> >> we are trying to setup puppetdb, nut our clients get the following error:
> >>
> >> Warning: Unable to fetch my node definition, but the agent run will 
> >> continue:
> >> Warning: Error 400 on SERVER: Could not retrieve facts for 
> >> lxa7t.unix.lan: Failed to submit 'replace facts' command for 
> >> lxa7t.unix.lan 
> >> to PuppetDB at puppetdb:8081: Connection refused - connect(2)
> >> Info: Retrieving plugin
> >> Info: Loading facts in /var/lib/puppet/lib/facter/bmemoryhugepages.rb
> >> Info: Loading facts in /var/lib/puppet/lib/facter/bstoragemanufacturer.rb
> >> Info: Loading facts in /var/lib/puppet/lib/facter/bmemoryshmmax.rb
> >> Info: Loading facts in /var/lib/puppet/lib/facter/bmemoryshmall.rb
> >> Error: Could not retrieve catalog from remote server: Error 400 on 
> >> SERVER: Failed to submit 'replace facts' command for lxa7t.unix.lan to 
> >> PuppetDB at puppetdb:8081: Connection refused - connect(2)
> >> Warning: Not using cache on failed catalog
> >> Error: Could not retrieve catalog; skipping run
> >>
> >>
> >> The puppetdb is remote for the puppetmaster and is using postgresql.
> >>
> >> Direct connect from puppetmaster to the postgresql puppetdb is vaild.
> >>
> >> We don't see any hint in the logfiles.
> >>
> >>
> >> R/ Daniel
> >>
> >>
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Puppet Users" group.
> To view this discussion on the web visit 
> https://groups.google.com/d/msg/puppet-users/-/atH0EqHpJrUJ.
> To post to this group, send email to puppet-users@googlegroups.com.
> To unsubscribe from this group, send email to 
> puppet-users+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/puppet-users?hl=en.
> 

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.



Re: [Puppet Users] Re: puppetdb postgresql Connection refused

2012-11-05 Thread Nikola Petrov
On Mon, Nov 05, 2012 at 05:36:39AM -0800, linux@bami wrote:
> Hi Nikola,
> 
> yes on the puppet master there ist a routes.yaml
> 
> [root@lx1ml puppet]# cat routes.yaml
> ---
> master:
>   facts:
> terminus: puppetdb
> cache: yaml
> 
> And the puppet agent -t runs fine on the puppetdb if we remove the 
> storeconfig settings from our master puppet.conf
> 
> Is it possible to increase the jetty log, because we don't the any 
> connection attempts or Connection refused.

Well on my machine the file is at /etc/puppetdb/log4j.properties. There
you can configure the logging level which in my case is INFO and this should
be more than enough. Did you check the system log for your environment
for problems. For example on my ubuntu machine most of the messages from
the master go to /var/log/syslog. 

Where are you looking for the puppetdb and puppet logs

> 
> 
> greetings 
> 
> daniel

Best, Nikola

> 
> 
> Am Montag, 5. November 2012 10:40:18 UTC+1 schrieb linux@bami:
> >
> > Greetings,
> >
> > we are trying to setup puppetdb, nut our clients get the following error:
> >
> > Warning: Unable to fetch my node definition, but the agent run will 
> > continue:
> > Warning: Error 400 on SERVER: Could not retrieve facts for lxa7t.unix.lan: 
> > Failed to submit 'replace facts' command for lxa7t.unix.lan to PuppetDB at 
> > puppetdb:8081: Connection refused - connect(2)
> > Info: Retrieving plugin
> > Info: Loading facts in /var/lib/puppet/lib/facter/bmemoryhugepages.rb
> > Info: Loading facts in /var/lib/puppet/lib/facter/bstoragemanufacturer.rb
> > Info: Loading facts in /var/lib/puppet/lib/facter/bmemoryshmmax.rb
> > Info: Loading facts in /var/lib/puppet/lib/facter/bmemoryshmall.rb
> > Error: Could not retrieve catalog from remote server: Error 400 on SERVER: 
> > Failed to submit 'replace facts' command for lxa7t.unix.lan to PuppetDB at 
> > puppetdb:8081: Connection refused - connect(2)
> > Warning: Not using cache on failed catalog
> > Error: Could not retrieve catalog; skipping run
> >
> >
> > The puppetdb is remote for the puppetmaster and is using postgresql.
> >
> > Direct connect from puppetmaster to the postgresql puppetdb is vaild.
> >
> > We don't see any hint in the logfiles.
> >
> >
> > R/ Daniel
> >
> >
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Puppet Users" group.
> To view this discussion on the web visit 
> https://groups.google.com/d/msg/puppet-users/-/OxMm0hZvrTcJ.
> To post to this group, send email to puppet-users@googlegroups.com.
> To unsubscribe from this group, send email to 
> puppet-users+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/puppet-users?hl=en.
> 

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.



[Puppet Users] Re: Apply multiple defines in sequence

2012-11-05 Thread jcbollinger


On Monday, November 5, 2012 3:48:58 AM UTC-6, Erwin Bogaard wrote:
>
> Thanks again for you reply, but it seems like you don't fully understand 
> what I'm having problems with. So I'll try to clarify it a little more:
> 1. The current way of using two defines is working flawlessly. So I (at 
> least partly) understand the concepts surrounding those.
> 2. Because I have two types of machines: some with just sugar and some 
> with sugar and wordpress, I now use two defines that overlap in part 
> (define1 contains all kinds of info about creating sugar db + unpacking 
> tar, etc, while define2 contains all the sugar info of define1 + stuff 
> about creating a wordpress db + unpacking wp tar, etc), this means editing 
> two files when I change something in the sugar define. As this can lead to 
> differing configurations because of editing errors (and always twice the 
> work), I would like to be able to split the defines up, so I can call 
> define1 (sugar) on all machines and define1 (sugar) and sefine 2 
> (wordpress) on the other machines.
> 3. Some of the variables are shared, for example the mysqld_pwd is used 
> twice, and I add a different suffix for sugar and wordpress to get two 
> databases. For the httpd-configuration, I specify a different template, 
> which is easy to to with defines. So all instances have unique resources, 
> hence the choice for defines, not classes.
>
> Does this help you help me?
>


No, not really.  You have been relatively clear about what you are trying 
to accomplish, but I don't understand what is preventing you from 
accomplishing it.  Perhaps that means you're stumbling over something that 
seems trivial to me.  For example, if the real question is how to share 
data between two or more defined types, then you have at least three 
choices:

   1. Define the data in a class, and have each definition reference the 
   class variables instead of taking that data in the form of parameters.
   2. Externalize the data (e.g. into an Hiera data store), and have each 
   definition reference the needed values by the same fixed key.
   3. Record the data in global variables, and have each definition 
   reference the global values.  (I wouldn't recommend this one except as a 
   temporary hack.)

If that doesn't help then perhaps you should try reducing the problem to 
the simplest possible example that captures the issue.  Often such an 
exercise will itself help you work out the problem, but if it doesn't then 
we can be a lot more helpful to you with actual (simple) manifests to 
critique.


John

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/puppet-users/-/X60w8VUoFjIJ.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.



Re: [Puppet Users] Bug when using array in file resource?

2012-11-05 Thread jcbollinger


On Monday, November 5, 2012 12:37:45 AM UTC-6, pdurkin wrote:
>
> I'm not convinced that Justin wasn't correct about this being a bug.  I'm 
> having a similar issue
>


How many people do you need to tell you that the behavior you observe is 
intended?  File a ticket against the documentation if you like, but the 
behavior is as designed, well-entrenched, broadly relied-upon, and useful.

 

>
> class myclass (...) {
>
>   # some extra stuff here
>
>   $file_list = [ 'a', 'b' ..., 'n' ]
>   file { $file_list : 
>ensure => 'file',
>source => "puppet://modules/myclass/$title",
>path   => "/tmp/$title"
>   }
>
> results in the "cannot alias file [a] to [/tmp/myclass]".  For some reason 
> the resource title in my file is resolving to the class name rather than 
> the file name.
>


Yes.  That's as it should be.  Variables are always resolved in the 
innermost scope in which they appear.  Other than the top-level scope, 
scopes are established only by node bocks, definition bodies, and class 
bodies.  In particular, they are *not* established by resource declarations 
such as your example file declaration.  Nor is there a functionality gap -- 
Nan already explained how to get the behavior you want.

 

>
> The solution provided above seems to change the semantics.  myclass 
> becomes a defined type instead and the list of files is moved outside and 
> passed in as multiple instances are created.  That's a work around.
>


You are hypothesizing an implementation to criticize, instead of 
considering how to model your problem in a way that harmonizes with 
Puppet.  Consider this:

define mymodule::modulefile() {
  file { $name : 
ensure => 'file',
source => "puppet:///mymodule/$name",
path   => "/tmp/$name"
  }
}

class mymodule::myclass {
  $file_list = [ 'a', 'b' ..., 'n' ]
  mymodule::modulefile { $file_list : }
}

Your class remains a class, and continues to define the file list itself.  
The definition 'mymodule::modulefile' represents a type of file that has 
the particular relationship you want between its 'path' and 'source'.
 

>
> Another would be to not use a list and simply define each file separately 
> in the class, that avoids having to use the $title to abstract the 
> definition into a single resource definition.  I can do that quite easily 
> but in my case I have about 100 files so it makes this much less readable.  
> Found someone had already explained the issue here: 
> http://www.nico.schottelius.org/blog/puppet-name-is-not-as-expected-but-classname/
> .
>
> Does anyone have an answer as to why $title in this case is resolving to 
> the class title rather than the resource title?  Is that expected and is 
> there a variable I could use instead that would resolve to the name of the 
> resource I'm declaring rather than the class or defined type I'm declaring 
> it in?
>
> I also tested this and it's not to do with the list, if I use put in each 
> file individually and use $title or $name it still resolves to the class 
> name
>


Look at it another way: if you were invoking a function, would you expect 
variable references among the parameters to be resolved by the caller or by 
the function?  They are resolved by the caller, of course.  Resource 
declarations are not function calls, but they work analogously in this 
regard.


John

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/puppet-users/-/OmwBZ88LvzIJ.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.



[Puppet Users] Re: puppetdb postgresql Connection refused

2012-11-05 Thread linux@bami
Hi,

so we figured out the first problem.
We had an alias puppetdb.fqdn which was pointing to out puppet dashboard 
db. It seems that despite from the entry in the puppetdb.conf, puppet uses 
puppetdb as database server.

we changed the alias and now we are getting an ssl error:

Error: Could not retrieve catalog from remote server: Error 400 on SERVER: 
Failed to submit 'replace facts' command for lxa7t.unix.lan to PuppetDB at 
puppetdb:8081: SSL_connect returned=1 errno=0 state=SSLv3 read server 
certificate B: certificate verify failed: [unable to get local issuer 
certificate for /CN=lxj2j.unix.lan]
Warning: Not using cache on failed catalog
Error: Could not retrieve catalog; skipping run

any idea ?! 

thanks and greetings.

Daniel

Am Montag, 5. November 2012 14:36:39 UTC+1 schrieb linux@bami:
>
> Hi Nikola,
>
> yes on the puppet master there ist a routes.yaml
>
> [root@lx1ml puppet]# cat routes.yaml
> ---
> master:
>   facts:
> terminus: puppetdb
> cache: yaml
>
> And the puppet agent -t runs fine on the puppetdb if we remove the 
> storeconfig settings from our master puppet.conf
>
> Is it possible to increase the jetty log, because we don't the any 
> connection attempts or Connection refused.
>
>
> greetings 
>
> daniel
>
>
> Am Montag, 5. November 2012 10:40:18 UTC+1 schrieb linux@bami:
>>
>> Greetings,
>>
>> we are trying to setup puppetdb, nut our clients get the following error:
>>
>> Warning: Unable to fetch my node definition, but the agent run will 
>> continue:
>> Warning: Error 400 on SERVER: Could not retrieve facts for 
>> lxa7t.unix.lan: Failed to submit 'replace facts' command for lxa7t.unix.lan 
>> to PuppetDB at puppetdb:8081: Connection refused - connect(2)
>> Info: Retrieving plugin
>> Info: Loading facts in /var/lib/puppet/lib/facter/bmemoryhugepages.rb
>> Info: Loading facts in /var/lib/puppet/lib/facter/bstoragemanufacturer.rb
>> Info: Loading facts in /var/lib/puppet/lib/facter/bmemoryshmmax.rb
>> Info: Loading facts in /var/lib/puppet/lib/facter/bmemoryshmall.rb
>> Error: Could not retrieve catalog from remote server: Error 400 on 
>> SERVER: Failed to submit 'replace facts' command for lxa7t.unix.lan to 
>> PuppetDB at puppetdb:8081: Connection refused - connect(2)
>> Warning: Not using cache on failed catalog
>> Error: Could not retrieve catalog; skipping run
>>
>>
>> The puppetdb is remote for the puppetmaster and is using postgresql.
>>
>> Direct connect from puppetmaster to the postgresql puppetdb is vaild.
>>
>> We don't see any hint in the logfiles.
>>
>>
>> R/ Daniel
>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/puppet-users/-/atH0EqHpJrUJ.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.



Re: [Puppet Users] Defining dynamic cron jobs

2012-11-05 Thread Alexander Holte-Davidsen
Hi!

Thanks for the feedback! Unfortunately both suggestions gives me to little
freedom, so I ended up using the chronic gem for ruby. I can give a small
example of what I have done. Please not that this is extremely early in the
development:

class test {
$weeknumber = '3'
$weekday = 'Tuesday'
$hour = '22'
$minute = '00'
$monthday = template('test/date.erb')

if ( $monthday =~ /^UNDEF/ ) {
notify {'Monthday is wrong': }
}
else {
cron{'Testing':
ensure   => present,
hour => "$hour",
minute   => "$minute",
monthday => "$monthday",
command  => 'echo hello',
}
}
}

date.rb:
<%=
require 'time'
require 'chronic'

time = Time.new
@month = time.strftime("%B").downcase.chomp
@week = weeknumber.downcase.chomp
@weekday = weekday.downcase.chomp

date = Chronic.parse("#{@week}rd #{@weekday} this #{@month}").to_a
if date[3].nil?
day = 'UNDEF'.chomp
else
day = date[3]
end
%>


All I have to do now is to set $weeknumber and $weekday and the rest is
calculated by date.erb... Maybe not the pretties code out there, but as I
said - extremely early in the development.

Matt, of course it was wrong, thanks for pointing that out. The month
should have been 12, not 20. Darn typos.

Regards,
Alexander


On Mon, Nov 5, 2012 at 2:48 PM, Dan White  wrote:

> You cannot directly set up a cron job to run on the N-th (day-of-the-week).
>
> From the manpage crontab(5):
>
> Note:  The  day of a command’s execution can be specified by two fields —
> day of month, and day of week.  If both fields are restricted (ie, aren’t
> *), the command will  be  run  when  either field matches the current time.
>  For example, "30  4  1,15 * 5" would cause a command to be run at 4:30 am
> on the 1st and 15th of each month, plus every Friday.
> --
>
> To get a script that runs on the N-th Tuesday, I did this:
>
> today=`date +%u`
>
> if [ $today -eq $1 ]
> then
> 
> fi
>
> Then, I call the script from cron like this:
> # Run patch script on second Tuesday of every month
> 05  02  8-14 *   *   root
>  /usr/local/scripts/cronScript.sh 2
>
> -
> So, the script will run once a day from the 8th thru the 14th and only
> execute the guts of the conditional on Tuesday
>
> Adjust the day-of-the-month field accordingly to get the week you want.
>
>
> “Sometimes I think the surest sign that intelligent life exists elsewhere
> in the universe is that none of it has tried to contact us.”
> Bill Waterson (Calvin & Hobbes)
>
> - Original Message -
> From: "Alexander Holte-Davidsen" 
> To: puppet-users@googlegroups.com
> Sent: Monday, November 5, 2012 5:23:24 AM
> Subject: [Puppet Users] Defining dynamic cron jobs
>
> Hi all,
>
>
> I have a application that I schedule via cron. This is a application that
> runs once a week, either on Tuesday or Thursday. The scheduling is now done
> via Puppet.
>
>
> I now see that I need to redefine this, on some nodes the application
> should for example only run the 3. Tuesday each month, not each Tuesday.
> I want to do the scheduling using puppet and parameterized classes. For
> example I want to be able to define:
>
>
> foo {'Tuesday':
> week => '3',
> hour => '18',
> minute => '00',
> }
>
>
> This should generate a cron job ( that changes every month). For November
> it should look like this:
> 00 18 20 11 * /usr/bin/foo
>
>
> Next month the crontab entry should be changed to:
> 00 18 18 20 * /usr/bin/foo
>
>
> Has anyone done anything similar and are willing to give me some input on
> how to solve this?
>
>
> / Alexander
>
> --
> You received this message because you are subscribed to the Google Groups
> "Puppet Users" group.
> To post to this group, send email to puppet-users@googlegroups.com.
> To unsubscribe from this group, send email to
> puppet-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/puppet-users?hl=en.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Puppet Users" group.
> To post to this group, send email to puppet-users@googlegroups.com.
> To unsubscribe from this group, send email to
> puppet-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/puppet-users?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.



Re: [Puppet Users] Defining dynamic cron jobs

2012-11-05 Thread Dan White
You cannot directly set up a cron job to run on the N-th (day-of-the-week).

>From the manpage crontab(5):
 
Note:  The  day of a command’s execution can be specified by two fields — day 
of month, and day of week.  If both fields are restricted (ie, aren’t *), the 
command will  be  run  when  either field matches the current time.  For 
example, "30  4  1,15 * 5" would cause a command to be run at 4:30 am on the 
1st and 15th of each month, plus every Friday.
--

To get a script that runs on the N-th Tuesday, I did this:

today=`date +%u`

if [ $today -eq $1 ]
then

fi

Then, I call the script from cron like this:
# Run patch script on second Tuesday of every month
05  02  8-14 *   *   root
/usr/local/scripts/cronScript.sh 2

-
So, the script will run once a day from the 8th thru the 14th and only execute 
the guts of the conditional on Tuesday

Adjust the day-of-the-month field accordingly to get the week you want. 


“Sometimes I think the surest sign that intelligent life exists elsewhere in 
the universe is that none of it has tried to contact us.”
Bill Waterson (Calvin & Hobbes)

- Original Message -
From: "Alexander Holte-Davidsen" 
To: puppet-users@googlegroups.com
Sent: Monday, November 5, 2012 5:23:24 AM
Subject: [Puppet Users] Defining dynamic cron jobs

Hi all, 


I have a application that I schedule via cron. This is a application that runs 
once a week, either on Tuesday or Thursday. The scheduling is now done via 
Puppet. 


I now see that I need to redefine this, on some nodes the application should 
for example only run the 3. Tuesday each month, not each Tuesday. 
I want to do the scheduling using puppet and parameterized classes. For example 
I want to be able to define: 


foo {'Tuesday': 
week => '3', 
hour => '18', 
minute => '00', 
} 


This should generate a cron job ( that changes every month). For November it 
should look like this: 
00 18 20 11 * /usr/bin/foo 


Next month the crontab entry should be changed to: 
00 18 18 20 * /usr/bin/foo 


Has anyone done anything similar and are willing to give me some input on how 
to solve this? 


/ Alexander 

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group. 
To post to this group, send email to puppet-users@googlegroups.com. 
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com. 
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en. 

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.



[Puppet Users] Re: puppetdb postgresql Connection refused

2012-11-05 Thread linux@bami
Hi Nikola,

yes on the puppet master there ist a routes.yaml

[root@lx1ml puppet]# cat routes.yaml
---
master:
  facts:
terminus: puppetdb
cache: yaml

And the puppet agent -t runs fine on the puppetdb if we remove the 
storeconfig settings from our master puppet.conf

Is it possible to increase the jetty log, because we don't the any 
connection attempts or Connection refused.


greetings 

daniel


Am Montag, 5. November 2012 10:40:18 UTC+1 schrieb linux@bami:
>
> Greetings,
>
> we are trying to setup puppetdb, nut our clients get the following error:
>
> Warning: Unable to fetch my node definition, but the agent run will 
> continue:
> Warning: Error 400 on SERVER: Could not retrieve facts for lxa7t.unix.lan: 
> Failed to submit 'replace facts' command for lxa7t.unix.lan to PuppetDB at 
> puppetdb:8081: Connection refused - connect(2)
> Info: Retrieving plugin
> Info: Loading facts in /var/lib/puppet/lib/facter/bmemoryhugepages.rb
> Info: Loading facts in /var/lib/puppet/lib/facter/bstoragemanufacturer.rb
> Info: Loading facts in /var/lib/puppet/lib/facter/bmemoryshmmax.rb
> Info: Loading facts in /var/lib/puppet/lib/facter/bmemoryshmall.rb
> Error: Could not retrieve catalog from remote server: Error 400 on SERVER: 
> Failed to submit 'replace facts' command for lxa7t.unix.lan to PuppetDB at 
> puppetdb:8081: Connection refused - connect(2)
> Warning: Not using cache on failed catalog
> Error: Could not retrieve catalog; skipping run
>
>
> The puppetdb is remote for the puppetmaster and is using postgresql.
>
> Direct connect from puppetmaster to the postgresql puppetdb is vaild.
>
> We don't see any hint in the logfiles.
>
>
> R/ Daniel
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/puppet-users/-/OxMm0hZvrTcJ.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.



Re: [Puppet Users] Defining dynamic cron jobs

2012-11-05 Thread Matt Zagrabelny
On Mon, Nov 5, 2012 at 4:23 AM, Alexander Holte-Davidsen
 wrote:
> Hi all,
>
> I have a application that I schedule via cron. This is a application that
> runs once a week, either on Tuesday or Thursday. The scheduling is now done
> via Puppet.
>
> I now see that I need to redefine this, on some nodes the application should
> for example only run the 3. Tuesday each month, not each Tuesday.
> I want to do the scheduling using puppet and parameterized classes. For
> example I want to be able to define:
>
> foo {'Tuesday':
>week => '3',
>hour => '18',
>minute => '00',
> }
>
> This should generate a cron job ( that changes every month). For November it
> should look like this:
> 00 18 20 11 *  /usr/bin/foo
>
> Next month the crontab entry should be changed to:
> 00 18 18 20 * /usr/bin/foo

Hmmm. Should that be:

00 18 18 12 *

?

20 is an invalid month.

> Has anyone done anything similar and are willing to give me some input on
> how to solve this?

Instead of using the wildcard ('*') month, could you (simply) specify
the months?

0 18 20 1 *
0 18 18 2 *
0 18 20 3 *
0 18 18 4 *
0 18 20 5 *
0 18 18 6 *
0 18 20 7 *
0 18 18 8 *
0 18 20 9 *
0 18 18 10 *
0 18 20 11 *
0 18 18 12 *

-mz

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.



Re: [Puppet Users] Re: puppetdb postgresql Connection refused

2012-11-05 Thread Nikola Petrov
On Mon, Nov 05, 2012 at 03:32:21AM -0800, linux@bami wrote:
> Hi Nikola,
> 
> thanks for the response!
> 
> here are our configs:
> 
>  cat /etc/puppet/puppet.conf
> 
> [main]
> server = lx1ml.unix.lan
> logdir = /var/log/puppet
> rundir = /var/run/puppet
> confdir = /app/puppet/etc
> vardir = /app/puppet/var
> ssldir = $vardir/ssl
> modulepath = $confdir/modules
> manifest = $confdir/manifests/site.pp
> pluginsync = true
> 
> [master]
> certname = lx1ml.unix.lan
> dns_alt_names = lx1ml.unix.lan
> ssl_client_header = SSL_CLIENT_S_DN
> ssl_client_verify_header = SSL_CLIENT_VERIFY
> reports = tagmail,http
> reportfrom = linux-supp...@xx.de
> #reporturl = http://lx1ml.unix.lan:3000/reports/upload
> storeconfigs = true
> storeconfigs_backend = puppetdb
> #facts_terminus = yaml
> #facts_terminus = inventory_active_record
> #dbadapter = mysql
> #dbname = dashboard
> #dbuser = dashboard
> #dbpassword = x
> #dbserver = puppetdb.unix.lan
> #dbport = 
> [production]
> modulepath = /app/puppet/env/production/modules
> manifest = /app/puppet/env/production/manifests/site.pp
> [development]
> modulepath = /app/puppet/env/development/modules
> manifest = /app/puppet/env/development/manifests/site.pp
> 
> 
> cat /etc/puppet/puppetdb.conf
> [main]
> server = lxj2j.unix.lan
> port = 8081
> 
> 
> Direkt connect from the puppetmaster to the puppetdb postgresql via psql
> [lx1ml ~]# psql -h lxj2j -U puppetdb -d puppetdb
> 
> 
> Telnet Connect is working:
> [root@lx1ml ~]# telnet lxj2j 8081
> Trying 172.20.250.153...
> Connected to lxj2j.
> Escape character is '^]'.
> ^CConnection closed by foreign host.
> 
> 
> Puppetdb config from lxj2j:
> 
> cat /etc/puppetdb/conf.d/jetty.ini
> [jetty]
> # Hostname to list for clear-text HTTP.  Default is localhost
> #host = localhost
> # Port to listen on for clear-text HTTP.
> port = 8080
> 
> ssl-host = lxj2j.unix.lan
> ssl-port = 8081
> keystore = /etc/puppetdb/ssl/keystore.jks
> truststore = /etc/puppetdb/ssl/truststore.jks
> removed passwords from output
> 
> [root@lxj2j data]# cat /etc/puppetdb/conf.d/database.ini |grep -v "^#"
> [database]
> classname = org.postgresql.Driver
> subprotocol = postgresql
> subname = //localhost:5432/puppetdb
> log-slow-statements = 10
> syntax_pgs = true
> gc-interval = 60
> username = puppetdb
> password = puppetdb
> 
> 
> Greetings 
> 
> Daniel
> 
> 
> Am Montag, 5. November 2012 10:40:18 UTC+1 schrieb linux@bami:
> >
> > Greetings,
> >
> > we are trying to setup puppetdb, nut our clients get the following error:
> >
> > Warning: Unable to fetch my node definition, but the agent run will 
> > continue:
> > Warning: Error 400 on SERVER: Could not retrieve facts for lxa7t.unix.lan: 
> > Failed to submit 'replace facts' command for lxa7t.unix.lan to PuppetDB at 
> > puppetdb:8081: Connection refused - connect(2)
> > Info: Retrieving plugin
> > Info: Loading facts in /var/lib/puppet/lib/facter/bmemoryhugepages.rb
> > Info: Loading facts in /var/lib/puppet/lib/facter/bstoragemanufacturer.rb
> > Info: Loading facts in /var/lib/puppet/lib/facter/bmemoryshmmax.rb
> > Info: Loading facts in /var/lib/puppet/lib/facter/bmemoryshmall.rb
> > Error: Could not retrieve catalog from remote server: Error 400 on SERVER: 
> > Failed to submit 'replace facts' command for lxa7t.unix.lan to PuppetDB at 
> > puppetdb:8081: Connection refused - connect(2)
> > Warning: Not using cache on failed catalog
> > Error: Could not retrieve catalog; skipping run
> >
> >
> > The puppetdb is remote for the puppetmaster and is using postgresql.
> >
> > Direct connect from puppetmaster to the postgresql puppetdb is vaild.
> >
> > We don't see any hint in the logfiles.
> >
> >
> > R/ Daniel
> >
> >

Strange ;; everything seems fine to me. Recheck the logs of the master,
the agent and the db please. Can you also make sure that you have a
signed certificate on the puppetdb host as described here -
http://docs.puppetlabs.com/puppetdb/0.9/install.html#step-1-install-and-configure-puppet.
i.e make sure that 

puppet agent -t

runs properly there. 

P.S. Also did you add a routes.yaml file?

Best, Nikola

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.



[Puppet Users] Re: Call for Speakers for PuppetCamp Singapore dec 3rd

2012-11-05 Thread Walter Heck
Anyone, noone? The PC has been confirmed now, you can sign up 
here: https://www.flickevents.com/puppetcamp-sea-blk-71

Looking forward to seeing you there!

Walter

On Wednesday, 31 October 2012 23:26:52 UTC+1, Walter Heck - OlinData.com 
wrote:
>
> Hello, 
>
> after doing a successful PuppetCamp in Kuala Lumpur last June, we are 
> now in the works of organising a PC in Singapore. This will be the 
> first PC in Singapore and the 2nd in Southeast Asia. The date is 
> December 3rd and the location will be the amongst startups famous Blk 
> 71. 
>
> PuppetLabs is sending a speaker (currently 90% confirmed), and we're 
> looking into doing a second session over a Live Hangout. Besides that 
> we're looking for other speakers interested to come and talk about 
> Puppet. 
>
> If you have any questions or want to propose a session, feel free to 
> respond here publicly or to me privately. 
>
> Keep an eye out for the opening of the registrations, we expect quite 
> a busy day! 
>
> regards, 
>
> -- 
> Walter Heck 
> Founder // OlinData 
> -- 
> Puppet training and consulting @ http://www.olindata.com 
> Follow @olindata on Twitter and/or 'Like' our Facebook page at 
> http://www.facebook.com/olindata 
>

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/puppet-users/-/VT4hVIpf9g0J.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.



Re: [Puppet Users] compiling ruby on HP-UX / PA-RISC

2012-11-05 Thread Alex Harvey
On Monday, November 5, 2012 4:27:54 PM UTC+11, Michael Stanhke wrote:
>
>
> 1.  You may need to file a bug with ruby-lang.org 
> 2.  Would static linking help at all with being maintainable? 
>
> Thanks Michael.  Actually static linking should be fine - I didn't think 
of it.  I also raised a bug as you suggested, 
https://bugs.ruby-lang.org/issues/7279.  I'll see how it goes.

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/puppet-users/-/bIVrG6etHBMJ.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.



[Puppet Users] Re: Puppet NetApp Network device management...

2012-11-05 Thread Gavin Williams
Ok, have fixed that error aswell... 

Replaced *':configdir' *with *':confdir'*. 
However it's now failing due to the netapp.yml file not being present... 
What's confused me is the path it's come up with for *':confdir'*. 
According to the debug output, it's trying to use 

ESC[0;36mDebugESC[0m: Puppet::Device::Netapp: connecting to Netapp device 
> actint-star-nactl01.
> ESC[0;36mDebugESC[0m: Puppet::Device::Netapp: configdir is 
> /var/lib/puppet/devices/actint-star-nactl01.
>

However I would prefer it to use */etc/puppet* on the master...  
Any way I could do this, other than hard-coding? 

Cheers
Gavin

On Monday, 5 November 2012 11:24:16 UTC, Gavin Williams wrote:
>
> Ok, after a bit more googling, have solved the NaElement load error... 
>
> Tweaked the NaServer.rb file as follows:
>
> #require 'NaElement'
>> require File.dirname(__FILE__) + "/NaElement"
>>
>
> I've now successfully loaded the require Netapp SDK files, and started 
> working through the connection process...
> Though it looks like it's hit another error:
>
> Debug: Puppet::Device::Netapp: connecting to Netapp device 
>> actint-star-nactl01.
>> Debug: Puppet::Device::Netapp: configdir is .
>> Error: Can't load netapp for actint-star-nactl01: undefined method `+' 
>> for nil:NilClass
>>
>
> Tracked the above back to *device.rb*, where it's attempting to use *
> 'Puppet[:configdir]'* but is failing to find the value... 
>
> So now to work out what's going on there :) 
>
> Cheers
> Gav
>
> On Monday, 5 November 2012 10:47:56 UTC, Gavin Williams wrote:
>>
>> Hi all
>>
>> Following on from my previous post Puppet Network 
>> Devices..I've
>>  now started work on creating a NetApp network device provider for 
>> Puppet... 
>>
>> I'm trying to start simply by just gathering some facts from our filers. 
>>
>> The code soo far is available here: 
>> https://github.com/fatmcgav/shrug-netapp/ Credit to the original author 
>> shrug for setting out the framework... 
>>
>> Anyhow, onto my first challenge. 
>>
>> I've downloaded and added the relevant NetApp SDK files into *
>> modules/shrug-netapp/lib/puppet/util/network_device/netapp/* as shown 
>> below:
>>
>> $ ls -l modules/shrug-netapp/lib/puppet/util/network_device/netapp/
>>> total 88
>>> -rw-r--r--. 1 puppet puppet   924 Nov  2 17:13 device.rb
>>> -rw-r--r--. 1 puppet puppet  8229 Nov  2 17:16 DfmErrno.rb
>>> -rw-r--r--. 1 puppet puppet   228 Nov  2 17:00 facts.rb
>>> -rw-r--r--. 1 puppet puppet  9451 Nov  2 17:16 NaElement.rb
>>> -rw-r--r--. 1 puppet puppet 36089 Nov  2 17:15 NaErrno.rb
>>> -rw-r--r--. 1 puppet puppet 19036 Nov  2 17:15 NaServer.rb
>>>
>>  
>> The NaServer class is then included within the device.rb file above. 
>> However Puppet is currently failing with:
>>
>>> Info: starting applying configuration to actint-star-nactl01 at 
>>> actint-star-nactl01
>>> Error: Could not run: no such file to load -- NaElement
>>>
>>
>> This NaElement file is require'd by the NaServer class. 
>> However it seems to be failing due to the include path not including the 
>> NaElement.rb file... 
>> Therefore I'm guessing that Puppet/Ruby is looking for the NaElement file 
>> in some default location, rather than the same location as the NaServer 
>> class... 
>>
>> I've generated the same error on some tests scripts by moving the NetApp 
>> SDK files into a sdk sub folder, and then just *"require sdk/NaServer"*in my 
>> script, which generates a very similar error:
>>
>>> ruby hello_ontapi.rb  192.168.35.118 root xxx
>>> ./sdk/NaServer.rb:21:in `require': no such file to load -- NaElement 
>>> (LoadError)
>>> from ./sdk/NaServer.rb:21
>>> from hello_ontapi.rb:24:in `require'
>>> from hello_ontapi.rb:24
>>>
>>
>> Any ideas how I could work around this? 
>>
>> Cheers
>> Gavin 
>>  
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/puppet-users/-/UCHkWT5GWG0J.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.



[Puppet Users] Re: puppetdb postgresql Connection refused

2012-11-05 Thread linux@bami
Hi Nikola,

thanks for the response!

here are our configs:

 cat /etc/puppet/puppet.conf

[main]
server = lx1ml.unix.lan
logdir = /var/log/puppet
rundir = /var/run/puppet
confdir = /app/puppet/etc
vardir = /app/puppet/var
ssldir = $vardir/ssl
modulepath = $confdir/modules
manifest = $confdir/manifests/site.pp
pluginsync = true

[master]
certname = lx1ml.unix.lan
dns_alt_names = lx1ml.unix.lan
ssl_client_header = SSL_CLIENT_S_DN
ssl_client_verify_header = SSL_CLIENT_VERIFY
reports = tagmail,http
reportfrom = linux-supp...@xx.de
#reporturl = http://lx1ml.unix.lan:3000/reports/upload
storeconfigs = true
storeconfigs_backend = puppetdb
#facts_terminus = yaml
#facts_terminus = inventory_active_record
#dbadapter = mysql
#dbname = dashboard
#dbuser = dashboard
#dbpassword = x
#dbserver = puppetdb.unix.lan
#dbport = 
[production]
modulepath = /app/puppet/env/production/modules
manifest = /app/puppet/env/production/manifests/site.pp
[development]
modulepath = /app/puppet/env/development/modules
manifest = /app/puppet/env/development/manifests/site.pp


cat /etc/puppet/puppetdb.conf
[main]
server = lxj2j.unix.lan
port = 8081


Direkt connect from the puppetmaster to the puppetdb postgresql via psql
[lx1ml ~]# psql -h lxj2j -U puppetdb -d puppetdb


Telnet Connect is working:
[root@lx1ml ~]# telnet lxj2j 8081
Trying 172.20.250.153...
Connected to lxj2j.
Escape character is '^]'.
^CConnection closed by foreign host.


Puppetdb config from lxj2j:

cat /etc/puppetdb/conf.d/jetty.ini
[jetty]
# Hostname to list for clear-text HTTP.  Default is localhost
#host = localhost
# Port to listen on for clear-text HTTP.
port = 8080

ssl-host = lxj2j.unix.lan
ssl-port = 8081
keystore = /etc/puppetdb/ssl/keystore.jks
truststore = /etc/puppetdb/ssl/truststore.jks
removed passwords from output

[root@lxj2j data]# cat /etc/puppetdb/conf.d/database.ini |grep -v "^#"
[database]
classname = org.postgresql.Driver
subprotocol = postgresql
subname = //localhost:5432/puppetdb
log-slow-statements = 10
syntax_pgs = true
gc-interval = 60
username = puppetdb
password = puppetdb


Greetings 

Daniel


Am Montag, 5. November 2012 10:40:18 UTC+1 schrieb linux@bami:
>
> Greetings,
>
> we are trying to setup puppetdb, nut our clients get the following error:
>
> Warning: Unable to fetch my node definition, but the agent run will 
> continue:
> Warning: Error 400 on SERVER: Could not retrieve facts for lxa7t.unix.lan: 
> Failed to submit 'replace facts' command for lxa7t.unix.lan to PuppetDB at 
> puppetdb:8081: Connection refused - connect(2)
> Info: Retrieving plugin
> Info: Loading facts in /var/lib/puppet/lib/facter/bmemoryhugepages.rb
> Info: Loading facts in /var/lib/puppet/lib/facter/bstoragemanufacturer.rb
> Info: Loading facts in /var/lib/puppet/lib/facter/bmemoryshmmax.rb
> Info: Loading facts in /var/lib/puppet/lib/facter/bmemoryshmall.rb
> Error: Could not retrieve catalog from remote server: Error 400 on SERVER: 
> Failed to submit 'replace facts' command for lxa7t.unix.lan to PuppetDB at 
> puppetdb:8081: Connection refused - connect(2)
> Warning: Not using cache on failed catalog
> Error: Could not retrieve catalog; skipping run
>
>
> The puppetdb is remote for the puppetmaster and is using postgresql.
>
> Direct connect from puppetmaster to the postgresql puppetdb is vaild.
>
> We don't see any hint in the logfiles.
>
>
> R/ Daniel
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/puppet-users/-/VI1kAWjPLPEJ.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.



[Puppet Users] Re: Puppet NetApp Network device management...

2012-11-05 Thread Gavin Williams
Ok, after a bit more googling, have solved the NaElement load error... 

Tweaked the NaServer.rb file as follows:

#require 'NaElement'
> require File.dirname(__FILE__) + "/NaElement"
>

I've now successfully loaded the require Netapp SDK files, and started 
working through the connection process...
Though it looks like it's hit another error:

Debug: Puppet::Device::Netapp: connecting to Netapp device 
> actint-star-nactl01.
> Debug: Puppet::Device::Netapp: configdir is .
> Error: Can't load netapp for actint-star-nactl01: undefined method `+' for 
> nil:NilClass
>

Tracked the above back to *device.rb*, where it's attempting to use *
'Puppet[:configdir]'* but is failing to find the value... 

So now to work out what's going on there :) 

Cheers
Gav

On Monday, 5 November 2012 10:47:56 UTC, Gavin Williams wrote:
>
> Hi all
>
> Following on from my previous post Puppet Network 
> Devices..I've
>  now started work on creating a NetApp network device provider for 
> Puppet... 
>
> I'm trying to start simply by just gathering some facts from our filers. 
>
> The code soo far is available here: 
> https://github.com/fatmcgav/shrug-netapp/ Credit to the original author 
> shrug for setting out the framework... 
>
> Anyhow, onto my first challenge. 
>
> I've downloaded and added the relevant NetApp SDK files into *
> modules/shrug-netapp/lib/puppet/util/network_device/netapp/* as shown 
> below:
>
> $ ls -l modules/shrug-netapp/lib/puppet/util/network_device/netapp/
>> total 88
>> -rw-r--r--. 1 puppet puppet   924 Nov  2 17:13 device.rb
>> -rw-r--r--. 1 puppet puppet  8229 Nov  2 17:16 DfmErrno.rb
>> -rw-r--r--. 1 puppet puppet   228 Nov  2 17:00 facts.rb
>> -rw-r--r--. 1 puppet puppet  9451 Nov  2 17:16 NaElement.rb
>> -rw-r--r--. 1 puppet puppet 36089 Nov  2 17:15 NaErrno.rb
>> -rw-r--r--. 1 puppet puppet 19036 Nov  2 17:15 NaServer.rb
>>
>  
> The NaServer class is then included within the device.rb file above. 
> However Puppet is currently failing with:
>
>> Info: starting applying configuration to actint-star-nactl01 at 
>> actint-star-nactl01
>> Error: Could not run: no such file to load -- NaElement
>>
>
> This NaElement file is require'd by the NaServer class. 
> However it seems to be failing due to the include path not including the 
> NaElement.rb file... 
> Therefore I'm guessing that Puppet/Ruby is looking for the NaElement file 
> in some default location, rather than the same location as the NaServer 
> class... 
>
> I've generated the same error on some tests scripts by moving the NetApp 
> SDK files into a sdk sub folder, and then just *"require sdk/NaServer"*in my 
> script, which generates a very similar error:
>
>> ruby hello_ontapi.rb  192.168.35.118 root xxx
>> ./sdk/NaServer.rb:21:in `require': no such file to load -- NaElement 
>> (LoadError)
>> from ./sdk/NaServer.rb:21
>> from hello_ontapi.rb:24:in `require'
>> from hello_ontapi.rb:24
>>
>
> Any ideas how I could work around this? 
>
> Cheers
> Gavin 
>  
>

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/puppet-users/-/PFZpeJZd03sJ.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.



Re: [Puppet Users] puppetdb postgresql Connection refused

2012-11-05 Thread Nikola Petrov
On Mon, Nov 05, 2012 at 01:40:18AM -0800, linux@bami wrote:
> Greetings,
> 
> we are trying to setup puppetdb, nut our clients get the following error:
> 
> Warning: Unable to fetch my node definition, but the agent run will 
> continue:
> Warning: Error 400 on SERVER: Could not retrieve facts for lxa7t.unix.lan: 
> Failed to submit 'replace facts' command for lxa7t.unix.lan to PuppetDB at 
> puppetdb:8081: Connection refused - connect(2)
> Info: Retrieving plugin
> Info: Loading facts in /var/lib/puppet/lib/facter/bmemoryhugepages.rb
> Info: Loading facts in /var/lib/puppet/lib/facter/bstoragemanufacturer.rb
> Info: Loading facts in /var/lib/puppet/lib/facter/bmemoryshmmax.rb
> Info: Loading facts in /var/lib/puppet/lib/facter/bmemoryshmall.rb
> Error: Could not retrieve catalog from remote server: Error 400 on SERVER: 
> Failed to submit 'replace facts' command for lxa7t.unix.lan to PuppetDB at 
> puppetdb:8081: Connection refused - connect(2)
> Warning: Not using cache on failed catalog
> Error: Could not retrieve catalog; skipping run
> 
> 
> The puppetdb is remote for the puppetmaster and is using postgresql.
Can you post your puppet.conf master section and puppetdb.conf please?
> 
> Direct connect from puppetmaster to the postgresql puppetdb is vaild.
By direct you mean that you can run

puppet agent -t

on the master and it's working? Did you try to connect to the database
only with telnet as described here - 
http://docs.puppetlabs.com/puppetdb/0.9/install.html#troubleshooting-installation-problems


> 
> We don't see any hint in the logfiles.
> 
> 
> R/ Daniel

Best, Nikola

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.



[Puppet Users] Puppet NetApp Network device management...

2012-11-05 Thread Gavin Williams
Hi all

Following on from my previous post Puppet Network 
Devices..I've
 now started work on creating a NetApp network device provider for 
Puppet... 

I'm trying to start simply by just gathering some facts from our filers. 

The code soo far is available here: 
https://github.com/fatmcgav/shrug-netapp/ Credit to the original author 
shrug for setting out the framework... 

Anyhow, onto my first challenge. 

I've downloaded and added the relevant NetApp SDK files into *
modules/shrug-netapp/lib/puppet/util/network_device/netapp/* as shown below:

$ ls -l modules/shrug-netapp/lib/puppet/util/network_device/netapp/
> total 88
> -rw-r--r--. 1 puppet puppet   924 Nov  2 17:13 device.rb
> -rw-r--r--. 1 puppet puppet  8229 Nov  2 17:16 DfmErrno.rb
> -rw-r--r--. 1 puppet puppet   228 Nov  2 17:00 facts.rb
> -rw-r--r--. 1 puppet puppet  9451 Nov  2 17:16 NaElement.rb
> -rw-r--r--. 1 puppet puppet 36089 Nov  2 17:15 NaErrno.rb
> -rw-r--r--. 1 puppet puppet 19036 Nov  2 17:15 NaServer.rb
>
 
The NaServer class is then included within the device.rb file above. 
However Puppet is currently failing with:

> Info: starting applying configuration to actint-star-nactl01 at 
> actint-star-nactl01
> Error: Could not run: no such file to load -- NaElement
>

This NaElement file is require'd by the NaServer class. 
However it seems to be failing due to the include path not including the 
NaElement.rb file... 
Therefore I'm guessing that Puppet/Ruby is looking for the NaElement file 
in some default location, rather than the same location as the NaServer 
class... 

I've generated the same error on some tests scripts by moving the NetApp 
SDK files into a sdk sub folder, and then just *"require sdk/NaServer"* in 
my script, which generates a very similar error:

> ruby hello_ontapi.rb  192.168.35.118 root xxx
> ./sdk/NaServer.rb:21:in `require': no such file to load -- NaElement 
> (LoadError)
> from ./sdk/NaServer.rb:21
> from hello_ontapi.rb:24:in `require'
> from hello_ontapi.rb:24
>

Any ideas how I could work around this? 

Cheers
Gavin 
 

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/puppet-users/-/m2-tzSNj7QwJ.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.



[Puppet Users] Defining dynamic cron jobs

2012-11-05 Thread Alexander Holte-Davidsen
Hi all,

I have a application that I schedule via cron. This is a application that
runs once a week, either on Tuesday or Thursday. The scheduling is now done
via Puppet.

I now see that I need to redefine this, on some nodes the application
should for example only run the 3. Tuesday each month, not each Tuesday.
I want to do the scheduling using puppet and parameterized classes. For
example I want to be able to define:

foo {'Tuesday':
   week => '3',
   hour => '18',
   minute => '00',
}

This should generate a cron job ( that changes every month). For November
it should look like this:
00 18 20 11 *  /usr/bin/foo

Next month the crontab entry should be changed to:
00 18 18 20 * /usr/bin/foo

Has anyone done anything similar and are willing to give me some input on
how to solve this?

/ Alexander

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.



[Puppet Users] puppetdb postgresql Connection refused

2012-11-05 Thread linux@bami
Greetings,

we are trying to setup puppetdb, nut our clients get the following error:

Warning: Unable to fetch my node definition, but the agent run will 
continue:
Warning: Error 400 on SERVER: Could not retrieve facts for lxa7t.unix.lan: 
Failed to submit 'replace facts' command for lxa7t.unix.lan to PuppetDB at 
puppetdb:8081: Connection refused - connect(2)
Info: Retrieving plugin
Info: Loading facts in /var/lib/puppet/lib/facter/bmemoryhugepages.rb
Info: Loading facts in /var/lib/puppet/lib/facter/bstoragemanufacturer.rb
Info: Loading facts in /var/lib/puppet/lib/facter/bmemoryshmmax.rb
Info: Loading facts in /var/lib/puppet/lib/facter/bmemoryshmall.rb
Error: Could not retrieve catalog from remote server: Error 400 on SERVER: 
Failed to submit 'replace facts' command for lxa7t.unix.lan to PuppetDB at 
puppetdb:8081: Connection refused - connect(2)
Warning: Not using cache on failed catalog
Error: Could not retrieve catalog; skipping run


The puppetdb is remote for the puppetmaster and is using postgresql.

Direct connect from puppetmaster to the postgresql puppetdb is vaild.

We don't see any hint in the logfiles.


R/ Daniel

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/puppet-users/-/wOXZdv8QliQJ.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.



[Puppet Users] Re: Apply multiple defines in sequence

2012-11-05 Thread Erwin Bogaard
Thanks again for you reply, but it seems like you don't fully understand 
what I'm having problems with. So I'll try to clarify it a little more:
1. The current way of using two defines is working flawlessly. So I (at 
least partly) understand the concepts surrounding those.
2. Because I have two types of machines: some with just sugar and some with 
sugar and wordpress, I now use two defines that overlap in part (define1 
contains all kinds of info about creating sugar db + unpacking tar, etc, 
while define2 contains all the sugar info of define1 + stuff about creating 
a wordpress db + unpacking wp tar, etc), this means editing two files when 
I change something in the sugar define. As this can lead to differing 
configurations because of editing errors (and always twice the work), I 
would like to be able to split the defines up, so I can call define1 
(sugar) on all machines and define1 (sugar) and sefine 2 (wordpress) on the 
other machines.
3. Some of the variables are shared, for example the mysqld_pwd is used 
twice, and I add a different suffix for sugar and wordpress to get two 
databases. For the httpd-configuration, I specify a different template, 
which is easy to to with defines. So all instances have unique resources, 
hence the choice for defines, not classes.

Does this help you help me?



On Thursday, November 1, 2012 3:27:10 PM UTC+1, Erwin Bogaard wrote:
>
> I'm having trouble getting the following scenario to work:
> - I have two defines, for example 'sugar' and 'wordpress'.
> - Some nodes need to have both applied, others only sugar.
> - Because you can't use the same resource twice (not that I want to), I 
> can't figure out how to apply two separate defines to one resource
>
> At  the moment I use the following workaround: I have two defines, one 
> with only sugar and one with both sugar and wordpress. As I have to change 
> both files if I change something for Sugar, this really isn't optimal.
> Anyone a suggestion?
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/puppet-users/-/rPV6a-6SduwJ.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.



Re: [Puppet Users] Re: puppet instllation error

2012-11-05 Thread 刘磊
My problem is similar, the RC is I accidentally deleted the localhost 
127.0.0.1 entity in /etc/hosts file, but the puppet.conf relay heavily on 
this(i.e. The configuration used localhost a lot), after I appended that 
entity, everything works fine, just appended here for your reference. 

On Tuesday, October 23, 2012 2:08:13 PM UTC+8, Saravanan Veeran wrote:
>
>
> This webpage has a redirect loop
> I also had the same problem. The RC is with the hostname in hosts file.
> Change your host name in /etc/hosts with fqdn. 
> That's it.
> Now, the redirection won't happen.
>
> Regards,
> VSARA90
>
> On Tuesday, 2 October 2012 01:25:08 UTC+5:30, skrishna12 wrote:
>>
>> Can you  any one let me know  what could be the issue on this?
>>
>>
>> On Friday, September 28, 2012 3:56:53 PM UTC-7, skrishna12 wrote:
>>>
>>> I tried the credential (mail id and password) stored in 
>>> answer.lastun.xxx  and got the following error. Even after clearing the 
>>> cookies and caches .. no luck with  the mail id and password 
>>>
>>>
>>> This webpage has a redirect loop
>>> The webpage at *
>>> https://puppet-master.etouch.net:3000/?ticket=ST-1348829403r7DD1A83EF03491318C
>>> * has resulted in too many redirects. Clearing your cookies for this 
>>> site or allowing third-party cookies may fix the problem. If not, it is 
>>> possibly a server configuration issue and not a problem with your computer.
>>> Here are some suggestions:
>>>
>>>- 
>>> Reload
>>>  this 
>>>webpage later.
>>>- Learn 
>>> more
>>>  about 
>>>this problem.
>>>
>>> Error 310 (net::ERR_TOO_MANY_REDIRECTS): There were too many redirects.
>>>
>>> On Friday, September 28, 2012 2:37:39 PM UTC-7, Matthaus Litteken wrote:

 Glad that helped you get through the installation. The installer 
 should have asked you those questions during the interview, and they 
 are saved in the answers file as well. 

 The console admin user and password will be in the 
 puppet-enterprise-2.6.0-el5-x86_64 directory (wherever you have the 
 installer located) in a file named answers.lastrun. 
 (which for you will be 'answers.lastrun.puppet-master.etouch.net') 

 The answers you need to look for in that file are: 

 q_puppet_enterpriseconsole_auth_password= 
 q_puppet_enterpriseconsole_auth_user_email= 

 HTH 

 On Fri, Sep 28, 2012 at 2:16 PM, skrishna12  
 wrote: 
 > The  auto generated user name password is here 
 > 
 > # cat  etc/puppetlabs/installer/database_info.install 
 > 
 > q_puppet_enterpriseconsole_auth_database_name=console_auth 
 > 
 q_puppet_enterpriseconsole_auth_database_password=c8ZwU6TVlgcdvTA5ysv6 
 > q_puppet_enterpriseconsole_auth_database_user=console_auth 
 > q_puppet_enterpriseconsole_database_install=n 
 > q_puppet_enterpriseconsole_database_name=console 
 > q_puppet_enterpriseconsole_database_password=2kjrLEVGna95KXQPHac3 
 > q_puppet_enterpriseconsole_database_remote=n 
 > q_puppet_enterpriseconsole_database_root_password=eTouch6789 
 > q_puppet_enterpriseconsole_database_user=console 
 > 
 > thanks 
 > 
 > On Friday, September 28, 2012 2:13:32 PM UTC-7, skrishna12 wrote: 
 >> 
 >> Thanks!! 
 >> I removed all  mysql pkg and reinstall PE . I got the following 
 messages. 
 >> I can see admin console but not sure about the username and passwd. 
 This 
 >> time when i installed . the installer didnot ask any console 
 username and 
 >> password. Pls  help me this out 
 >> 
 >> 
 >> 
 >> Puppet Enterprise has been installed to "/opt/puppet," and its 
 >> configuration files are located in "/etc/puppetlabs". 
 >> ## Answers from this session saved to 
 >> './answers.lastrun.puppet-master.etouch.net' 
 >> ## In addition, auto-generated database users and passwords, 
 including the 
 >> ROOT MySQL password, have been saved to 
 >> "/etc/puppetlabs/installer/database_info.install" 
 >>!!! WARNING: Do not discard these files! All auto-generated 
 database 
 >> users and passwords, including the ROOT Mysql password, have been 
 saved in 
 >> them. 
 >> 
 >> 
 =
  

 >> 
 >> The console can be reached at the following URI: 
 >>  *  https://puppet-master.etouch.net:3000 
 >> 
 >>If you have a firewall running, please ensure the following TCP 
 ports 
 >> are open: 8140, 61613, 3000 
 >>NOTICE: This system has 1.96 GB of memory, which is below the 4 
 GB we 
 >> recommend for the puppet master role. Although this node will be a