Displaying 20 results from an estimated 5000 matches similar to: "Basic string manipulation in puppet"
2012 Oct 26
2
Using regex to match hostnames in hiera
Hi, I''m having a problem with extlookup not respecting the ''certname'' parameter[1]. When executing a puppet run with either the --certname or --fqdn parameters, it ends up using the specified SSL certificate and gets the correct node definition applied from the puppetmaster. However, it still retrieves extlookup data using the node''s actual FQDN, not the one
2013 Jun 10
5
Does stdlib break the regsubst function?
Hi all,
We are currently using the regsubst function of Puppet to generate some
information out of our hostnames (customer, environment, and so.). The
manifest is running fine since months.
7: $customer = regsubst($::fqdn, ''(^[^-]*)-[^-]*.*'', "\\1")
8: $environment = regsubst($::fqdn, ''^[^-]*-([^-]*).*'', "\\1")
9: $product =
2010 Oct 14
8
manipulating facter variable
I''m trying to manipulate the following facter variable:
ipaddress => 10.85.207.2
What I need is the second group of digits. If it''s 84 then location is
A, but if it''s 85 then location is B.
In puppet I couldn''t grab this second set of digits, but maybe there
is a way?
I''ve already tried to make a custom fact, but my ruby knowledge is
*ahem* pretty
2012 Aug 27
5
Append string to list items.
I have an array:
$nodes = [''gfs01'' ,''gfs02'', ''gfs03'', ''gfs04]
and a string variable:
$brick_store = "/var/bricks"
How can I append "/var/bricks" to each item in the array? Lack of a
looping construct makes this challenging in puppet.
Such that:
brick_array = [''gfs01:/var/bricks'',
2011 Aug 25
5
custom fact regex problem
Hi guys
I have a custom fact envt, it was working fine but now I have to make
some changes in it;
puppet client''s hostname is of the type 1234qa-abc-de.local where 1234
can be any thing of any length.My custom fact should contain qa, ie I
want to check in the first part(before the first -) of the hostname
if there exists a pattern/word qa and if it exists then my custom
fact
for envt
2012 Feb 29
3
Modifying a FACT Value In a Manifest
In my network every subnets default gateway is X.X.X.1. That router
gateway is always running ntpd which I want to give be default as the ntp
server in every hosts ntp.conf.
Since there is no official "default gateway" fact yet, what I want to be
able to do in my manifest is take the $ipaddress fact and turn it into the
gateway for that subnet.
For example...
IP = 10.1.1.12
GW =
2012 Jun 27
6
Error 400 on SERVER: Puppet::Parser::AST::Resource failed with error ArgumentError: Invalid resource type ruby::gemInstall at myFile.pp:82
I have a module located at /etc/puppet/environments/test/modules/ruby.
I
n this I have a manifests folder with two .pp files - init.pp and
gemInstall.pp.
In one of my node def files I have:
include ruby
ruby::gemInstall { ''someGem-version.gem'':
path => ''/path/to/agent/local/gem/repo'',
}
ruby::gemInstall is a define, and it has some logic to get around
2011 Feb 13
3
String manipulation
Please consider following string:
MyString <- "ABCFR34564IJVEOJC3434"
Here you see that, there are 4 groups in above string. 1st and 3rd groups
are for english letters and 2nd and 4th for numeric. Given a string, how can
I separate out those 4 groups?
Thanks for your time
[[alternative HTML version deleted]]
2012 Jul 25
3
manifest variable with sed - problem
Hello,
i have a problem in my sudo manifest file, because in the variable $name
comes sometimes usernames like user.lastname, but i need for sudo
(includedir */etc/sudoers.d/*) file names with no dots (like user_lastname).
I need a new variable, where is the dots change by underscores.
My first try was like this, but it isn''t working well.
$name_underscore = "`echo $name | sed
2010 Apr 23
1
regsubst questions
I am attempting to set some variables in my manifest and I amd seeing
a result I don''t quite understand. Here is a section of code from my
manifest:
$boot_time = generate(''/usr/bin/env'', ''/bin/date'', ''+%H:%m'')
notice("boot_time => $boot_time")
$boot_hour =
2012 Oct 02
4
Removing intermediate variables in calculation
Hello,
I have a small Puppet 2.7 module to configure Sonatype Nexus Professional.
The module takes, among other things, a baseurl in the form of
"http://example.com/path" and I''d like it to extract the "/path" from that
variable into a separate variable IF an optional "path" variable haven''t
been supplied.
Here is an extract:
class
2011 Jun 26
2
String manipulation
Dear all, I have following kind of character vector:
Vec <- c("344426", "dwjjsgcj", "123sgdc", "aagha123", "sdh343asgh", "123jhd51")
Now I want to split each element of this vector according to?numeric?and string element. For example in the 1st element of that vector, there is no string element. Therefore I should get a vector of
2012 Mar 07
3
GPS handling libraries or (String manipulation)
Dear all,
I would like to ask you if R has a library that can work with different GPS formats
For example
I have a string of this format
N50° 47.513 E006° 03.985
and I would like to convert to GPS decimal format.
that means for example converting the part N50° 47.513
to 50 + 47/60 + 513/3600.
Is it possible to do that with R?
What is the name of such a library?
I would like to thank you in
2013 Sep 19
4
Array being flattened
Hello All,
I''ve run into an issue where an array that''s being passed into a
defined type is being "flattened" when it''s inclosed in double quotes
and I''m not sure how to get around this. This is happening a the
pdxcat/amanda module and I''ve raised an github issues for this but
wanted to query the community as a whole. The issue and my branch
2011 Feb 17
1
Nested defined resources
I''m working on a module to handle creating and populating Python
virtualenvs. Without going into too much detail, basically these are
nicely-encapsulated environments into which python packages can be
installed and run. It''s not uncommon to have several virtualenvs on a
system, potentially with the same packages installed (maybe different
versions).
Puppet''s defines
2012 Jun 25
3
Base directory with File
Hi all,
I''d like to specify a base_directory and a list of directories (as
variables that may be pulled via hiera later) that will be created under
that base directory.
base_dir = "/home/base"
bars = ["a", "b", "c"]
bars will be used to create the folders under base and also part of the
information going into building a template so I
2013 Oct 28
1
inline_template private method `gets' called for false:FalseClass
Hi,
I am new to Ruby ERB and inline_template. Can anyone spot what''s wrong
with this inline_template?
$moddedContent = inline_template("<%= puts gets(nil).gsub(/one
two three/,\"\") /tmp/blah %>")
exec {
"/bin/echo ''${moddedContent}'' > /tmp/blah" :
}
When I try to apply it, I
2012 Dec 07
2
Is there any ways to fetching custom fact after some resources setuped?
I''m currently trying to create icinga module and the icinga-web and
icinga-idoutils-libdbi-mysql from rpmforge
store the initial sql file in version numbered
directory(/usr/share/doc/icinga-web-1.7.2/~~~).
So, I try to determine the version number from the yum info like as below,
but that repository installed after my yum module gets work done.
Is there any ways to fetching custom
2013 Jun 16
2
extract all numbers from a string
Hi all,
I have been beating my head against this problem for a bit,
but I can't figure it out.
I have a series of strings of variable length, and each will
have one or more numbers, of varying format. E.g., I might
have:
tmpstr = "The first number is: 32. Another one is: 32.1.
Here's a number in scientific format, 0.3523e10, and
another, 0.3523e-10, and a negative,
2011 Dec 15
6
Puppet with Ruby1.9 issue
Hi,
I have a running puppetmaster with nginx and passenger and ruby 1.9.2.
When i do puppet cert --trace --list . i get the following error.
/usr/lib64/ruby/gems/1.9.1/gems/puppet-2.7.9/lib/puppet/application/
cert.rb:43:in `block (2 levels) in <class:Cert>''
/usr/lib64/ruby/gems/1.9.1/gems/puppet-2.7.9/lib/puppet/application.rb:
357:in `block (2 levels) in parse_options''