Re: [Puppet Users] Prefetch in custom types in Puppet v4?

2016-01-27 Thread Gareth Rushgrove
On 19 January 2016 at 01:52, Jakov Sosic  wrote:
> Hi guys,
>
>
> I've noticed the following problem with one of my providers in v4.
>
> This is the original prefetch method I used:
>
>def self.prefetch(resources)
>  instances.each do |prov|
>if resource = resources[prov[:name]]
>  resource.provider = prov
> +resource.provider = new(prov)
>end
>  end
>end
>
>
>
> This was throwing out following errors:
>
> Error: Failed to apply catalog: undefined method `intern' for
> #
>
>
>
> After that I changed it to:
>
> def self.prefetch(resources)
>   instances.each do |prov|
> if resource = resources[prov[:name]]
>   resource.provider = new(prov)
> end
>   end
> end
>
> Now, puppet agent doesn't throw out any error, but when I run:
>
> # puppet resource myprovider
> Error: Could not run: undefined method `name' for #
>
>

My guess is it's an issue in your self.instances method and a matter
of exactly where you're called new. I nearly always having something
like:


def self.prefetch(resources)
  instances.each do |prov|
if resource = resources[prov.name]
  resource.provider = prov
end
  end
end

Where instances returns an array of objects created using new.

def self.instances
  some_list_of_things.collect do |obj|
new({
 name: obj.name,
  ensure: :present,
})
  end
end

Hopefully that helps, if not I'd recommend posting a gist of the
self.instances method or a pointer to the whole provider.

Thanks

Gareth

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



-- 
Gareth Rushgrove
@garethr

devopsweekly.com
morethanseven.net
garethrushgrove.com

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


[Puppet Users] Error when installing Puppet Enterprise

2016-01-27 Thread Chinmay Dingore
Hi All. This is my first time to install Puppet Enterprise. However, I 
receive the error when installing it on CentOS 6.4 64 bit OS. 

[puppet.mydomain.com] An error occured while performing 
install_pe_puppet.mydomain.com: invalid byte sequence in US-ASCII


If anybody could point me in right direction, it will be much appreciated. 


Chinmay

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


[Puppet Users] configuration not applying but getting notice: Finished catalog run in 0.02 seconds

2016-01-27 Thread kumar kittu
Hi,

I am new to puppet and installed puppet standalone in my linux box.
I generated module with command:"puppet module generate test-sample" .

created  file in test-sample/manifests/site.pp:
 
class sample::site {
file { '/root/puppetfilecreation.txt':
 ensure => "present",
 owner => "root",
 group => "root",
 content => "hello Puppet had created file with module test",
}
}

and /test-sample/manifest/init.pp(this was automatically created by puppet 
generate )

class sample {

include sample::site (added this line)
}

When executed "puppet apply 
/etc/puppet/modules/test-sample/manifests/init.pp" below the response:

notice: Finished catalog run in 0.02 seconds

Issue : this puppet is not creating file which, I mentioned in site.pp

Please help me where i am getting wrong.

Thanks in advance

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/21331cb4-1b64-45d4-8c45-6792cc0424bc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Puppet Users] configuration not applying but getting notice: Finished catalog run in 0.02 seconds

2016-01-27 Thread Hristo Mohamed
*created  file in test-sample/manifests/site.pp:*

Rename it to sample/manifetsts.site.pp

Cheers,
Hristo

On Wed, Jan 27, 2016 at 11:50 AM, kumar kittu  wrote:

> Hi,
>
> I am new to puppet and installed puppet standalone in my linux box.
> I generated module with command:"puppet module generate test-sample" .
>
> created  file in test-sample/manifests/site.pp:
>
> class sample::site {
> file { '/root/puppetfilecreation.txt':
>  ensure => "present",
>  owner => "root",
>  group => "root",
>  content => "hello Puppet had created file with module test",
> }
> }
>
> and /test-sample/manifest/init.pp(this was automatically created by puppet
> generate )
>
> class sample {
>
> include sample::site (added this line)
> }
>
> When executed "puppet apply
> /etc/puppet/modules/test-sample/manifests/init.pp" below the response:
>
> notice: Finished catalog run in 0.02 seconds
>
> Issue : this puppet is not creating file which, I mentioned in site.pp
>
> Please help me where i am getting wrong.
>
> Thanks in advance
>
> --
> You received this message because you are subscribed to the Google Groups
> "Puppet Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to puppet-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/puppet-users/21331cb4-1b64-45d4-8c45-6792cc0424bc%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

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


Re: [Puppet Users] Error: Could not find class apache

2016-01-27 Thread Frederik Bjerggaard Nielsen
What if you try running:

puppet apply C:\Maruti\Puppet\manifests\site.pp 
--modulepath C:\Maruti\Puppet\modules

