search for: regsubst

Displaying 20 results from an estimated 23 matches for "regsubst".

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, ''^[^-]*-([^-]...
2010 Apr 23
1
regsubst questions
...ifest 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 = regsubst($boot_time,''^([0-9]+)[:]([0-9]+)\n'',''\1'') notice("w newline - boot_hour => |$boot_hour|") $boot_hour_1 = regsubst($boot_time,''^([0-9]+)[:]([0-9]+)'',''\1'') notice("w/o newline - boot_hour_1 => |$...
2012 Feb 16
2
Basic string manipulation in puppet
Hi all, Been searching the net for a few hours now. I have a basic operation I wish to perform but, cannot find examples close enough to what I''m after to implement it myself. This is what I want to do: $version = ''10.2.0'' I want to manipulate the string to make a new var ($cutversion), equal just 102. For example in perl (since I know it): $version =
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'',
2012 Oct 02
4
Removing intermediate variables in calculation
...$baseurl, $webapp_context_path = ''/'' ) { if ($webapp_context_path != '''') { $int_webapp_context_path = $webapp_context_path notify{"using webapp_context_path \"${webapp_context_path}\"":} } else { $extracted_url_path = regsubst($baseurl, ''^https?://[^/]+(/.*)'', ''\1'') if ($extracted_url_path) { $int_webapp_context_path = $extracted_url_path } else { # in case we were given a $baseurl without the tailing "/" $int_webapp_context_path = '&...
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 =
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 Oct 26
2
Using regex to match hostnames in hiera
...out hiera as an alternative.  It seems like a nice tool, but in my case there is a very big downside - the inability to match the fqdn based on a regular expression.  This was brought up in a previous thread[2]. As an example, here is my existing extlookup configuration from site.pp: $hostgroup = regsubst($hostname, ''-*\d+$'', '''') $extlookup_datadir = "/etc/puppet/environments/${environment}/manifests/extdata" $extlookup_precedence = [ ''hostnames/%{fqdn}'', ''hostgroups/%{hostgroup}'', ''common'' ] This la...
2011 Feb 17
1
Nested defined resources
...y them to figure out what package to install and what virtualenv to install it in. Then I would have Python::Package[/tools/virtualenv-1|mock-0.6.0] Python::Package[/tools/virtualenv-2|mock-0.6.0] In the python::package define, I could split $title into $virtualenv and $pkg easily enough with regsubst(). However, how can I take an array of bare package names and prepend the virtualenv name and "|" to each one? Another thought is that I could use Exec directly, since it is not impeded by duplicate resource names. That would mean replacing the python::package resource instantiation wi...
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
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
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
.../gem/repo'', } ruby::gemInstall is a define, and it has some logic to get around some problems I had when trying to install gems via a package resource, the source is below. define ruby::gemInstall ( gem = $title, path = hiera(''v_rubygem_path'') ) { $gemName = regsubst($gem, ''([^-]+)-.*\.gem'', ''\1'') exec {"/usr/local/bin/gem install ${gem}": cwd => $path, unless => "gem list -i ${gemName}", require => Package[''rubygems'']; } } But when I try to apply this, I g...
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
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 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 Oct 21
1
use regex to ensure multiple directories are absent or exist
Is it possible to use regex to ensure directories are deleted..... I want to be able to do something like: file { ''/var/directory[1-9]'': ensure => absent, } Would also be nice to use regex to ensure directories are present... -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To view this discussion on the web
2009 Oct 29
2
template issue: nested variables?
I need to do something like this node foo { $iface = pcn0 ... } # the template <%= network_<%= iface %> %>/<% netmask_<%= iface %> %> The idea being that a file would be built on the client holding the value of pcn0''s network/netmask Of course, I''m trying to avoid hard coding the interface name in order to keep my code portable. Thanks in advance
2013 Jan 25
2
creating file locations from hiera
Hi list, I ran again against a long standing bug / feature request but from a new angle: creating directories with parents ( http://projects.puppetlabs.com/issues/86). I wanted to create a module, where a path could be supplied with a class parameter. The path would be used in a rsync configuration, so I would like to be sure the path exists. As I want the module to be general and completely
2012 Oct 19
3
Node specific exported resources
Greetings, I''m trying to wrap my head around a solution to a problem I''m facing with an exported resources configuration I have. I''m using the following simple config to build a munin configuration: @@file { "/etc/munin/munin.conf.d/${::fqdn}.node": content => "[All Hosts;${::fqdn}] address ${ipaddress_eth0} use_node_name yes\n\n", tag
2009 Mar 23
7
ANNOUNCE: Puppet 0.24.8 now available!
...eas 0.3.6 and 0.4 and fixes to a number of Augeas issues Provide dscl -url output support for OS X 10.4 clients using the directoryservice provider. Fix launchd service provider so it is backwards compatible with OS X 10.4 Fixed #1831 - Added sprintf function Fixed #1830 - Added regsubst function Fixed #1829 - Add puppet function versioncmp to compare versions Added ext/dbfix.sql script - fixes common errors in stored configuration databases Major fixes: Fixed #1629 - A refactoring of ssh_authorized_key parsed provider Fixed #2004 - ssh_authorized_key fails if...