search for: inline_templ

Displaying 20 results from an estimated 49 matches for "inline_templ".

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}'' >...
2011 Aug 08
12
Hash Interpolation inside double quotes?
I''ve got this: file { ''/opt/sugarsync/tomcat/tomcat-home/current'': ensure => "tomcat-$config[''tomcat_version_server'']"; where $config[''tomcat_version_server''] was set with extlookup (the yaml one), by loading: --- tomcat_config: tomcat_version_server: 6.0.20-1 tomcat_version_libs: 1.0-1
2012 Mar 27
1
Arrays from templates
Hi, I am having an issue trying to use the inline_template function to return an array. This is what I do: $array = inline_template ("<%= a=[''a1'',''b2'',''c3'']; a %>") notify {"array: ${array}":} And that works, showing the typical comma-less string: notice: /Stage[main]//No...
2012 Jul 05
1
hash to_yaml in erb template not giving valid yaml
...facts.yaml file for Mcollective. For some reason it won''t provide a valid yaml format if I dump my scope to hash and convert to_yaml. file { "/etc/mcollective/facts.yaml" : owner => root, group => root, mode => 400, loglevel => debug, #content => inline_template("<%= scope.to_hash.reject { |k,v| !( k.is_a?(String) && v.is_a?(String) ) }.to_yaml %>"), #content => inline_template("<%= { \"a\" => 1, \"b\"=> 2}.to_yaml %>"), content => inline_template("<%= facts = {};...
2011 Jul 02
8
err: Could not retrieve catalog from remote server: Could not intern from pson: Could not convert from pson: Could not find relationship target "File[]"
I''m running Puppet 2.7.1 on the master as well as the agent and just received a new error which doesn''t actually reference a module or a file, so I''m somewhat stuck as to how to debug this. Any pointers? The error is err: Could not retrieve catalog from remote server: Could not intern from pson: Could not convert from pson: Could not find relationship target
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
2011 Jun 16
7
Problem with usage of arrays
Hi there, i can''t use array in puppet. Here is my codesnipplet: $callapidata = [ ''wert1'',''wert2''] notice $callapidata[1] A puppetrun results in: Could not retrieve catalog from remote server: Error 400 on SERVER: can''t convert String into Integer at /etc/puppet/myenv/modules/ uc4client/manifests/init.pp:41 on node testnode Thanks for your
2009 Jun 30
6
Variable named "memory" in templates
I tried to use a Puppet variable named "$memory" and access it from a template, like this: $memory = 4711 file { "/tmp/test.txt": content => inline_template("memory = <%= memory %>\n"); } One would think that my file would contain "memory = 4711" after that, but instead the memory variable seems to hold a somewhat random number each time I run Puppet. On the two machines I have tried it (using the stand-alone puppet...
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
2011 Feb 02
11
How to include the Scope(...) in a generated string?
I''d like to include similar information that notice() spits out in a file I am generating -- basically so that anyone looking at the generated file (actually a file fragment) could trace it back to the class that is generating the entry. Using $name within the file fragment is the closest I am getting to what I want -- is there anything better? -- You received this message because you
2011 May 23
2
Variable interpolation challenge
I''m having a problem with variable interpolation that I haven''t found a good solution to. I want to use a variable as part of the name of a fact, but the interpolation doesn''t work as expected. I''ve allowed for passing the mac address into my define() but if it''s not provided I want to look it up via facter. if
2012 Dec 14
11
Puppet and Mcollective yaml file changing when it shouldn't
...ome replaces some entries with an extra space. It appears to add a couple different entries each run. Here is the file resource -- "/var/tmp/facts.yaml": owner => root, group => root, mode => 400, loglevel => debug, content => inline_template("<%= scope.to_hash.reject { |k,v| k.to_s =~ /(uptime_seconds|uptime_hours|timestamp|free)/ }.to_yaml %>") Any thoughts or suggestions? Seems like an odd one to me. -Z -- You received this message because you are subscribed to the Google Groups "Puppet Users" group...
2010 Dec 14
7
source /etc/profile
Hello , There is a way to source /etc/profile inside puppet on demand? My problem is that I install Java, afterwards I set JAVA_HOME variable in /etc/profile. After Java is installed, a gem which depends on Java starts to install ... but as it needs JAVA_HOME environment to be set, it fails. I am not sure what can I do ... Thank you, Adrian -- You received this message because you are
2012 Oct 29
2
array and string
hi all, I have an array and i would like to convert it into a string format. e.g. $server = ["node1", "node2", "node3"] when I write my puppet codes exec { "myscript -S $server": path => XXXX } my $server becomes a continual string like: "node1node2node3", instead of "node1 node2 node3". How can i have a delimiter of space in
2010 Aug 31
3
File selection for template() similar to source
I want to be able to have Puppet determine which file to use as the source of a template() call in a manner similar to the source parameter. Basically, I want to have a file resource that will use the most appropriate file for a template. While I can do: file { "file.conf" : source => [ "puppet:///module/file.conf.${hostname}",
2013 Nov 18
3
Is it possible to evaluate a string as a parameter name?
Hi, I''m looking to combine a couple of fact names with the value of a class parameter to create and lookup the resulting fact''s value. Is that possible? For example, my class will take the parameter "my_default_nic" from beyond. So I know that as long as $my_default_nic exists on the client, then so will facts like macaddress_<NIC>, netmask_<NIC>,
2010 Dec 26
6
variables created with generate() function have a newline when used in a template
I have this in nodes.pp $puppetmaster_fqdn = generate("/usr/bin/facter","fqdn") and this in a template http://<%= puppetmaster_fqdn %>:8080 When puppet runs, this is the result: http://puppet.home :8080 Anybody any clue to whats causing this? I''ve tried -%> -- You received this message because you are subscribed to the Google Groups "Puppet
2011 Nov 04
2
problem with templates
I am having an issue with templates that I cant quite figure out why it is having an issue. I am using ruby dsl to read a template from a database and it keeps having problems with anything other than <%= var %> type definitions. I even went as far cutting and pasting from the puppet online documentation just to see if it were maybe something I goofed. I pasted below the tested template
2011 Mar 31
5
Exclude a resource from reports
...you set that to something lower than "notice" (i.e. either "info" or "debug"), then Puppet won''t report that it applied the resource... So I made my resource like this: file { "/etc/mcollective/facts.yaml": ensure => file, content => inline_template("<%= scope.to_hash.reject { |k,v| (!( k.is_a?(String) && v.is_a?(String) ) || (k =~ /password/i)) }.to_yaml %>"), noop => false, loglevel => debug, } This results, indeed, in the corresponding events not appearing in the logs received by puppetmaster (in sy...
2009 Dec 24
7
nested variables
Hi all! I have quation: how i may use nested variables/facts? For example, I have variable $iface. It''s variable declared in node brakets, and, use with defenition. iface may be eth0, eth1(Linux), em0, ... <freebsd>, ... is fact: facter | grep eth0 | grep mac macaddress_eth0 => 54:52:00:3D:CB:40 We don''nt know name of $iface in our module (to generate network