Den tirsdag den 26. januar 2016 kl. 15.32.07 UTC+1 skrev Maruti Gangumolu:
>
> Hi Lowe,
>
> Here are the details
>
> This is the directory structure for manifests file site.pp and nodes.pp 
>  :-  "C:\Maruti\Puppet\manifests"
>
> The is the code for site.pp file
>
> import 'nodes.pp'
>
> This is the code for nodes.pp file
>
> node 'IMIBLRKA1030' {
>  include apache
> }
>
> 
>
> This is the directory structure for module's manifests file  init.pp :- 
> "C:\Maruti\Puppet\modules\apache\manifests"
> This is the code for init.pp file
>
> # Manage apache tomcat v8 application server
> class apache {
>  package { 'Tomcat8' :
>   ensure => present,
>   source => 'C:/Maruti/Puppet/apache-tomcat-8.0.30.exe',
>   install_options => ['/S','/D=C:\Maruti\Puppet\apache-tomcat-8'],
>   description => 'Installing tomcat v8.0.30 on windows system', 
>  }
> }
>
> and I'm invoking site.pp file using puppet apply command as mentioned 
> below and getting class apache is not found.
>
> C:\>puppet apply C:\Maruti\Puppet\manifests\site.pp
> Warning: The use of 'import' is deprecated at 
> C:/Maruti/Puppet/manifests/site.pp
> :1. See http://links.puppetlabs.com/puppet-import-deprecation
>(at C:/Program Files/Puppet 
> Labs/Puppet/puppet/lib/puppet/parser/parser_suppo
> rt.rb:110:in `import')
> Error: Could not find class apache for x on node imiblrka
> Error: Could not find class apache for x on node imiblrka
>
> Thanks,
> Maruti.
>
>
>
>
>
>
>
> On Tue, Jan 26, 2016 at 1:41 AM, Maruti Gangumolu  > wrote:
>
>> Hi Team,
>>
>> I'm new to puppet coding and I'm trying to install apache tomcat using 
>> class which is being included in nodes.pp file. 
>>
>> I'm getting this error message when running site.pp file
>>
>> C:\ABC\Puppet\manifests>puppet apply C:\ABC\Puppet\manifests\site.pp
>> Warning: The use of 'import' is deprecated at 
>> C:/ABC/Puppet/manifests/site.pp
>> :1. See http://links.puppetlabs.com/puppet-import-deprecation
>>(at C:/Program Files/Puppet 
>> Labs/Puppet/puppet/lib/puppet/parser/parser_suppo
>> rt.rb:110:in `import')
>> Error: Could not find class apache for  on node imiblr
>> Error: Could not find class apache for  on node imiblr
>>
>> Could you please help me in fixing this issue?
>>
>> -- 
>> You received this message because you are subscribed to a topic in the 
>> Google Groups "Puppet Users" group.
>> To unsubscribe from this topic, visit 
>> https://groups.google.com/d/topic/puppet-users/tIS3pSfnrSQ/unsubscribe.
>> To unsubscribe from this group and all its topics, send an email to 
>> puppet-users...@googlegroups.com .
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/puppet-users/2a28a925-5fd8-4d2e-992d-c4df22e944b4%40googlegroups.com
>>  
>> 
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

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


[Puppet Users] Getting Yum errors for nginx install

2016-01-27 Thread mike r
running nginx module on centos 6.6 (only getting this error for centos 66, 
also tried centos 7 and ubuntu 12,14 and no errors,)

wondering if anyone has seen this output.

*Error: Execution of '/usr/bin/yum -d 0 -e 0 -y install nginx' returned 1: 
Error: Nothing to do*
*Error: /Stage[main]/Nginx::Install/Package[nginx]/ensure: change from 
purged to present failed: Execution of '/usr/bin/yum -d 0 -e 0 -y install 
nginx' returned 1: Error: Nothing to do*



my install.pp looks like this,


 # check node agent version
$fqdn = $::fqdn

if $puppet_agent_version < '3.8' {
  fail(" Node ${fqdn} has a Puppet agent version: 
${puppet_agent_version} which is not compatible with this module. Need to 
have minimum Puppet agent 3.8 -")
}


package { 'nginx':
  name   => $package_name,
  ensure => present,
}


file { [$nginx_dirs]:
  ensure  => directory,
  mode=> '0644',
  owner   => 'root',
  group   => 'root',
  require => Package['nginx'],
}


user { 'nginx_user':
  name => $user,
  ensure   => 'present',
  comment  => "${user}",
  home => '/var/www',
  password => '*',
  password_max_age => '9',
  password_min_age => '0',
  shell=> '/usr/sbin/nologin',
  require  => Package['nginx'],
}


}



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


[Puppet Users] Re: Getting Yum errors for nginx install

2016-01-27 Thread mike r
looks like issues w  my repos.d, had to install 

sudo yum install epel-release



On Wednesday, January 27, 2016 at 8:12:16 AM UTC-5, mike r wrote:
>
> running nginx module on centos 6.6 (only getting this error for centos 66, 
> also tried centos 7 and ubuntu 12,14 and no errors,)
>
> wondering if anyone has seen this output.
>
> *Error: Execution of '/usr/bin/yum -d 0 -e 0 -y install nginx' returned 1: 
> Error: Nothing to do*
> *Error: /Stage[main]/Nginx::Install/Package[nginx]/ensure: change from 
> purged to present failed: Execution of '/usr/bin/yum -d 0 -e 0 -y install 
> nginx' returned 1: Error: Nothing to do*
>
>
>
> my install.pp looks like this,
>
>
>  # check node agent version
> $fqdn = $::fqdn
>
> if $puppet_agent_version < '3.8' {
>   fail(" Node ${fqdn} has a Puppet agent version: 
> ${puppet_agent_version} which is not compatible with this module. Need to 
> have minimum Puppet agent 3.8 -")
> }
>
>
> package { 'nginx':
>   name   => $package_name,
>   ensure => present,
> }
>
>
> file { [$nginx_dirs]:
>   ensure  => directory,
>   mode=> '0644',
>   owner   => 'root',
>   group   => 'root',
>   require => Package['nginx'],
> }
>
>
> user { 'nginx_user':
>   name => $user,
>   ensure   => 'present',
>   comment  => "${user}",
>   home => '/var/www',
>   password => '*',
>   password_max_age => '9',
>   password_min_age => '0',
>   shell=> '/usr/sbin/nologin',
>   require  => Package['nginx'],
> }
>
>
> }
>
>
>
>

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


[Puppet Users] Re: exec without a shell

2016-01-27 Thread jcbollinger


On Tuesday, January 26, 2016 at 7:40:06 PM UTC-6, Stefan Schulte wrote:
>
> Hello, 
>
> I've got a quick question about the exec type. The exec type does have a 
> shell provider and a posix provider and the posix provider says 
>
> # 
>
> https://github.com/puppetlabs/puppet/blob/master/lib/puppet/provider/exec/posix.rb
>  
> Executes external binaries **directly, without passing through a 
> shell** or 
> performing any interpolation. This is a safer and more predictable way 
> to execute most commands, but prevents the use of globbing and shell 
> built-ins (including control logic like "for" and "if" statements). 
>
> but when I test the following manifest: 
>
> $unsafe_input = "I will fail; /bin/false" 
> 
> exec { 'Test01': 
>   command  => "/bin/echo ${unsafe_input}", 
>   provider => posix, 
> } 
> 
> exec { 'Test02': 
>   command  => shellquote("/bin/echo", $unsafe_input), 
>   provider => posix, 
> } 
>
>
> then the first test will fail (because /bin/false is executed instead of 
> printed), while the second test does work (I am not sure how reliable 
> shellquote acutally works though). 
>
> # on puppet version 4.3.1: 
> Notice: /Stage[main]/Main/Exec[Test01]/returns: I will fail 
> Error: /bin/echo I will fail; /bin/false returned 1 instead of one 
> of [0] 
> Error: /Stage[main]/Main/Exec[Test01]/returns: change from notrun to 
> 0 failed: /bin/echo I will fail; /bin/false returned 1 instead of one of 
> [0] 
> Notice: /Stage[main]/Main/Exec[Test02]/returns: executed successfully 
>
> Am I misreading the documentation here? 
>
>

No, I think rather that the documentation is misleading, and / or this is a 
longstanding Puppet bug.  I recently had occasion to look at the Ruby 
implementation of Exec and its standard providers.  Puppet implements the 
"posix" provider by passing the command to Ruby's Kernel.exec() 
.  Until I read 
its docs (linked), I had supposed that Kernel.exec() was a more-or-less 
direct interface to the POSIX execve() family of functions, which indeed 
would do as the Puppet docs describe.

In fact, the behavior of Kernel.exec() depends on the form of its 
arguments.  Some forms do seem to map directly onto calls to the C 
exec-family functions, but Puppet uses the one-arg form, which does not.  I 
will not rehash the details from the linked docs, but the bottom line for 
your particular example is that including a semicolon (;) in your command 
string *ensures* that it will be run via a shell.

Since the behavior is at odds with the docs, I guess there is necessarily 
either a documentation flaw or an implementation flaw here.


John


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


[Puppet Users] Re: configuration not applying but getting notice: Finished catalog run in 0.02 seconds

2016-01-27 Thread jcbollinger


On Wednesday, January 27, 2016 at 4:52:20 AM UTC-6, kumar kittu wrote:
>
> Hi,
>
> I am new to puppet and installed puppet standalone in my linux box.
> I generated module with command:"puppet module generate test-sample" .
>
> created  file in test-sample/manifests/site.pp:
>  
> class sample::site {
> file { '/root/puppetfilecreation.txt':
>  ensure => "present",
>  owner => "root",
>  group => "root",
>  content => "hello Puppet had created file with module test",
> }
> }
>
> and /test-sample/manifest/init.pp(this was automatically created by puppet 
> generate )
>
> class sample {
>
> include sample::site (added this line)
> }
>
> When executed "puppet apply 
> /etc/puppet/modules/test-sample/manifests/init.pp" below the response:
>
> notice: Finished catalog run in 0.02 seconds
>
> Issue : this puppet is not creating file which, I mentioned in site.pp
>
> Please help me where i am getting wrong.
>


I see at least two distinct problems:

   1. You are structuring your code in a module (which is good), but you 
   are naming the module directory incorrectly.  The name of the module 
   directory should be the same as the name of the module (sample).
   2. You have some class *definitions*, but neither any node blocks nor 
   any top-level class *declarations*.  Your class definitions describe 
   your classes to Puppet, but you need a declaration to tell Puppet to 
   actually *apply* those classes to your node.  Such a declaration would 
   typically go in a node block that matches the target node (possibly a 
   default block), but for standalone Puppet it is also reasonable to put such 
   a declaration at top scope in a manifest file that you ask Puppet to 
   evaluate.  This is why Puppet neither makes any changes nor reports any 
   error -- you haven't given it anything to do.
   
Also, I'm not sure whether this is actually an issue for you, but your 
description seems to say that you have made your module directory a direct 
subdirectory of the filesystem root.  That would be a very questionable 
choice.  It could work if you have configured Puppet to have the filesystem 
root in its module path, but I strongly advise you to create a directory 
elsewhere to serve as the parent of all your module directories, and to put 
*that* in your module path.  Or just use Puppet's default (which depends on 
which Puppet version you are running and on how you run it).


