Re: [Puppet Users] Issues creating a customer type/provider

2016-07-28 Thread Martin Alfke
Hi Simon,


> On 28 Jul 2016, at 12:53, Simon Weald  wrote:
> 
> Hi guys
> 
> I'm extending our in-house package management system to include management of 
> apt's GPG keys (we're a Debian shop). Ruby isn't my forte, but I've cooked up 
> what I think is a decent working type and provider which I can extend further 
> if the need arises. Currently during a run I'm getting an error 400 stating 
> that one of my parameters isn't valid.
> 
> I've provided the relevant code here: 
> https://gist.github.com/analbeard/8560005282856b9302145934730a77a0
> 
> and the run output I'm receiving is:
> 
> Info: Retrieving pluginfacts
> Info: Retrieving plugin
> Info: Loading facts
> Error: Could not retrieve catalog from remote server: Error 400 on SERVER: 
> Invalid parameter keyid on Apt_key[9023A836357AF18193C2F0F8013F8A39FBC95654] 
> at 
> /etc/puppet/environments/development/modules/pkg_mgmnt/manifests/aptkey.pp:10 
> on node test.test.com
> Warning: Not using cache on failed catalog
> Error: Could not retrieve catalog; skipping run

Your puppet code is making use of the aptkey type.
The type which you created has the name repokey.
Puppet::Type.newtype(:repokey)

You should use the type repokey in you manifest.

> 
> 
> Can anyone shed any light as to why Puppet doesn't like the keyid parameter?
> 
> -- 
> 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/9c700d3e-e9bf-49fd-a7fe-8d77271af9c3%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/21F91C94-3FAE-4E44-B6E6-065277C726F6%40gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Puppet Users] Question Exec resource

2016-07-28 Thread Martin Alfke
Hi Christian,


