Displaying 20 results from an estimated 39 matches for "newfunct".
Did you mean:
newfunc
2012 Apr 05
3
newly added ruby function executes on the server instead of the node
Hi,
1) I added this test function tom my
/etc/puppet/modules/write_line_to_file/lib/puppet/parser/functions/write_line_to_file.rb
:
*module Puppet::Parser::Functions newfunction(:write_line_to_file) do |args|
filename = args[0]
str = args[1]
File.open(args[0], ''a'') {|fd| fd.puts str }
end
end*
2) I invoked it in the
/etc/puppet/modules/write_line_to_file/manifest/init.pp like this:
*class write_line_to_file{
write_line_to_file('...
2008 Aug 14
1
multiple functions in one file?
...that "The file name is derived from the name of the function that Puppet
is trying to run."
Is this still true?
I ask because I currently write a set of math functions (min,max, plus,
minus and so). My first try was to create a math.rb, where I had:
module Puppet::Parser::Functions
newfunction(:min, :type => :rvalue) do |args|
....
end
newfunction(:max, :type => :rvalue) do |args|
....
end
....and so on...
end
This of course did not work, so I split the whole thing up in multiple:
min.rb, max.rb, .... files.
This works now quite well. Nevertheless it would be somewhat...
2009 Jan 02
2
problem with custom funcion
Hello!
I''ve written custom function split - it''s located in modules/common/
plugins/puppet/parser/functions/split.rb and contains:
module Puppet::Parser::Functions
newfunction(:split, :type => :rvalue) do |args|
str=args[0]
regex=args[1]
idx=args[2]
out=str.split(/#{regex}/)
if out.is_a? Array
out[idx]
else
""
end
end
end
Now, each time I''m trying to do somewhere in manifests:
include "com...
2007 Jun 06
2
lookup in CSV recipe
...# key1, value2, value3,...
# key2, value4, value5
#
# lookup_csv(filename,key1,colname3) will then return value3
#
# TODO:
# proper CSV parsing (e.g. quoting)
# regexp on the value?
# return a supplied default if row not found?
# add Excel and Openoffice support
module Puppet::Parser::Functions
newfunction(:lookup_csv, :type => :rvalue) do |args|
filename = args[0]
key = args[1]
column = args[2]
File.open(filename) do |file|
# find which column we are after
colnum = file.gets.chomp.split(/,/).index(column)
return nil if colnum == nil
# find row
fil...
2012 Feb 22
4
Custom function issue
Hi,
I needed a function to check if a file is existing on the Debian box I
am configuring. So I used this one
module Puppet::Parser::Functions
newfunction(:file_exists, :type => :rvalue) do |args|
if File.exists?(args[0])
return 1
else
return 0
end
end
end
It work greats for some service where apache2 doesn''t work for me.
I am using it this way "file_exists(''/etc/init.d/apache2'') == 1&q...
2008 Oct 03
7
form_remote_tag and :with
I am trying to pass the result from a javascript function along with
the result from a text_field with form_remote_tag. This is what I
have so far, but no go:
<% form_remote_tag(:url => {:controller => ''requests'', :action =>
''create''}, :with => "''data=''+request()", :update => ''request_sent'' )
2009 Jul 28
1
Wishlist: Navigate to "Index" page of help when no topic specified (PR#13860)
..."poor man's game" to get to the standard
help system "Index" page for the package:
Poor Man's Game -=20
Load new package;=20
issue search() command;
find position (say N) of loaded package;=20
issue objects(pos =3D N) command;
get name of a random function (san newFunction);=20
issue ?newFunction command;
scroll to bottom of page;=20
click on the "Index" hyperlink
There are other variations, but they all involve this=20
long march to the Index page.
What I'd like to be able to do is enter the command
> help(package =3D "survival&quo...
2011 Jun 14
4
Question about custom function.
Hello group,
I''m trying to generate configuration for tomcat server. I want it to
depend on my mod_jk properties file. I wrote some simple script which
you can see here: http://pastebin.com/CffBr0Nc it works just fine.
So I tried to move it to puppet as my custom function. It''s available
for review here: http://pastebin.com/AeQgTTT6
Now, when I''m running first in irb,
2013 Aug 20
1
[LLVMdev] Question about removeFromParent
I have Function
Function* F;
and one of its basic blocks BB
I want to insert this BB into a new function without remove it from the
original
according that BList is the list of the basic blocks of the newFunction
BList.insert(BB);
but I don't want to call BB->removeFromParent(); and without this method it
give me error that BB is already in a container
is there another function that get copy without deleting?
Thank you in advance
--
* Rasha Salah Omar
Msc Student at E-JUST
Demo...
2009 Aug 05
2
Wishlist: Navigate to "Index" page of help when no topic (PR#13872)
...; Steve McKinney
>
>
>>> Poor Man's Game -=20
>>> Load new package;=20
>>> issue search() command;
>>> find position (say N) of loaded package;=20
>>> issue objects(pos =3D N) command;
>>> get name of a random function (san newFunction);=20
>>> issue ?newFunction command;
>>> scroll to bottom of page;=20
>>> click on the "Index" hyperlink
>>>
>>> There are other variations, but they all involve this=20
>>> long march to the Index page.
>>>
>>&...
2013 Mar 07
1
HELP:Custom function didn't work
hi,guys-
I have a mysql database which stores host informations,so I wrote a
function to get some values.
- Here is the function rb(this function should return the type I defined
in the database):
#hosttype.rb
require "mysql"
module Puppet::Parser::Functions
newfunction(:hosttype, :type => :rvalue, :doc => "Gets host type from
db.") do |args|
dbh = Mysql.real_connect("mysql_server_ip", "username", "password",
"puppet")
res = dbh.query("SELECT host_type FROM host_extra_info where
n...
2009 Feb 01
2
Using arrays to generate parameters
My external node classifier returns some arrays in the list of
parameters. Example output (names have been changed to protect the
innocent):
$ ./node_classifier a.b.com
--- %YAML:1.0
"classes": ["class1", "class2", "class3"]
"parameters":
"hostname": "a"
"name": "a"
"domain":
2008 May 02
4
Functions vs. Module Plugins vs. Facts
...th Puppet" is on its way, however I''m
afraid that by the time it gets here it will be out of date. :(
Anyway, I''m running Puppet 0.24.4 on Debian Etch on both client & server and
here is my first try at a puppet function:
# keyname.rb
module Puppet::Parser::Functions
newfunction(:keyname, :type => :rvalue) do |args|
args.split(''-'').pop.downcase
end
end
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Puppet Users" group.
To post to this group, send email...
2013 Feb 03
3
Another "function does not return a value" problem
Here''s the function:
module Puppet::Parser::Functions
newfunction(:fact_to_array, :type => :rvalue) do |args|
args[0].split('','')
end
end
Here''s the class I''m trying to use it in:
class oms::all_config {
file { ''/var/lib/oms/config'':
source => ''puppet:///deployment/deployment'...
2009 Aug 04
0
Wishlist: Navigate to "Index" page of help when no topic (PR#13868)
...would guess R 2.10.x or 2.11.x will do that
automatically.
Duncan Murdoch
> Poor Man's Game -=20
> Load new package;=20
> issue search() command;
> find position (say N) of loaded package;=20
> issue objects(pos =3D N) command;
> get name of a random function (san newFunction);=20
> issue ?newFunction command;
> scroll to bottom of page;=20
> click on the "Index" hyperlink
>
> There are other variations, but they all involve this=20
> long march to the Index page.
>
>
> What I'd like to be able to do is enter the comm...
2011 Oct 17
2
puppet dashboard and complex data
So I am messing around with puppet dashboard and for the most part for
what I am working on it fits the bill for an ENC. The only question I
have is I need to pass information about a customer to set up
resources and the system can have multiple customers on it. What is
the best way to handle complex data? Would I be able to pass json data
for example?
--
You received this message because you
2013 Oct 21
3
how to pass the value to custom function?
Dear all,
I''m trying this thing for a while but can''t figure out what am I doing
wrong.
Here is my sample function (which is similar to the original one, except
for the hash, which is generated dynamically in the original one):
module Puppet::Parser::Functions
> newfunction(:am_running_oss, :type => :rvalue ) do |args|
>
> oss = {:linux=>["Slackware", "RedHat", "Caldera"],
> :mac=>["Jaguar", "Lion", "Tiger", "Kodiak"],
> :win=>["C...
2009 Nov 25
1
Puppet custom functions and user permissions
...uppetmasterd is not respecting the entries in /etc/group in linux. No
matter how many other groups the puppet user has been added to in /etc/
group, when puppetmasterd runs the custom function the effective/real
user always only has the puppet group.
An example:
module Puppet::Parser::Functions
newfunction(:ossec_client_key, :type => :rvalue) do |args|
# Check if key for the fqdn already exists
fqdn = lookupvar(''fqdn'')
ip = lookupvar(''ipaddress'')
fout = File.open("/home/puppet/ossec_client_key.log", ''w'')
fout.puts "osse...
2009 Aug 04
0
Wishlist: Navigate to "Index" page of help when no topic (PR#13871)
...group?
Best
Steve McKinney
>=20
> > Poor Man's Game -=3D20
> > Load new package;=3D20
> > issue search() command;
> > find position (say N) of loaded package;=3D20
> > issue objects(pos =3D3D N) command;
> > get name of a random function (san newFunction);=3D20
> > issue ?newFunction command;
> > scroll to bottom of page;=3D20
> > click on the "Index" hyperlink
> >
> > There are other variations, but they all involve this=3D20
> > long march to the Index page.
> >
> >
> > What...
2011 May 19
2
custom function from .24.6 not working in 2.6 (from squeeze)
...rieve catalog from remote server: Error 400 on SERVER:
private method `gsub'' called for #<Array:0x7fdcebf3bbf8> at
/etc/puppet/manifests/classes/apache-php.pp:72"
Here is the function:
"""
# Checks if a file exists on the puppet maser
Puppet::Parser::Functions::newfunction(:bbcom_file_exists, :type => :rvalue,
:doc => "Checks if the given file exists on the puppet master.") do
|vals|
ret = false
vals.each do |file|
# First convert our $puppet.... urls to local filesystems urls
# We do this to allow the call...