John

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


Re: [Puppet Users] New Resource Type for bareos

2016-01-27 Thread Björn
Hi Thomas,

I got a hiera group of linux boxes. All of these should have the bareos 
client and should backup a standard fileset for instance /var/log. 
Okay, the backup client array on the master module would work, but if you 
forget to add a backup client you got no backup. Now I'm dreaming from a 
implementation through puppetdb like the nagios resource types. 
Or a solution that all backup clients automaticly register at the server. 
>From my point of view the automic configuration is preferable, because a 
missing backup can have the same impact as missing monitoring. 

May there are better solutions to handle it without puppetdb, I'm not sure. 

Regards,
Björn

Am Dienstag, 26. Januar 2016 16:48:52 UTC+1 schrieb thbe:
>
> Hi Björn,
>
> depends on how you would like to implement the fully automatic 
> configuration. I do this on the server side because backup is nothing that 
> apply out of the box after provisioning to the client and server. Under 
> normal circumstances I would like to add a client only to the backup if 
> really needed. Therefore I used an array in my module to specify the client:
>
> https://github.com/thbe/puppet-bareos
>
> The module is still v0.1.0, so it’s not yet feature complete and not 
> released on the forge but works the way I need it. I think I’ll release it 
> on the forge sometime in Q1/2016 when missing features are implemented.
>
> Regards Thomas
>
> Am 21.01.2016 um 15:23 schrieb Björn >:
>
> Hello,
>
> I try to make the bareos puppet module ready for puppetdb and fully 
> automatic configuration. 
>
> When I understand correctly, I'll need a resource type to export it and 
> bring the client configuration on the bareos server finally. 
>
> $ cat bareos/lib/puppet/type/bareos_client.rb 
> Puppet::Type.newtype(:bareos_client) do
>   desc 'TEST'
>   ensurable 
>   newparam(:name, :isnamevar => true) do
> desc "The name of the client."
>   end
> end
>
> $ tail bareos/manifests/client.pp
> mode=> '0644',
> owner   => 'bareos',
> group   => 'bareos',
>   } 
>
>   @@bareos_client{ $::hostname:
>   }
>
>   Bareos_client <<| |>>
> }
>
> I get this error when I make a puppet run on the client:
> Error: /Stage[main]/Bareos::Client/Bareos_client[PC3256CO]: Could not 
> evaluate: No ability to determine if bareos_client exists
> /usr/lib/ruby/site_ruby/1.8/puppet/property/ensure.rb:85:in `retrieve'
> /usr/lib/ruby/site_ruby/1.8/puppet/type.rb:1048:in `retrieve'
> /usr/lib/ruby/site_ruby/1.8/puppet/type.rb:1076:in `retrieve_resource'
> /usr/lib/ruby/site_ruby/1.8/puppet/transaction/resource_harness.rb:236:in 
> `from_resource'
> /usr/lib/ruby/site_ruby/1.8/puppet/transaction/resource_harness.rb:19:in `
> evaluate'
> /usr/lib/ruby/site_ruby/1.8/puppet/transaction.rb:204:in `apply'
> /usr/lib/ruby/site_ruby/1.8/puppet/transaction.rb:217:in `eval_resource'
> /usr/lib/ruby/site_ruby/1.8/puppet/transaction.rb:147:in `call'
> /usr/lib/ruby/site_ruby/1.8/puppet/transaction.rb:147:in `evaluate'
> /usr/lib/ruby/site_ruby/1.8/puppet/util.rb:335:in `thinmark'
> /usr/lib/ruby/1.8/benchmark.rb:308:in `realtime'
> /usr/lib/ruby/site_ruby/1.8/puppet/util.rb:334:in `thinmark'
> /usr/lib/ruby/site_ruby/1.8/puppet/transaction.rb:147:in `evaluate'
> /usr/lib/ruby/site_ruby/1.8/puppet/graph/relationship_graph.rb:118:in `
> traverse'
> /usr/lib/ruby/site_ruby/1.8/puppet/transaction.rb:138:in `evaluate'
> /usr/lib/ruby/site_ruby/1.8/puppet/resource/catalog.rb:169:in `apply'
> /usr/lib/ruby/site_ruby/1.8/puppet/util/log.rb:149:in `with_destination'
> /usr/lib/ruby/site_ruby/1.8/puppet/transaction/report.rb:112:in 
> `as_logging_destination'
> /usr/lib/ruby/site_ruby/1.8/puppet/resource/catalog.rb:168:in `apply'
> /usr/lib/ruby/site_ruby/1.8/puppet/configurer.rb:120:in `apply_catalog'
> /usr/lib/ruby/site_ruby/1.8/puppet/util.rb:161:in `benchmark'
> /usr/lib/ruby/1.8/benchmark.rb:308:in `realtime'
> /usr/lib/ruby/site_ruby/1.8/puppet/util.rb:160:in `benchmark'
> /usr/lib/ruby/site_ruby/1.8/puppet/configurer.rb:119:in `apply_catalog'
> /usr/lib/ruby/site_ruby/1.8/puppet/configurer.rb:227:in `run_internal'
> /usr/lib/ruby/site_ruby/1.8/puppet/configurer.rb:134:in `run'
> /usr/lib/ruby/site_ruby/1.8/puppet/context.rb:64:in `override'
> /usr/lib/ruby/site_ruby/1.8/puppet.rb:246:in `override'
> /usr/lib/ruby/site_ruby/1.8/puppet/configurer.rb:133:in `run'
> /usr/lib/ruby/site_ruby/1.8/puppet/agent.rb:47:in `run'
> /usr/lib/ruby/site_ruby/1.8/puppet/agent/locker.rb:20:in `lock'
> /usr/lib/ruby/site_ruby/1.8/puppet/agent.rb:47:in `run'
> /usr/lib/ruby/site_ruby/1.8/puppet/agent.rb:117:in `with_client'
> /usr/lib/ruby/site_ruby/1.8/puppet/agent.rb:44:in `run'
> /usr/lib/ruby/site_ruby/1.8/puppet/agent.rb:82:in `run_in_fork'
> /usr/lib/ruby/site_ruby/1.8/puppet/agent.rb:43:in `run'
> /usr/lib/ruby/site_ruby/1.8/puppet/application.rb:179:in `call'
> /usr/lib/ruby/site_ruby/1.8/puppet/application.rb:179:in `controlled_run'
> /usr/lib/ruby/site_ruby/1.8/puppet/agent.rb:41:in `run'
> /usr/l

[Puppet Users] Warning: Local environment: "production" doesn't match server specified node environment

2016-01-27 Thread Matt Zagrabelny
Greetings,

I've searched a bit and found some hits for the subject, but nothing that helps.

I'm using an ENC to drive the environment of my nodes.

I don't have "production" defined anywhere in my puppet.conf:

# grep production /etc/puppet/puppet.conf || echo "not there"
not there

and it is not defined on my command-line run:

puppet agent -t --server puppet-3-7 --debug

but I still get a warning about the local environment:

Warning: Local environment: "production" doesn't match server
specified node environment "apt", switching agent to "apt".

Where else (besides the /etc/puppet/puppet.conf and the command-line
option --environment) do I look for the local environment being set?

Thanks!

-m

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


RE: [Puppet Users] Error: Could not find class apache

2016-01-27 Thread Maruti Gangumolu
The behaviour was same!

-Original Message-
From: "Frederik Bjerggaard Nielsen" 
Sent: ‎27-‎01-‎2016 16:56
To: "Puppet Users" 
Subject: Re: [Puppet Users] Error: Could not find class apache

What if you try running:


puppet apply C:\Maruti\Puppet\manifests\site.pp --modulepath 
C:\Maruti\Puppet\modules

Den tirsdag den 26. januar 2016 kl. 15.32.07 UTC+1 skrev Maruti Gangumolu:
Hi Lowe,


Here are the details


This is the directory structure for manifests file site.pp and nodes.pp  :-  
"C:\Maruti\Puppet\manifests"


The is the code for site.pp file


import 'nodes.pp'


This is the code for nodes.pp file


node 'IMIBLRKA1030' {
 include apache
}





This is the directory structure for module's manifests file  init.pp :- 
"C:\Maruti\Puppet\modules\apache\manifests"
This is the code for init.pp file


# Manage apache tomcat v8 application server
class apache {
 package { 'Tomcat8' :
  ensure => present,
  source => 'C:/Maruti/Puppet/apache-tomcat-8.0.30.exe',
  install_options => ['/S','/D=C:\Maruti\Puppet\apache-tomcat-8'],
  description => 'Installing tomcat v8.0.30 on windows system', 
 }
}


and I'm invoking site.pp file using puppet apply command as mentioned below and 
getting class apache is not found.


C:\>puppet apply C:\Maruti\Puppet\manifests\site.pp
Warning: The use of 'import' is deprecated at C:/Maruti/Puppet/manifests/site.pp
:1. See http://links.puppetlabs.com/puppet-import-deprecation
   (at C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/parser/parser_suppo
rt.rb:110:in `import')
Error: Could not find class apache for x on node imiblrka
Error: Could not find class apache for x on node imiblrka