> On 28 Jul 2016, at 18:47, Christian Charpentier  wrote:
> 
> Thnaks for your answer Martin.
> 
> Here is the beginning of the stack:
> 
>  [0;36mDebug: Executing '/bin/sh -c source /etc/profile && 
> /opt/openam/bin/openam_install.sh install cm > /opt/openam/install.log' [0m
>  [0;36mDebug: /Stage[main]/Openam::Config/Exec[openam_install]/returns: 
> Certificate was added to keystore [0m
>  [0;36mDebug: /Stage[main]/Openam::Config/Exec[openam_install]/returns: 
> Certificate stored in file  [0m
>  [0;36mDebug: /Stage[main]/Openam::Config/Exec[openam_install]/returns: 
> Certificate was added to keystore [0m
>  [0;36mDebug: /Stage[main]/Openam::Config/Exec[openam_install]/returns: 
> java.net.ConnectException: Connection refused [0m
>  [0;36mDebug: /Stage[main]/Openam::Config/Exec[openam_install]/returns:   
>   at java.net.PlainSocketImpl.socketConnect(Native Method) [0m

This looks like a connection error from within the java process.
This is unrelated to Puppet.
Does the command work when running it from a root shell?
If this is the case: check for further environments setting which might be 
needed by the installer and use the environment parameter of the exec resource 
type.

Best,
Martin

> 
> 
> Could it be an SSL connection issue instead of a path issue with the java 
> -jar command?
> 
> About the idenpotency, by using the creates attribute normally ensure the 
> exec command will be executed only if the file/directory doesn't exist. So i 
> should not have any problem with that.
> 
> 
> -- 
> 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/cf796f0d-7ddb-4ff5-bbfb-5ce67aeae565%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/C8F54464-11A7-4C69-98B5-C1740EE58B66%40gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Puppet Users] Question Exec resource

2016-07-28 Thread Christian Charpentier
Thnaks for your answer Martin.

Here is the beginning of the stack:

 [0;36mDebug: Executing '/bin/sh -c source /etc/profile && 
/opt/openam/bin/openam_install.sh install cm > /opt/openam/install.log' [0m

 [0;36mDebug: /Stage[main]/Openam::Config/Exec[openam_install]/returns: 
Certificate was added to keystore [0m
 [0;36mDebug: /Stage[main]/Openam::Config/Exec[openam_install]/returns: 
Certificate stored in file  [0m
 [0;36mDebug: /Stage[main]/Openam::Config/Exec[openam_install]/returns: 
Certificate was added to keystore [0m
 [0;36mDebug: /Stage[main]/Openam::Config/Exec[openam_install]/returns: 
java.net.ConnectException: Connection refused [0m
 [0;36mDebug: /Stage[main]/Openam::Config/Exec[openam_install]/returns: 
at java.net.PlainSocketImpl.socketConnect(Native Method) [0m



Could it be an SSL connection issue instead of a path issue with the java 
-jar command?

About the idenpotency, by using the creates attribute normally ensure the 
exec command will be executed only if the file/directory doesn't exist. So 
i should not have any problem with that.

-- 
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/cf796f0d-7ddb-4ff5-bbfb-5ce67aeae565%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[Puppet Users] Issues creating a customer type/provider

2016-07-28 Thread Simon Weald
Hi guys

I'm extending our in-house package management system to include management 
of apt's GPG keys (we're a Debian shop). Ruby isn't my forte, but I've 
cooked up what I think is a decent working type and provider which I can 
extend further if the need arises. Currently during a run I'm getting an 
error 400 stating that one of my parameters isn't valid.

I've provided the relevant code here: 
https://gist.github.com/analbeard/8560005282856b9302145934730a77a0

and the run output I'm receiving is:

Info: Retrieving pluginfacts 
Info: Retrieving plugin 
Info: Loading facts 
Error: Could not retrieve catalog from remote server: Error 400 on SERVER: 
Invalid parameter keyid on 
Apt_key[9023A836357AF18193C2F0F8013F8A39FBC95654] at 
/etc/puppet/environments/development/modules/pkg_mgmnt/manifests/aptkey.pp:10 
on node test.test.com 
Warning: Not using cache on failed catalog 
Error: Could not retrieve catalog; skipping run


Can anyone shed any light as to why Puppet doesn't like the keyid parameter?

-- 
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/9c700d3e-e9bf-49fd-a7fe-8d77271af9c3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Puppet Users] Question Exec resource

2016-07-28 Thread Martin Alfke
An exec resource will always start with an empty environment.
I assume that it can not find the java binary.
You can try specifying the
path => ‘…'
attribute.
And: log_output => true

Besides this:
please take care on being idempotent (only run in case that it is required) and 
on error handling (how to proceed/revert in case of error).

Best,
Martin

> On 27 Jul 2016, at 18:43, Christian Charpentier  wrote:
> 
> Hi,
> 
> I'm trying to install openam with puppet. To do this i'm using an exec 
> resource:
> 
> exec { 'openam_install':
>   command  => "source /etc/profile && /opt/openam/bin/openam_install.sh 
> install ${::env} > /opt/openam/install.log",
>   provider => shell,
>   creates  => '/var/lib/tomcat/webapps/sso',
> }
> 
> The script openam_install.sh exit with an error code:
> 
> Debug: /Stage[main]/Openam::Config/Exec[openam_install]/returns:ERROR: 
> command execution failed at line 247 !
> 
> Error: source /etc/profile && /opt/openam/bin/openam_install.sh install cm 
> returned 1 instead of one of [0]
> 
> Error: /Stage[main]/Openam::Config/Exec[openam_install]/returns: change from 
> notrun to 0 failed: source /etc/profile && /opt/openam/bin/openam_install.sh 
> install cm returned 1 instead of one of [0]
> 
> 
> 
> Line 247 i have this:
> 
> 
> 
> 
>   java -jar 
> /opt/openam/configurator/openam-configurator-tool-${openAMversion}.jar -f 
> /opt/openam/configurator/openam.conf
> 
>   echo "Restarting OpenAM"
>   service tomcat restart
> 
> 
> The java -jar command fail but i can't figure out why because if i try to 
> launch this command directly in a shell it works.
> 
> 
> 
> Any help would be appreciated.
> 
> 
> 
> Thanks.
> 
> 
> 
> Chris
> 
> 
> 
> -- 
> 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/c0c81a61-b7cc-46e8-b9cf-63020f7598fd%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/044C43BE-53B1-4E7C-83D5-40286269A785%40gmail.com.
For more options, visit https://groups.google.com/d/optout.