Re: [Puppet Users] Custom functions what way forward

2022-03-24 Thread Martin Alfke
Hi Baz, There are two APIs for custom types/providers within modern Puppet. The “old” API uses the Puppet::Type.newtype syntax. I gave a talk on this topic a couple of years ago: https://www.slideshare.net/PuppetLabs/puppetconf-2016-moving-from-exec-to-types-and-providers-martin-alfke-example42-g

[Puppet Users] Custom functions what way forward

2022-03-24 Thread barry haycock
I am migrating a Puppet 3.x to Puppet 7.x and am having to rewrite alot of the code. This includes a number of custom modules and my first foray into writing custom functions/providers. This is where I am getting stuck as there is not really a lot of information on this. Looking at existing Pup

Re: [Puppet Users] Custom Functions and hash as parameter

2013-12-01 Thread Felix Frank
Hi, I don't fully understand how the problems you mention are connected, but the observed "caching" behavior may be due to https://projects.puppetlabs.com/issues/17210. HTH, Felix On 12/01/2013 04:44 PM, Israel Calvete wrote: > Somehow, the code was being cached in my pool of puppet masters. >

Re: [Puppet Users] Custom Functions and hash as parameter

2013-12-01 Thread Israel Calvete
On Wednesday, November 27, 2013 11:13:52 PM UTC+1, Henrik Lindberg wrote: > > On 2013-27-11 17:33, Israel Calvete wrote: > > Hi all, > > > > I try write a custom function > > > > My code: > > > > / $gluster = {/ > > /'10.241.5.6' => '/data/gv0/brick1',/ > > /'10.241.5.7' => '/da

Re: [Puppet Users] Custom Functions and hash as parameter

2013-11-27 Thread Henrik Lindberg
On 2013-27-11 17:33, Israel Calvete wrote: Hi all, I try write a custom function My code: / $gluster = {/ /'10.241.5.6' => '/data/gv0/brick1',/ /'10.241.5.7' => '/data/gv0/brick1',/ / }/ / / / $a = glusterFunctions($gluster)/ / / / notify{$a:}/ My simple custom function: /requir

[Puppet Users] Custom Functions and hash as parameter

2013-11-27 Thread Israel Calvete
Hi all, I try write a custom function My code: * $gluster = {* *'10.241.5.6' => '/data/gv0/brick1',* *'10.241.5.7' => '/data/gv0/brick1',* * }* * $a = glusterFunctions($gluster)* * notify{$a:}* My simple custom function: *require 'rubygems'* *module Puppet::Parser::Functions*

Re: [Puppet Users] custom functions

2012-04-18 Thread Chris Donovan
OK, so now that I understand where the functions run, I'll write a type / provider. The reason I need to get something custom run on the client is to learn how puppet works at that level. Then once I'm happy with the level of knowledge I will get with customizing puppet, I'll be able to figure out

Re: [Puppet Users] custom functions

2012-04-18 Thread Gary Larizza
On Wednesday, April 18, 2012, Chris Donovan wrote: > Hi, > > Yes, filename is what is supposed to be there. That's not my issue > however though, my issue is that it doesn't load / run properly. > > If puppet 2.7.6 still does not run functions on the client then that's > great, and I'll write a p

Re: [Puppet Users] custom functions

2012-04-18 Thread Chris Donovan
Hi, Yes, filename is what is supposed to be there. That's not my issue however though, my issue is that it doesn't load / run properly. If puppet 2.7.6 still does not run functions on the client then that's great, and I'll write a provider, and possibly a type. Chris- On Thu, Apr 19, 2012 at

Re: [Puppet Users] custom functions

2012-04-18 Thread Gary Larizza
At first glance (on phone), Check this line: 1. file = File.open(file, 'r+') Don't you want filename as the argument? n Wednesday, April 18, 2012, Chris Donovan wrote: > Hello, > > So I'm working my way through writing custom functions for puppet 2.7.6, > and what I think is valid seem

[Puppet Users] custom functions

2012-04-18 Thread Chris Donovan
Hello, So I'm working my way through writing custom functions for puppet 2.7.6, and what I think is valid seems not to be, and unfortunately I can't find any additional help in the docs. I've got a pastebin link (http://pastebin.com/HimPyWHh) that shows my function, site.pp, and the file I'm

Re: [Puppet Users] Custom Functions that runs on the Client?

2010-12-14 Thread Felix Frank
On 12/13/2010 07:59 PM, Yushu Yao wrote: > Thanks Eric, > > I am trying to implement some function tests. E.g. in my catalog for > node B there is LDAP client, however, I would like to do a test to see > if the LDAP server is already up and running. And decide if I want to > apply the LDAP Client

Re: [Puppet Users] Custom Functions that runs on the Client?

2010-12-14 Thread Martijn Grendelman
Hi, > On Mon, Dec 13, 2010 at 12:56 PM, Yushu Yao > wrote: > > Another though: > > Can I do something like > if $(return value of an Exec resource)==0 { > } else {} > > I.e. I want to run an shell command first, and do something depend on > the outp

Re: [Puppet Users] Custom Functions that runs on the Client?

2010-12-13 Thread Nigel Kersten
On Mon, Dec 13, 2010 at 12:56 PM, Yushu Yao wrote: > Another though: > > Can I do something like > if $(return value of an Exec resource)==0 { > } else {} > > I.e. I want to run an shell command first, and do something depend on the > output of the command. > You probably want to make the shell

Re: [Puppet Users] Custom Functions that runs on the Client?

2010-12-13 Thread Yushu Yao
Another though: Can I do something like if $(return value of an Exec resource)==0 { } else {} I.e. I want to run an shell command first, and do something depend on the output of the command? Thanks -Yushu +-+ | Yushu Yao | Ph:1-510-486-4690 | | L

Re: [Puppet Users] Custom Functions that runs on the Client?

2010-12-13 Thread Yushu Yao
Thanks, Another question, when are the facts loaded? In the beginning of the puppetd run? -Yushu +-+ | Yushu Yao | Ph:1-510-486-4690 | | Lawrence Berkeley National Lab | Mailstop 50B-6222 | 1 Cyclotron Road | Berkeley CA 94720-8147 - USA +-

Re: [Puppet Users] Custom Functions that runs on the Client?

2010-12-13 Thread Eric Sorenson
On Dec 13, 2010, at 10:59 AM, Yushu Yao wrote: > I am trying to implement some function tests. E.g. in my catalog for node B > there is LDAP client, however, I would like to do a test to see if the LDAP > server is already up and running. And decide if I want to apply the LDAP > Client or not.

Re: [Puppet Users] Custom Functions that runs on the Client?

2010-12-13 Thread Yushu Yao
Thanks Eric, I am trying to implement some function tests. E.g. in my catalog for node B there is LDAP client, however, I would like to do a test to see if the LDAP server is already up and running. And decide if I want to apply the LDAP Client or not. (This is a test on remote resource, I might a

Re: [Puppet Users] Custom Functions that runs on the Client?

2010-12-13 Thread Eric Sorenson
Functions are executed when parsing a manifest, which a client doesn't do -- a client applies a catalog. So it doesn't make sense to run a manifest parser on a client. What is the problem you are trying to solve? On Dec 13, 2010, at 10:37 AM, Yushu Yao wrote: > Hi Experts, > > As far as I can

[Puppet Users] Custom Functions that runs on the Client?

2010-12-13 Thread Yushu Yao
Hi Experts, As far as I can see custom functions run on the server, right? Is there way to make them run on the Client? Thanks -Yushu -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-us...@googlegrou

Re: [Puppet Users] custom functions in standalone mode

2010-12-13 Thread Felix Frank
On 12/13/2010 03:39 PM, Gergely Paljak wrote: > Hi, > > On 7 December 2010 15:43, Felix Frank > wrote: > > On 11/29/2010 02:23 PM, Gergely Paljak wrote: > > Hi, > > > > I am fairly new to puppet, and my question would be: > > > > -

Re: [Puppet Users] custom functions in standalone mode

2010-12-13 Thread Gergely Paljak
Hi, On 7 December 2010 15:43, Felix Frank wrote: > On 11/29/2010 02:23 PM, Gergely Paljak wrote: > > Hi, > > > > I am fairly new to puppet, and my question would be: > > > > - is it possible to write new function and use them in standalone mode? > > According to > > > http://projects.puppetlabs.c

Re: [Puppet Users] custom functions in standalone mode

2010-12-07 Thread Felix Frank
On 11/29/2010 02:23 PM, Gergely Paljak wrote: > Hi, > > I am fairly new to puppet, and my question would be: > > - is it possible to write new function and use them in standalone mode? > According to > http://projects.puppetlabs.com/projects/1/wiki/Writing_Your_Own_Functions > functions > can on

[Puppet Users] custom functions in standalone mode

2010-11-29 Thread Gergely Paljak
Hi, I am fairly new to puppet, and my question would be: - is it possible to write new function and use them in standalone mode? According to http://projects.puppetlabs.com/projects/1/wiki/Writing_Your_Own_Functionsfunctions can only be executed on a server, is there any possibility to overcome t

Re: [Puppet Users] custom functions from a module in a different environment

2010-08-18 Thread Dan Bode
This feature is not supported until 2.6 (and I have seen some issues with 2.6 http://projects.puppetlabs.com/issues/4409) . I would recommend either: 1. trying your use case with 2.6 2. keep a single copy of your plugins in the puppetmaster's modulepath. hope this helps, Dan On Wed, Aug 18, 2

[Puppet Users] custom functions from a module in a different environment

2010-08-18 Thread Darren Worrall
Hey folks, I have just created a puppet environment called testing by adding the following to puppet.conf on the puppetmaster: [testing] manifest = /etc/puppet/testing/manifests/site.pp modulepath = /etc/puppet/testing/modules We are collecting all our customisations into a module, let

[Puppet Users] Custom functions and ruby help

2008-12-09 Thread Jeff
Greetings, puppeteers. As per yesterday's discussion on if a file exists on the pupper master, I decided to write a custom function. I'm prolific in a lot of languages unfortunately, ruby isn't one of them. Here's my function: module Puppet::Parser::Functions newfunction(:file_exists) do |args