Best unofficial Apache Server developers community
Username
Forgot password?
Sign in with Twitter account
Sign in with Facebook account
List archives

Looping in Ruby DSL

Newbie: Confused about where to start managing users...
(75 lines)
define hostclass with special characters
(24 lines)
Feb 8, 2012
Sateesh
Sateesh
Hi,

I have written a sample manifest in puppet using Ruby DSL. I want to
build a looping functionality. But I am getting problem as shown
below:

ro### @puppet-swproxy:/tmp# cat test.rb
hostclass :test do
$abc = ["a","b"]
$abc.each do |sip|
  create_resource :exec, "echoabc", :command => "echo #{sip}"
end

file "/tmp/testecho.txt", :content => "This is test file", :require
=>
Exec['echoabc']
end

node "default" do
include "test"
end
roo### @puppet-swproxy:/tmp# puppet apply --verbose test.rb
Duplicate definition: Exec[echoabc] is already defined on node puppet-
swproxy.persistent.co.in

I can make the echoabc as dynamic, but how can specify that in require
in next statement (file). I need to execute the file only after
executing the exec. So what I need to do. Generall the puppet will not
run in the synchronized way. I observed that the statements are
executed asynchronously.

Also, I need to define the Exec path at the top as I specified in the
pp file.

  Exec {
    path => ["/bin", "/sbin", "/usr/bin", "/usr/sbin"],
  }

How to write this in Ruby DSL. So that I can eliminate the path
attribute in all exec statements.

Thanks in advance,
Sateesh B.