Thanks,
Maruti.












On Tue, Jan 26, 2016 at 1:41 AM, Maruti Gangumolu  wrote:

Hi Team,


I'm new to puppet coding and I'm trying to install apache tomcat using class 
which is being included in nodes.pp file. 


I'm getting this error message when running site.pp file


C:\ABC\Puppet\manifests>puppet apply C:\ABC\Puppet\manifests\site.pp
Warning: The use of 'import' is deprecated at C:/ABC/Puppet/manifests/site.pp
:1. See http://links.puppetlabs.com/puppet-import-deprecation
   (at C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/parser/parser_suppo
rt.rb:110:in `import')
Error: Could not find class apache for  on node imiblr
Error: Could not find class apache for  on node imiblr


Could you please help me in fixing this issue?

-- 
You received this message because you are subscribed to a topic in the Google 
Groups "Puppet Users" group.
To unsubscribe from this topic, visit 
https://groups.google.com/d/topic/puppet-users/tIS3pSfnrSQ/unsubscribe.
To unsubscribe from this group and all its topics, send an email to 
puppet-users...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/2a28a925-5fd8-4d2e-992d-c4df22e944b4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



-- 
You received this message because you are subscribed to a topic in the Google 
Groups "Puppet Users" group.
To unsubscribe from this topic, visit 
https://groups.google.com/d/topic/puppet-users/tIS3pSfnrSQ/unsubscribe.
To unsubscribe from this group and all its topics, send an email to 
puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/97d63042-b137-4633-a3c6-778b9a7001ca%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

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


[Puppet Users] Problems testing branching using rspec-puppet with hiera

2016-01-27 Thread jwilkicki
Hi all!

I've been banging my head against this for the past couple of days and I'm 
pretty stuck.  I've started implementing rspec tests for a class that uses 
a hiera lookup and then uses the looked up value to control part of its 
logic.  A simplified version:

class mytest {
  
 $mycondition = hiera('my::condition')

 if $mycondition {
 ...
 }

}


My spec_helper looks like this:

require 'rubygems'
require 'puppetlabs_spec_helper/module_spec_helper'


RSpec.configure do |c|
  c.hiera_config = 'spec/fixtures/hiera/hiera.yaml'
end

So far, so standard.   What I want to be able to test, obviously, is making 
sure that when $mycondition is true, the resources in the if statement are 
added to the catalog, and if $mycondition is false, they aren't.

So, my spec in spec/classes/mytest_spec.rb looks like this:

require 'spec_helper'

describe 'mytest' do

  let(:node) { 'truecondition' }
  if {
should compile
  }

end

My hiera.yaml file looks like this:

---
 :backends:
- yaml
 :yaml:
   :datadir: 'spec/fixtures/hieradata'
 :hierarchy:
   - "%{::fqdn}"

and my spec/fixtures/hieradata/truecondition.yaml looks like this:

---
  my::condition: false


With this setup, my spec class returns an error:

Failures:

  1) mytest should compile into a catalogue
without dependency cycles
 Failure/Error: should compile
   error during compilation: Evaluation Error: Error while evaluating a 
Func
tion Call, Could not find data item my::condition in any Hiera data file
 and no default supplied at 
C:/puppet/mytest/spec/fixtures/modules/mytest/manifests/init.pp:3:22 on 
node truecondition
 # ./spec/classes/mytest_spec.rb:7:in `block (2 levels) in
'

Finished in 0.4212 seconds (files took 2.42 seconds to load)
1 example, 1 failure

Ultimately, I thought I could specify a different context for each state of 
$mycondition: true and false, so my test would look like:


require 'spec_helper'

describe 'mytest' do
   context "with mycondition => true" do
   let(:node) { 'truecondition' }
   if {
should compile
   }
   end

   context "with mycondition => false" do
   let(:node) { 'falsecondition' }
   if {
should compile
   }
   end

end

I tried having my contexts set a fact that hiera could use to select which 
yaml file it got data from: didn't work.  I tried having a different 
hiera.yaml file, one for true and one for false, that would load a 
different common.yaml (since common.yaml seems to work, but nothing else), 
and that didn't work.  The example above was the last thing I tried, since 
rspec-puppet is supposed to provide the fqdn fact, so I thought setting the 
node might help it switch. Failure on all sides!

I'm trying to do this because we've tried to write our profiles following 
the practice of doing hiera lookups instead of class parameters, as 
recommended here: 
 http://garylarizza.com/blog/2014/10/24/puppet-workflows-4-using-hiera-in-anger/

At this point, I'm almost ready to throw in the towel.  There has to be 
some way to change what values hiera supplies so I can test all branches of 
my code, but I'm not sure how to do it.  Any suggestions or alternatives 
would be welcome.

Thanks!





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


Re: [Puppet Users] Warning: Local environment: "production" doesn't match server specified node environment

2016-01-27 Thread Alfredo De Luca
Hi Matt.
AFAIK production is the default environment assigned to all the nodes.

try
puppet config print environment



On Thu, Jan 28, 2016 at 3:49 AM, Matt Zagrabelny  wrote:
> Greetings,
>
> I've searched a bit and found some hits for the subject, but nothing that 
> helps.
>
> I'm using an ENC to drive the environment of my nodes.
>
> I don't have "production" defined anywhere in my puppet.conf:
>
> # grep production /etc/puppet/puppet.conf || echo "not there"
> not there
>
> and it is not defined on my command-line run:
>
> puppet agent -t --server puppet-3-7 --debug
>
> but I still get a warning about the local environment:
>
> Warning: Local environment: "production" doesn't match server
> specified node environment "apt", switching agent to "apt".
>
> Where else (besides the /etc/puppet/puppet.conf and the command-line
> option --environment) do I look for the local environment being set?
>
> Thanks!
>
> -m
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Puppet Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to puppet-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/puppet-users/CAOLfK3U3AFz%2BZzTvHXzLmodL8Tcw6QX1PwPvCDRtAN5fw-3SVw%40mail.gmail.com.
> For more options, visit https://groups.google.com/d/optout.



-- 
Alfredo

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


[Puppet Users] Announce: Puppet 3.8.5 available

2016-01-27 Thread Eric Sorenson
Puppet 3.8.5 is now available. This is a bugfix release that contains 
performance improvements to catalog compilation and Mac OS X service 
management, along with fixes for Windows agents and the Puppet 4 language 
parser. See the full release notes here:

http://docs.puppetlabs.com/puppet/3.8/reference/release_notes.html

For installation and upgrade instructions, see this doc:

http://docs.puppetlabs.com/puppet/3.8/reference/pre_install.html

A special community shout-out for this release to Github user 'earsdown' 
for the PR to fix PUP-5212, which added HTTP proxy support to the PIP 
package provider. 

Eric Sorenson - eric.soren...@puppetlabs.com - freenode #puppet: eric0
puppet platform // coffee // techno // bicycles

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


Re: [Puppet Users] Announce: Puppet 3.8.5 available

2016-01-27 Thread Morgan Rhodes
On Wed, Jan 27, 2016 at 2:58 PM Eric Sorenson 
wrote:

> Puppet 3.8.5 is now available. This is a bugfix release that contains
> performance improvements to catalog compilation and Mac OS X service
> management, along with fixes for Windows agents and the Puppet 4 language
> parser. See the full release notes here:
>
> http://docs.puppetlabs.com/puppet/3.8/reference/release_notes.html
>
> For installation and upgrade instructions, see this doc:
>
> http://docs.puppetlabs.com/puppet/3.8/reference/pre_install.html
>
> A special community shout-out for this release to Github user 'earsdown'
> for the PR to fix PUP-5212, which added HTTP proxy support to the PIP
> package provider.
>
> Eric Sorenson - eric.soren...@puppetlabs.com - freenode #puppet: eric0
> puppet platform // coffee // techno // bicycles
>
> --
> You received this message because you are subscribed to the Google Groups
> "Puppet Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to puppet-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/puppet-users/162976e8-f3a4-4af5-a211-a0900f3b4aa5%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

Puppet 3.8.5 for Windows included an updated version of Ruby to address
CVE-2015-7551. More information is available at
https://puppetlabs.com/security/cve/ruby-dec-2015-security-fixes.
-- 
Morgan Rhodes
mor...@puppetlabs.com
Release Engineer

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


Re: [Puppet Users] Announce: puppet-agent 1.3.4 available

2016-01-27 Thread Morgan Rhodes
On Mon, Jan 25, 2016 at 5:55 PM Eric Sorenson 
wrote:

> Puppet Agent 1.3.4 is now available! This is a bugfix release of the
> all-in-one Puppet 4 based installer, which bundles Ruby, Facter, Puppet,
> and other components into a single package for all supported operating
> systems.
>
> Notable changes in this release:
> * Support for Ubuntu 'Wily Werewolf'
> * Puppet 4.3.2 - big batch of bugfixes, for everything from the new
>   "puppet lookup" command to catalog performance profiling to the
>   yumrepo provider. Plus bonus speed boosts for all catalog compilation!
>   See full Puppet release notes for details:
> https://docs.puppetlabs.com/puppet/latest/reference/release_notes.html
> * Facter and Hiera got version bumps to support the new Ubuntu packages;
>   Facter has one functionality fix (FACT-1246) but Hiera does not contain
>   code changes.
>
> See the release notes for the puppet agent package here:
> http://docs.puppetlabs.com/puppet/latest/reference/release_notes_agent.html
>
> To install or upgrade puppet-agent, follow the getting started directions:
> http://docs.puppetlabs.com/puppet/latest/reference/index.html
>
> Eric Sorenson - eric.soren...@puppetlabs.com - freenode #puppet: eric0
> puppet platform // coffee // techno // bicycles
>
> --
> You received this message because you are subscribed to the Google Groups
> "Puppet Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to puppet-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/puppet-users/232a99d4-176e-4052-bfd3-554793a1c05b%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

Puppet Agent 1.3.4 included updates to OpenSSL to address the December
Security Announcement. More information is available at
https://puppetlabs.com/security/cve/openssl-dec-2015-security-fixes.

-- 
Morgan Rhodes
mor...@puppetlabs.com
Release Engineer

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


Re: [Puppet Users] Re: exec without a shell

2016-01-27 Thread 'Stefan Schulte' via Puppet Users


On 27.01.2016 15:28, jcbollinger wrote:
> [...]
> Puppet implements the "posix" provider by passing the command to
> Ruby's Kernel.exec()
> .
> [...]

Thanks for the inside view John. This would explain the current
behaviour. IIRC this behaves quite similar to perl's "system" command
(single argument vs. array). I also just remembered about some old
discussions on redmine but I could only dig up

http://projects.puppetlabs.com/issues/4288#note-16

which all talk about feeding the exec with the "array form" but that
does not work as expected either.

# test.pp
exec { 'Test03':
  command  => [ "/bin/echo", "arg1", "arg2", "arg3" ],
  provider => posix,
}
$ puppet apply test.pp
Error: Parameter command failed on Exec[Test03]: Command must be a
String,
got value of class Array at /home/stefan/test.pp:1

So without the help of the shellescape function (which I strangely never
saw in the wild before) I basically give everyone with access to hiera
data root-rights as a bonus (If I happen to use hiera data to generate
command line arguments).

I guess the sane approach would be to add a feature request to allow
passing an array as a command parameter which in turn would run ruby's
exec with an array as well, bypassing the shell.

-- Stefan

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


Re: [Puppet Users] Re: exec without a shell

2016-01-27 Thread 'Stefan Schulte' via Puppet Users


On 28.01.2016 01:46, 'Stefan Schulte' via Puppet Users wrote:
> [...]
> I guess the sane approach would be to add a feature request to allow
> passing an array as a command parameter which in turn would run ruby's
> exec with an array as well, bypassing the shell.
> [...]
> -- Stefan

just for reference. There already is such a feature request:
https://tickets.puppetlabs.com/browse/PUP-3142

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


Re: [Puppet Users] Re: Puppet x64 msi not installing files

2016-01-27 Thread Gary Greene
Yes, UAC is turned on on this machine. Turning it off is not really an
option, since compromising system security for the ability for us to manage
systems is not an option.

On 19 January 2016 at 01:10, Bjoern Meier  wrote:

> Hi,
>
> do you have UAC active? I get this with active UAC.
>
>
> Am Freitag, 15. Januar 2016 00:12:19 UTC+1 schrieb Gary Greene:
>>
>> I’ve got a user on Windows 10 x64 Pro that we’ve been having some issues
>> with the puppet install on his machine. To fix, I tried upgrading the
>> client from 3.8.3 to 3.8.4 from the Puppet Open Source downloads for
>> Windows x64.
>>
>> When running the install, everything _appears_ to install, and the
>> Windows Installer throws no error, but when I look at his filesystem, the
>> files that I expect to be in C:\Program Files\Puppet Labs\ are not present
>> at all.
>>
>> The logs all state that the MSI install completed without issue, but as I
>> said, the files never show up.
>>
>> Has anyone else seen this? And if so, what’s the workaround for this so I
>> can ensure that the rest of the Windows fleet aren’t going to be an issue
>> upgrading to the latest release?
>>
>> --
>> Gary L. Greene, Jr.
>> ==
>>
>> Volunteer developer of the KDE F/OSS project and Project Lead for
>> AltimatOS
>> http://www.kde.org/ http://www.altimatos.com/
>> Please refrain from sending me proprietary binary documents (Doc, Xls,
>> Ppt)
>>   Use a free office suite with standards approved formats like
>> LibreOffice.
>> http://www.libreoffice.org/
>> ==
>>
>>
>> --
> You received this message because you are subscribed to the Google Groups
> "Puppet Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to puppet-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/puppet-users/50db9bf2-bb55-4df0-a088-ab7072534216%40googlegroups.com
> 
> .
>
> For more options, visit https://groups.google.com/d/optout.
>

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