Reply
Tags: cat testpuppetsiprubyfunctionalityabcdsl
Messages in this thread
Looping in Ruby DSL
reply Re: Looping in Ruby DSL
(127 lines) Feb 8, 2012 10:50
reply Re: Looping in Ruby DSL
(176 lines) Feb 8, 2012 22:47
reply Re: Re: Looping in Ruby DSL
(235 lines) Feb 8, 2012 22:51
reply Re: Re: Looping in Ruby DSL
(54 lines) Feb 9, 2012 02:40
reply Re: Looping in Ruby DSL
(92 lines) Feb 10, 2012 03:38
FileInstall Looping
March 20, 2011 08:22:43 AM
Good morning, I've written an app which downloads bundles to a watched folder on Android. Up until yesterday, it worked great. I did something yesterday which I can't quite figure out, which has resulted in the FileInstall looping. That is, it…
looping for a data set?
July 13, 2011 08:05:25 PM
My test case is as follows: For a single iteration I want to execute multiple operations of the same kind. The data for these operations come from a data file. The number of times I want to repeat this operation is a variable. The way I modeled…
Looping select
November 29, 2011 04:42:59 PM
This one is weird. And I don't know exactly what I have the ability to provide you for information. Below is the C# code I use to execute a query. And below that is what is ultimately translated and executed. The c# application appears to get…
Looping Test Plan
November 8, 2010 07:48:03 AM
Good Day, Is there a way of looping my Jmeter test plan where the next iterations of the test plan will load only when all the threads of the previous test plan have finished? Thanks -Caloy
ssh_authorized_key in 2.7.10 keeps looping when options are set
January 27, 2012 09:27:50 AM
Hi all, I just upgraded a client with puppet 2.7.9 to 2.7.10 and now the authorized_keys started to loop notice: /Stage[main]/Authorizedkey::UserX/ Authorizedkey::Manage[userx_dss_domainx_test]/ Ssh_authorized_key[userx_dss_domainx_test]/options:…
CFEngine Help: Slists and looping
December 2, 2011 12:32:20 PM
Forum: CFEngine Help Subject: Slists and looping Author: random Link to topic: https://cfengine.com/forum/read.php?3,24160,24160#msg-24160 I'm messing around with some simple looping over slists and ran into a problem with the code below. It…
mailbox_transport and mail start looping
January 7, 2011 07:02:16 AM
Hi, We have an issue with integrating a spam filter into postfix. When a mail enters the mail system a loop start between postfix and dspam. And I don't know why the loop start because when the mail returns to postfix (localhost:10026) we…
RE: how to exclude a basedir while looping using foreach
February 1, 2011 01:40:36 AM
i tried everything else earlier but not "*" what does "*" actually stand for?
Looping in MR and multiple input phases
November 12, 2011 03:47:39 PM
I figure the following is not currently possible in Riak, so I'd like to propose them as potential features. We are processing millions of documents with Riak and we need to very quickly find that ones we want. One problem we've had is that some…
helper define for looping through array
January 5, 2012 06:52:34 AM
Hello, I have a define in which I need to loop through an array. That worked well, until I needed to loop through a second instance of an array in another call to that define that just so happens to have the same data in it. Now I get the…
how to exclude a basedir while looping using foreach
January 31, 2011 06:16:15 PM
<target name="run"> <foreach target="zip" param="folder-to-zip"> <path> <dirset dir="${basedir}" excludes="**/js,**/assets,**/assets/images,**/assets/swf,**/pdf,**/ass ets/music,**/assets/pdf"/> </path> …
Cfengine Help: Double-looping inserting cf_null
November 26, 2010 04:46:14 PM
Forum: Cfengine Help Subject: Double-looping inserting cf_null Author: zzamboni Link to topic: https://cfengine.com/forum/read.php?3,19440,19440#msg-19440 Hi, I'm experimenting with double-implicit-looping, and I'm seeing the following strange…
Ant For Loop: Looping over Ranges with Step and Over PropertySets
December 8, 2011 05:46:54 PM
Hi all, In the recent past, I've asked about implementing a "for" loop in Ant. I've wanted something that could iterate over number ranges or propertysets. And, I wanted something that didn't depend on Ant-Contrib 1.0b3. And, I wanted to be…
Looping a Thread Group with a Module Controller
October 12, 2011 12:40:03 AM
Hi, when I run a *Thread Group containing a Module Controller* (that links to a Simple Controller in a disabled Thread Group), then everything works. But as soon as I change the *Loop Count* of this Thread Group to 2 or more (or Forever), the…
How to do implicit looping over an slist defined in a common bundle?
May 27, 2011 06:42:54 PM
What's wrong with this picture? I am trying to loop over the contents of @(myusers) I want to create home directories and add entries to /etc/sudoers However, I am unable to access the slist for an implicit loop:
Commented: (DROIDS-51) review MultiThreadedTaskMaster thread creation/looping
December 24, 2010 12:19:30 AM
[ https://issues.apache.org/jira/browse/DROIDS-51?page=com.atlassian.jir a.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=1 2974848#action_12974848 ] Otis Gospodnetic commented on DROIDS-51:
Closed: (DROIDS-51) review MultiThreadedTaskMaster thread creation/looping
December 26, 2010 09:47:32 AM
[ https://issues.apache.org/jira/browse/DROIDS-51?page=com.atlassian.jir a.plugin.system.issuetabpanels:all-tabpanel ] Thorsten Scherler closed DROIDS-51.
Created] (MAPREDUCE-3745) mapred/yarn scripts should use lib/'*' instead looping the dir for jar to
January 27, 2012 04:34:36 PM
mapred/yarn scripts should use lib/'*' instead looping the dir for jar to create the classpath
Updated: (AVRO-564) Ruby tests should not leave lang/ruby/data.avr file hanging around
June 5, 2010 09:35:53 PM
[ https://issues.apache.org/jira/browse/AVRO-564?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Jeff Hammerbacher updated AVRO-564:
Created: (AVRO-564) Ruby tests should not leave lang/ruby/data.avr file hanging around
June 5, 2010 09:35:53 PM
Ruby tests should not leave lang/ruby/data.avr file hanging around
Looping mysql_real_connect or what
May 31, 2011
hi, consider following c code: int main (int argc, char *argv[]) { MYSQL *sql_handle; fprintf(stdout,"initializing handle..\n"); sql_handle =…
Need help with repeating/looping in PHP
May 22, 2011
I have this block of PHP and HTML: <table width="57%" border="0" class="tabela_master" id="aps-cat"> <tr> <?php while ($row =…
Looping through '{en:}hello{nl:}hoi' with preg_match
March 7, 2011
I'm working on a translation function that should work like this: _('{en:}hello{nl:}hoi') But I'm having trouble with writing a correct regular…
Grouping in subgroup(looping with php)
March 1, 2011
Hi everyone,,, I once read a question about "how to group result in subgroups in php"(in this forum). I had a problem that is almost the same as the…
Looping through multiple arrays
May 19, 2011
i'm really confused about something and need some advice. i want to be able to loop through 2 arrays at the same time but i can't seem to figure it…
.htaccess looping infinitely
January 1, 2011
Hi! I have strange problem with .htaccess I can't solve: <IfModule mod_rewrite.c> RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f…
Looping through a drop down, how to select value?
February 9, 2011
When displaying a form on a page for a user to edit information, and the form consists of a drop down box, how do you loop through the selections in…
A simple looping question...
December 28, 2010
CREATE DEFINER = `dba`@`xx.xx.xx.3` PROCEDURE `oninjadb`.`TESTLOOPER`() LANGUAGE SQL DETERMINISTIC NO SQL SQL SECURITY DEFINER COMMENT '' BEGIN…
Toplevel looping infinitely.
May 25, 2011
Request exceeded the limit of 10 internal redirects due to probable configuration error. Use 'LimitInternalRecursion' to increase the limit if…
Looping through Regex Matches.
April 23, 2011
Hello. This is my source string: <box><3> <table><1> <chair><8> This is my Regex Patern:…
Postfix remote mx 0.0.0.0 looping
December 17, 2010
Does anyone know how to make postfix avoid getting into an endless loop of errors when a remote mx server resolves to 0.0.0.0 ? The problem sounds…
Looping through mysql database.
May 25, 2011
I have series of mysql databases on my server. The names of these databases are stored in a separate database table (users) - column(dbname) . I…
Force SSL on one page via .htaccess without looping
June 23, 2011
Okay, I have this code: RewriteCond %{HTTPS} off RewriteCond %{REQUEST_URI} ^/borrowing/ill/request\.php$ RewriteRule ^.*$…
Prevent int looping round in mysql?
March 24, 2011
Hello, I have a column, labelled int(11) not null unsigned. It has a value, say 10. When I run a query which -11 from this, it loops around to…
How do I stop looping a regex expression
June 20, 2011
I am trying to extract information from a table on a web page with source information like team.php?t=4636&s=98700">Memphis</a> CUSA…
Show All Folders From FTP - PHP Keeps Looping :: Error ::
January 17, 2011
I am trying to get a list of dir from a ftp using php the following code is outputting the following information. httpdocs/user_images…
Looping through arrays mySQL insert
February 20, 2011
I need to loop through these arrays and put the values in their respective table which the table name would be medal+key i.e medal117 Here is the…
Looping through an array and querying data
April 25, 2011
Basically what I'm trying to achieve is go through an array and do a query based on that data - e.g. array of names bob, bill, ben and query a…
Looping through multiple attributes in rails
May 2, 2011
I am using has_many: skills in my user model and I'm wondering, after a user has selected many skills in dynamically generated form fileds, how do I…
Mysql where IN on large dataset or Looping?
January 25, 2011
Hi, I have the following scenario: Table 1: articles id article_text category author_id 1 "hello world" 4 1 2 "hi" 5 2 3 "wasup" 4 3 Table 2 authors…