<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>cmdln.org (a sysadmin blog)</title>
	<atom:link href="http://www.cmdln.org/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.cmdln.org</link>
	<description>a system administrators mutterings</description>
	<lastBuildDate>Wed, 01 May 2013 17:11:13 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5.1</generator>
		<item>
		<title>I am so excited! And I just cant hide it!</title>
		<link>http://www.cmdln.org/2013/05/01/i-am-so-excited-and-i-just-cant-hide-it/</link>
		<comments>http://www.cmdln.org/2013/05/01/i-am-so-excited-and-i-just-cant-hide-it/#comments</comments>
		<pubDate>Wed, 01 May 2013 17:10:20 +0000</pubDate>
		<dc:creator>Nick Anderson</dc:creator>
				<category><![CDATA[Posts]]></category>
		<category><![CDATA[CFEngine]]></category>

		<guid isPermaLink="false">http://www.cmdln.org/?p=1172</guid>
		<description><![CDATA[Today I start a new journey with some of the smartest people on the planet. I have accepted a position with CFEngine. Primarily I will be assisting customers with the evaluation, design, implementation and policy writing. If you know me from the CFEngine community, don’t worry I only plan to increase my activity and continue [...]]]></description>
				<content:encoded><![CDATA[<p>Today <a href="http://www.cmdln.org/wp-content/uploads/2013/05/NIKON_D5000_20120908T114952_02.jpg"><img class="alignright  wp-image-1181" alt="NIKON_D5000_20120908T114952_02" src="http://www.cmdln.org/wp-content/uploads/2013/05/NIKON_D5000_20120908T114952_02.jpg" width="294" height="442" /></a>I start a new journey with some of the smartest people on the planet. I have accepted a position with <a href="https://cfengine.com/" target="_blank">CFEngine</a>. Primarily I will be assisting customers with the evaluation, design, implementation and policy writing. If you know me from the CFEngine community, don’t worry I only plan to increase my activity and continue to help in any way I can. Now one of my favourite hobbies is my job!</p>
<p>I am very excited to be joining such a great team and very honoured to have this opportunity.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.cmdln.org/2013/05/01/i-am-so-excited-and-i-just-cant-hide-it/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Canonifying a list with CFEngine 3</title>
		<link>http://www.cmdln.org/2013/03/29/canonifying-a-list-with-cfengine-3/</link>
		<comments>http://www.cmdln.org/2013/03/29/canonifying-a-list-with-cfengine-3/#comments</comments>
		<pubDate>Fri, 29 Mar 2013 14:12:14 +0000</pubDate>
		<dc:creator>Nick Anderson</dc:creator>
				<category><![CDATA[Posts]]></category>
		<category><![CDATA[canonify]]></category>
		<category><![CDATA[CFEngine]]></category>
		<category><![CDATA[list]]></category>
		<category><![CDATA[pattern]]></category>

		<guid isPermaLink="false">http://www.cmdln.org/?p=1156</guid>
		<description><![CDATA[John Sanders shared a pattern for canonifying lists in #CFEngine on irc.freenode.net yesterday. It’s a useful reference so I thought I would replicate it here.   In lines 9–12 of the example policy we build an array with values that need to be canonified. We use getindices to get the list of the first index. [...]]]></description>
				<content:encoded><![CDATA[<p>John Sanders <a href="http://www.cmdln.org/wp-content/uploads/2013/03/Glass_pour_section_on_restaurant_wine_list.jpg"><img class="alignright  wp-image-1159" alt="Glass_pour_section_on_restaurant_wine_list" src="http://www.cmdln.org/wp-content/uploads/2013/03/Glass_pour_section_on_restaurant_wine_list-300x225.jpg" width="162" height="122" /></a>shared a pattern for canonifying lists in #CFEngine on irc.freenode.net yesterday. It’s a useful reference so I thought I would replicate it here.</p>
<div class="gistem"><div id="gist5271023" class="gist">
      <div class="gist-file">
        <div class="gist-data gist-syntax">



  <div class="file-data">
    <table cellpadding="0" cellspacing="0" class="lines highlight">
      <tr>
        <td class="line-numbers">
          <span class="line-number" id="file-output-L1" rel="file-output-L1">1</span>
          <span class="line-number" id="file-output-L2" rel="file-output-L2">2</span>
          <span class="line-number" id="file-output-L3" rel="file-output-L3">3</span>
          <span class="line-number" id="file-output-L4" rel="file-output-L4">4</span>
          <span class="line-number" id="file-output-L5" rel="file-output-L5">5</span>
          <span class="line-number" id="file-output-L6" rel="file-output-L6">6</span>
        </td>
        <td class="line-data">
          <pre class="line-pre"><div class="line" id="file-output-LC1">% cf-agent -KIf ./example_canonify_list.cf</div><div class="line" id="file-output-LC2">R: canonified site: www_example_com</div><div class="line" id="file-output-LC3">R: canonified site: www_example2_com</div><div class="line" id="file-output-LC4">R: alternate canonified site: www_example_com</div><div class="line" id="file-output-LC5">R: alternate canonified site: www_example2_com</div><div class="line" id="file-output-LC6"> !! Method invoked repairs</div></pre>
        </td>
      </tr>
    </table>
  </div>

        </div>

        <div class="gist-meta">
          <a href="https://gist.github.com/nickanderson/5271023/raw/d57a43831308cf31f0a5fe237b3d3436ed3d3049/Output" style="float:right">view raw</a>
          <a href="https://gist.github.com/nickanderson/5271023#file-output" style="float:right; margin-right:10px; color:#666;">Output</a>
          <a href="https://gist.github.com/nickanderson/5271023">This Gist</a> is brought to you using <a href="http://en.bainternet.info/2011/simple-gist-embed"><small>Simple Gist Embed</small></a>.
        </div>
      </div>
      <div class="gist-file">
        <div class="gist-data gist-syntax">



  <div class="file-data">
    <table cellpadding="0" cellspacing="0" class="lines highlight">
      <tr>
        <td class="line-numbers">
          <span class="line-number" id="file-example_canonify_list-cf-L1" rel="file-example_canonify_list-cf-L1">1</span>
          <span class="line-number" id="file-example_canonify_list-cf-L2" rel="file-example_canonify_list-cf-L2">2</span>
          <span class="line-number" id="file-example_canonify_list-cf-L3" rel="file-example_canonify_list-cf-L3">3</span>
          <span class="line-number" id="file-example_canonify_list-cf-L4" rel="file-example_canonify_list-cf-L4">4</span>
          <span class="line-number" id="file-example_canonify_list-cf-L5" rel="file-example_canonify_list-cf-L5">5</span>
          <span class="line-number" id="file-example_canonify_list-cf-L6" rel="file-example_canonify_list-cf-L6">6</span>
          <span class="line-number" id="file-example_canonify_list-cf-L7" rel="file-example_canonify_list-cf-L7">7</span>
          <span class="line-number" id="file-example_canonify_list-cf-L8" rel="file-example_canonify_list-cf-L8">8</span>
          <span class="line-number" id="file-example_canonify_list-cf-L9" rel="file-example_canonify_list-cf-L9">9</span>
          <span class="line-number" id="file-example_canonify_list-cf-L10" rel="file-example_canonify_list-cf-L10">10</span>
          <span class="line-number" id="file-example_canonify_list-cf-L11" rel="file-example_canonify_list-cf-L11">11</span>
          <span class="line-number" id="file-example_canonify_list-cf-L12" rel="file-example_canonify_list-cf-L12">12</span>
          <span class="line-number" id="file-example_canonify_list-cf-L13" rel="file-example_canonify_list-cf-L13">13</span>
          <span class="line-number" id="file-example_canonify_list-cf-L14" rel="file-example_canonify_list-cf-L14">14</span>
          <span class="line-number" id="file-example_canonify_list-cf-L15" rel="file-example_canonify_list-cf-L15">15</span>
          <span class="line-number" id="file-example_canonify_list-cf-L16" rel="file-example_canonify_list-cf-L16">16</span>
          <span class="line-number" id="file-example_canonify_list-cf-L17" rel="file-example_canonify_list-cf-L17">17</span>
          <span class="line-number" id="file-example_canonify_list-cf-L18" rel="file-example_canonify_list-cf-L18">18</span>
          <span class="line-number" id="file-example_canonify_list-cf-L19" rel="file-example_canonify_list-cf-L19">19</span>
          <span class="line-number" id="file-example_canonify_list-cf-L20" rel="file-example_canonify_list-cf-L20">20</span>
          <span class="line-number" id="file-example_canonify_list-cf-L21" rel="file-example_canonify_list-cf-L21">21</span>
          <span class="line-number" id="file-example_canonify_list-cf-L22" rel="file-example_canonify_list-cf-L22">22</span>
          <span class="line-number" id="file-example_canonify_list-cf-L23" rel="file-example_canonify_list-cf-L23">23</span>
          <span class="line-number" id="file-example_canonify_list-cf-L24" rel="file-example_canonify_list-cf-L24">24</span>
          <span class="line-number" id="file-example_canonify_list-cf-L25" rel="file-example_canonify_list-cf-L25">25</span>
          <span class="line-number" id="file-example_canonify_list-cf-L26" rel="file-example_canonify_list-cf-L26">26</span>
          <span class="line-number" id="file-example_canonify_list-cf-L27" rel="file-example_canonify_list-cf-L27">27</span>
          <span class="line-number" id="file-example_canonify_list-cf-L28" rel="file-example_canonify_list-cf-L28">28</span>
          <span class="line-number" id="file-example_canonify_list-cf-L29" rel="file-example_canonify_list-cf-L29">29</span>
          <span class="line-number" id="file-example_canonify_list-cf-L30" rel="file-example_canonify_list-cf-L30">30</span>
          <span class="line-number" id="file-example_canonify_list-cf-L31" rel="file-example_canonify_list-cf-L31">31</span>
          <span class="line-number" id="file-example_canonify_list-cf-L32" rel="file-example_canonify_list-cf-L32">32</span>
          <span class="line-number" id="file-example_canonify_list-cf-L33" rel="file-example_canonify_list-cf-L33">33</span>
          <span class="line-number" id="file-example_canonify_list-cf-L34" rel="file-example_canonify_list-cf-L34">34</span>
          <span class="line-number" id="file-example_canonify_list-cf-L35" rel="file-example_canonify_list-cf-L35">35</span>
          <span class="line-number" id="file-example_canonify_list-cf-L36" rel="file-example_canonify_list-cf-L36">36</span>
          <span class="line-number" id="file-example_canonify_list-cf-L37" rel="file-example_canonify_list-cf-L37">37</span>
          <span class="line-number" id="file-example_canonify_list-cf-L38" rel="file-example_canonify_list-cf-L38">38</span>
          <span class="line-number" id="file-example_canonify_list-cf-L39" rel="file-example_canonify_list-cf-L39">39</span>
        </td>
        <td class="line-data">
          <pre class="line-pre"><div class="line" id="file-example_canonify_list-cf-LC1">body common control</div><div class="line" id="file-example_canonify_list-cf-LC2">{</div><div class="line" id="file-example_canonify_list-cf-LC3">  bundlesequence =&gt; { &quot;main&quot; };</div><div class="line" id="file-example_canonify_list-cf-LC4">  inputs =&gt; { &quot;cfengine_stdlib.cf&quot;, };</div><div class="line" id="file-example_canonify_list-cf-LC5">}</div><div class="line" id="file-example_canonify_list-cf-LC6">&nbsp;</div><div class="line" id="file-example_canonify_list-cf-LC7">bundle agent main</div><div class="line" id="file-example_canonify_list-cf-LC8">{</div><div class="line" id="file-example_canonify_list-cf-LC9">  vars:</div><div class="line" id="file-example_canonify_list-cf-LC10">      &quot;apache_config[www.example.com][DocumentRoot]&quot; string =&gt; &quot;/var/www/www.example.com&quot;;</div><div class="line" id="file-example_canonify_list-cf-LC11">      &quot;apache_config[www.example.com][ServerAdmin]&quot; string =&gt; &quot;webmaster@example2.com&quot;;</div><div class="line" id="file-example_canonify_list-cf-LC12">      &quot;apache_config[www.example2.com][DocumentRoot]&quot; string =&gt; &quot;/var/www/www.example2.com&quot;;</div><div class="line" id="file-example_canonify_list-cf-LC13">      &quot;apache_config[www.example2.com][ServerAdmin]&quot; string =&gt; &quot;webmaster@example3.com&quot;;</div><div class="line" id="file-example_canonify_list-cf-LC14">&nbsp;</div><div class="line" id="file-example_canonify_list-cf-LC15">  methods:</div><div class="line" id="file-example_canonify_list-cf-LC16">      &quot;Testing&quot; usebundle =&gt; test(&quot;main.apache_config&quot;);</div><div class="line" id="file-example_canonify_list-cf-LC17">      </div><div class="line" id="file-example_canonify_list-cf-LC18">}</div><div class="line" id="file-example_canonify_list-cf-LC19">&nbsp;</div><div class="line" id="file-example_canonify_list-cf-LC20">bundle agent test(config)</div><div class="line" id="file-example_canonify_list-cf-LC21">{</div><div class="line" id="file-example_canonify_list-cf-LC22">  vars:</div><div class="line" id="file-example_canonify_list-cf-LC23">      # build a list from the first index on the config array</div><div class="line" id="file-example_canonify_list-cf-LC24">      &quot;site_names&quot; slist =&gt; getindices(&quot;$(config)&quot;);</div><div class="line" id="file-example_canonify_list-cf-LC25">      # Build a new array mapping the original index to a canonified version of itself</div><div class="line" id="file-example_canonify_list-cf-LC26">      &quot;site_names_canonified_map[$(site_names)]&quot; string =&gt; canonify(&quot;$(site_names)&quot;);</div><div class="line" id="file-example_canonify_list-cf-LC27">      # Build a list of just the canonified versions</div><div class="line" id="file-example_canonify_list-cf-LC28">      &quot;site_names_canonified_list&quot; slist =&gt; maplist(&quot;$(site_names_canonified_map[$(this)])&quot;, &quot;site_names&quot;);</div><div class="line" id="file-example_canonify_list-cf-LC29">&nbsp;</div><div class="line" id="file-example_canonify_list-cf-LC30">      # alternate way to build list of canonified values</div><div class="line" id="file-example_canonify_list-cf-LC31">      # due to a bug in the way getindices/getvalues works this needs to happen on the pass after the map array is generated</div><div class="line" id="file-example_canonify_list-cf-LC32">      &quot;site_names_canonified_list2&quot; slist =&gt; getvalues(&quot;site_names_canonified_map&quot;), policy =&gt; &quot;free&quot;;</div><div class="line" id="file-example_canonify_list-cf-LC33">&nbsp;</div><div class="line" id="file-example_canonify_list-cf-LC34">  reports:</div><div class="line" id="file-example_canonify_list-cf-LC35">    cfengine::</div><div class="line" id="file-example_canonify_list-cf-LC36">      &quot;canonified site: $(site_names_canonified_list)&quot;;</div><div class="line" id="file-example_canonify_list-cf-LC37">      &quot;alternate canonified site: $(site_names_canonified_list2)&quot;;</div><div class="line" id="file-example_canonify_list-cf-LC38">&nbsp;</div><div class="line" id="file-example_canonify_list-cf-LC39">}</div></pre>
        </td>
      </tr>
    </table>
  </div>

        </div>

        <div class="gist-meta">
          <a href="https://gist.github.com/nickanderson/5271023/raw/b86b207ec0c8b89513a5882ce08330a97dedd513/example_canonify_list.cf" style="float:right">view raw</a>
          <a href="https://gist.github.com/nickanderson/5271023#file-example_canonify_list-cf" style="float:right; margin-right:10px; color:#666;">example_canonify_list.cf</a>
          <a href="https://gist.github.com/nickanderson/5271023">This Gist</a> is brought to you using <a href="http://en.bainternet.info/2011/simple-gist-embed"><small>Simple Gist Embed</small></a>.
        </div>
      </div>
</div>
</div><style type="text/css">@import "http://gist.github.com/stylesheets/gist/embed.css"; .gistem .highlight {background: inherit; !important;}</style>
<p> </p>
<p>In lines 9–12 of the example policy we build an array with values that need to be canonified. We use getindices to get the list of the first index. You could just as easily start with a list of values that need canonified. John used the maplist function to construct a new array with the original index values and their canonified versions. Another way to do this is to use getvalues. Currently (as of CFEngine 3.4.4) getindices and getvalues are not able to get the index of a generated array on the same pass, so its something to be aware of if your using that approach. However Johns approach using maplist is able to work on the same pass because it does not rely on getting the index of the newly generated map array.</p>
<p> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.cmdln.org/2013/03/29/canonifying-a-list-with-cfengine-3/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Working around getindices with dynamically generated arrays in CFEngine 3</title>
		<link>http://www.cmdln.org/2013/03/13/working-around-getindices-with-dynamically-generated-arrays-in-cfengine-3/</link>
		<comments>http://www.cmdln.org/2013/03/13/working-around-getindices-with-dynamically-generated-arrays-in-cfengine-3/#comments</comments>
		<pubDate>Wed, 13 Mar 2013 17:44:58 +0000</pubDate>
		<dc:creator>Nick Anderson</dc:creator>
				<category><![CDATA[Posts]]></category>
		<category><![CDATA[CFEngine]]></category>
		<category><![CDATA[tips]]></category>

		<guid isPermaLink="false">http://www.cmdln.org/?p=1144</guid>
		<description><![CDATA[There is a known bug where getindices is unable to get the index of a dynamically generated array until the next pass. This comes up from time to time so I thought I would post an example using a pattern shared on the CFEngine help mailing list. The policy below shows 3 working examples. They [...]]]></description>
				<content:encoded><![CDATA[<p>There is a <a href="https://cfengine.com/dev/issues/2088" target="_blank">known bug</a> where <a href="https://cfengine.com/manuals/cf3-Reference#Function-getindices" target="_blank">getindices</a> is unable to get the index <img class="alignright size-medium wp-image-1150" alt="Workaround" src="http://www.cmdln.org/wp-content/uploads/2013/03/work-around-300x223.jpg" width="300" height="223" />of a dynamically generated array until the next pass. This comes up from time to time so I thought I would post an example using a pattern shared on the <a href="http://groups.google.com/group/help-cfengine?hl=en" target="_blank">CFEngine help mailing list</a>. The policy below shows 3 working examples. They are mostly similar, example0 shows the simplest workaround, example1 and example2 in addition show ways to suppress the “Duplicate selection of value for variable” messages.</p>
<div class="gistem"><div id="gist5154392" class="gist">
      <div class="gist-file">
        <div class="gist-data gist-syntax">



  <div class="file-data">
    <table cellpadding="0" cellspacing="0" class="lines highlight">
      <tr>
        <td class="line-numbers">
          <span class="line-number" id="file-output-txt-L1" rel="file-output-txt-L1">1</span>
          <span class="line-number" id="file-output-txt-L2" rel="file-output-txt-L2">2</span>
          <span class="line-number" id="file-output-txt-L3" rel="file-output-txt-L3">3</span>
          <span class="line-number" id="file-output-txt-L4" rel="file-output-txt-L4">4</span>
          <span class="line-number" id="file-output-txt-L5" rel="file-output-txt-L5">5</span>
          <span class="line-number" id="file-output-txt-L6" rel="file-output-txt-L6">6</span>
          <span class="line-number" id="file-output-txt-L7" rel="file-output-txt-L7">7</span>
          <span class="line-number" id="file-output-txt-L8" rel="file-output-txt-L8">8</span>
          <span class="line-number" id="file-output-txt-L9" rel="file-output-txt-L9">9</span>
          <span class="line-number" id="file-output-txt-L10" rel="file-output-txt-L10">10</span>
          <span class="line-number" id="file-output-txt-L11" rel="file-output-txt-L11">11</span>
          <span class="line-number" id="file-output-txt-L12" rel="file-output-txt-L12">12</span>
          <span class="line-number" id="file-output-txt-L13" rel="file-output-txt-L13">13</span>
          <span class="line-number" id="file-output-txt-L14" rel="file-output-txt-L14">14</span>
        </td>
        <td class="line-data">
          <pre class="line-pre"><div class="line" id="file-output-txt-LC1">cf-agent -KIf ./test_getindices_dynamic_array.cf</div><div class="line" id="file-output-txt-LC2"> !! Duplicate selection of value for variable &quot;idx&quot; in scope example0</div><div class="line" id="file-output-txt-LC3"> !! Rule from ./test_getindices_dynamic_array.cf at/before line 28</div><div class="line" id="file-output-txt-LC4"> !! Duplicate selection of value for variable &quot;idx&quot; in scope example0</div><div class="line" id="file-output-txt-LC5"> !! Rule from ./test_getindices_dynamic_array.cf at/before line 28</div><div class="line" id="file-output-txt-LC6">R: example0 item1</div><div class="line" id="file-output-txt-LC7">R: example0 item2</div><div class="line" id="file-output-txt-LC8">R: example0 item3</div><div class="line" id="file-output-txt-LC9">R: example1 item1</div><div class="line" id="file-output-txt-LC10">R: example1 item2</div><div class="line" id="file-output-txt-LC11">R: example1 item3</div><div class="line" id="file-output-txt-LC12">R: example2 item1</div><div class="line" id="file-output-txt-LC13">R: example2 item2</div><div class="line" id="file-output-txt-LC14">R: example2 item3</div></pre>
        </td>
      </tr>
    </table>
  </div>

        </div>

        <div class="gist-meta">
          <a href="https://gist.github.com/nickanderson/5154392/raw/0173ced1600e7bb221dafb5661ff516f14e6929b/output.txt" style="float:right">view raw</a>
          <a href="https://gist.github.com/nickanderson/5154392#file-output-txt" style="float:right; margin-right:10px; color:#666;">output.txt</a>
          <a href="https://gist.github.com/nickanderson/5154392">This Gist</a> is brought to you using <a href="http://en.bainternet.info/2011/simple-gist-embed"><small>Simple Gist Embed</small></a>.
        </div>
      </div>
      <div class="gist-file">
        <div class="gist-data gist-syntax">



  <div class="file-data">
    <table cellpadding="0" cellspacing="0" class="lines highlight">
      <tr>
        <td class="line-numbers">
          <span class="line-number" id="file-test_getindices_dynamic_array-cf-L1" rel="file-test_getindices_dynamic_array-cf-L1">1</span>
          <span class="line-number" id="file-test_getindices_dynamic_array-cf-L2" rel="file-test_getindices_dynamic_array-cf-L2">2</span>
          <span class="line-number" id="file-test_getindices_dynamic_array-cf-L3" rel="file-test_getindices_dynamic_array-cf-L3">3</span>
          <span class="line-number" id="file-test_getindices_dynamic_array-cf-L4" rel="file-test_getindices_dynamic_array-cf-L4">4</span>
          <span class="line-number" id="file-test_getindices_dynamic_array-cf-L5" rel="file-test_getindices_dynamic_array-cf-L5">5</span>
          <span class="line-number" id="file-test_getindices_dynamic_array-cf-L6" rel="file-test_getindices_dynamic_array-cf-L6">6</span>
          <span class="line-number" id="file-test_getindices_dynamic_array-cf-L7" rel="file-test_getindices_dynamic_array-cf-L7">7</span>
          <span class="line-number" id="file-test_getindices_dynamic_array-cf-L8" rel="file-test_getindices_dynamic_array-cf-L8">8</span>
          <span class="line-number" id="file-test_getindices_dynamic_array-cf-L9" rel="file-test_getindices_dynamic_array-cf-L9">9</span>
          <span class="line-number" id="file-test_getindices_dynamic_array-cf-L10" rel="file-test_getindices_dynamic_array-cf-L10">10</span>
          <span class="line-number" id="file-test_getindices_dynamic_array-cf-L11" rel="file-test_getindices_dynamic_array-cf-L11">11</span>
          <span class="line-number" id="file-test_getindices_dynamic_array-cf-L12" rel="file-test_getindices_dynamic_array-cf-L12">12</span>
          <span class="line-number" id="file-test_getindices_dynamic_array-cf-L13" rel="file-test_getindices_dynamic_array-cf-L13">13</span>
          <span class="line-number" id="file-test_getindices_dynamic_array-cf-L14" rel="file-test_getindices_dynamic_array-cf-L14">14</span>
          <span class="line-number" id="file-test_getindices_dynamic_array-cf-L15" rel="file-test_getindices_dynamic_array-cf-L15">15</span>
          <span class="line-number" id="file-test_getindices_dynamic_array-cf-L16" rel="file-test_getindices_dynamic_array-cf-L16">16</span>
          <span class="line-number" id="file-test_getindices_dynamic_array-cf-L17" rel="file-test_getindices_dynamic_array-cf-L17">17</span>
          <span class="line-number" id="file-test_getindices_dynamic_array-cf-L18" rel="file-test_getindices_dynamic_array-cf-L18">18</span>
          <span class="line-number" id="file-test_getindices_dynamic_array-cf-L19" rel="file-test_getindices_dynamic_array-cf-L19">19</span>
          <span class="line-number" id="file-test_getindices_dynamic_array-cf-L20" rel="file-test_getindices_dynamic_array-cf-L20">20</span>
          <span class="line-number" id="file-test_getindices_dynamic_array-cf-L21" rel="file-test_getindices_dynamic_array-cf-L21">21</span>
          <span class="line-number" id="file-test_getindices_dynamic_array-cf-L22" rel="file-test_getindices_dynamic_array-cf-L22">22</span>
          <span class="line-number" id="file-test_getindices_dynamic_array-cf-L23" rel="file-test_getindices_dynamic_array-cf-L23">23</span>
          <span class="line-number" id="file-test_getindices_dynamic_array-cf-L24" rel="file-test_getindices_dynamic_array-cf-L24">24</span>
          <span class="line-number" id="file-test_getindices_dynamic_array-cf-L25" rel="file-test_getindices_dynamic_array-cf-L25">25</span>
          <span class="line-number" id="file-test_getindices_dynamic_array-cf-L26" rel="file-test_getindices_dynamic_array-cf-L26">26</span>
          <span class="line-number" id="file-test_getindices_dynamic_array-cf-L27" rel="file-test_getindices_dynamic_array-cf-L27">27</span>
          <span class="line-number" id="file-test_getindices_dynamic_array-cf-L28" rel="file-test_getindices_dynamic_array-cf-L28">28</span>
          <span class="line-number" id="file-test_getindices_dynamic_array-cf-L29" rel="file-test_getindices_dynamic_array-cf-L29">29</span>
          <span class="line-number" id="file-test_getindices_dynamic_array-cf-L30" rel="file-test_getindices_dynamic_array-cf-L30">30</span>
          <span class="line-number" id="file-test_getindices_dynamic_array-cf-L31" rel="file-test_getindices_dynamic_array-cf-L31">31</span>
          <span class="line-number" id="file-test_getindices_dynamic_array-cf-L32" rel="file-test_getindices_dynamic_array-cf-L32">32</span>
          <span class="line-number" id="file-test_getindices_dynamic_array-cf-L33" rel="file-test_getindices_dynamic_array-cf-L33">33</span>
          <span class="line-number" id="file-test_getindices_dynamic_array-cf-L34" rel="file-test_getindices_dynamic_array-cf-L34">34</span>
          <span class="line-number" id="file-test_getindices_dynamic_array-cf-L35" rel="file-test_getindices_dynamic_array-cf-L35">35</span>
          <span class="line-number" id="file-test_getindices_dynamic_array-cf-L36" rel="file-test_getindices_dynamic_array-cf-L36">36</span>
          <span class="line-number" id="file-test_getindices_dynamic_array-cf-L37" rel="file-test_getindices_dynamic_array-cf-L37">37</span>
          <span class="line-number" id="file-test_getindices_dynamic_array-cf-L38" rel="file-test_getindices_dynamic_array-cf-L38">38</span>
          <span class="line-number" id="file-test_getindices_dynamic_array-cf-L39" rel="file-test_getindices_dynamic_array-cf-L39">39</span>
          <span class="line-number" id="file-test_getindices_dynamic_array-cf-L40" rel="file-test_getindices_dynamic_array-cf-L40">40</span>
          <span class="line-number" id="file-test_getindices_dynamic_array-cf-L41" rel="file-test_getindices_dynamic_array-cf-L41">41</span>
          <span class="line-number" id="file-test_getindices_dynamic_array-cf-L42" rel="file-test_getindices_dynamic_array-cf-L42">42</span>
          <span class="line-number" id="file-test_getindices_dynamic_array-cf-L43" rel="file-test_getindices_dynamic_array-cf-L43">43</span>
          <span class="line-number" id="file-test_getindices_dynamic_array-cf-L44" rel="file-test_getindices_dynamic_array-cf-L44">44</span>
          <span class="line-number" id="file-test_getindices_dynamic_array-cf-L45" rel="file-test_getindices_dynamic_array-cf-L45">45</span>
          <span class="line-number" id="file-test_getindices_dynamic_array-cf-L46" rel="file-test_getindices_dynamic_array-cf-L46">46</span>
          <span class="line-number" id="file-test_getindices_dynamic_array-cf-L47" rel="file-test_getindices_dynamic_array-cf-L47">47</span>
          <span class="line-number" id="file-test_getindices_dynamic_array-cf-L48" rel="file-test_getindices_dynamic_array-cf-L48">48</span>
          <span class="line-number" id="file-test_getindices_dynamic_array-cf-L49" rel="file-test_getindices_dynamic_array-cf-L49">49</span>
          <span class="line-number" id="file-test_getindices_dynamic_array-cf-L50" rel="file-test_getindices_dynamic_array-cf-L50">50</span>
          <span class="line-number" id="file-test_getindices_dynamic_array-cf-L51" rel="file-test_getindices_dynamic_array-cf-L51">51</span>
          <span class="line-number" id="file-test_getindices_dynamic_array-cf-L52" rel="file-test_getindices_dynamic_array-cf-L52">52</span>
          <span class="line-number" id="file-test_getindices_dynamic_array-cf-L53" rel="file-test_getindices_dynamic_array-cf-L53">53</span>
          <span class="line-number" id="file-test_getindices_dynamic_array-cf-L54" rel="file-test_getindices_dynamic_array-cf-L54">54</span>
          <span class="line-number" id="file-test_getindices_dynamic_array-cf-L55" rel="file-test_getindices_dynamic_array-cf-L55">55</span>
          <span class="line-number" id="file-test_getindices_dynamic_array-cf-L56" rel="file-test_getindices_dynamic_array-cf-L56">56</span>
          <span class="line-number" id="file-test_getindices_dynamic_array-cf-L57" rel="file-test_getindices_dynamic_array-cf-L57">57</span>
          <span class="line-number" id="file-test_getindices_dynamic_array-cf-L58" rel="file-test_getindices_dynamic_array-cf-L58">58</span>
          <span class="line-number" id="file-test_getindices_dynamic_array-cf-L59" rel="file-test_getindices_dynamic_array-cf-L59">59</span>
          <span class="line-number" id="file-test_getindices_dynamic_array-cf-L60" rel="file-test_getindices_dynamic_array-cf-L60">60</span>
          <span class="line-number" id="file-test_getindices_dynamic_array-cf-L61" rel="file-test_getindices_dynamic_array-cf-L61">61</span>
          <span class="line-number" id="file-test_getindices_dynamic_array-cf-L62" rel="file-test_getindices_dynamic_array-cf-L62">62</span>
          <span class="line-number" id="file-test_getindices_dynamic_array-cf-L63" rel="file-test_getindices_dynamic_array-cf-L63">63</span>
          <span class="line-number" id="file-test_getindices_dynamic_array-cf-L64" rel="file-test_getindices_dynamic_array-cf-L64">64</span>
          <span class="line-number" id="file-test_getindices_dynamic_array-cf-L65" rel="file-test_getindices_dynamic_array-cf-L65">65</span>
          <span class="line-number" id="file-test_getindices_dynamic_array-cf-L66" rel="file-test_getindices_dynamic_array-cf-L66">66</span>
          <span class="line-number" id="file-test_getindices_dynamic_array-cf-L67" rel="file-test_getindices_dynamic_array-cf-L67">67</span>
          <span class="line-number" id="file-test_getindices_dynamic_array-cf-L68" rel="file-test_getindices_dynamic_array-cf-L68">68</span>
          <span class="line-number" id="file-test_getindices_dynamic_array-cf-L69" rel="file-test_getindices_dynamic_array-cf-L69">69</span>
          <span class="line-number" id="file-test_getindices_dynamic_array-cf-L70" rel="file-test_getindices_dynamic_array-cf-L70">70</span>
          <span class="line-number" id="file-test_getindices_dynamic_array-cf-L71" rel="file-test_getindices_dynamic_array-cf-L71">71</span>
          <span class="line-number" id="file-test_getindices_dynamic_array-cf-L72" rel="file-test_getindices_dynamic_array-cf-L72">72</span>
          <span class="line-number" id="file-test_getindices_dynamic_array-cf-L73" rel="file-test_getindices_dynamic_array-cf-L73">73</span>
          <span class="line-number" id="file-test_getindices_dynamic_array-cf-L74" rel="file-test_getindices_dynamic_array-cf-L74">74</span>
          <span class="line-number" id="file-test_getindices_dynamic_array-cf-L75" rel="file-test_getindices_dynamic_array-cf-L75">75</span>
          <span class="line-number" id="file-test_getindices_dynamic_array-cf-L76" rel="file-test_getindices_dynamic_array-cf-L76">76</span>
          <span class="line-number" id="file-test_getindices_dynamic_array-cf-L77" rel="file-test_getindices_dynamic_array-cf-L77">77</span>
          <span class="line-number" id="file-test_getindices_dynamic_array-cf-L78" rel="file-test_getindices_dynamic_array-cf-L78">78</span>
          <span class="line-number" id="file-test_getindices_dynamic_array-cf-L79" rel="file-test_getindices_dynamic_array-cf-L79">79</span>
          <span class="line-number" id="file-test_getindices_dynamic_array-cf-L80" rel="file-test_getindices_dynamic_array-cf-L80">80</span>
          <span class="line-number" id="file-test_getindices_dynamic_array-cf-L81" rel="file-test_getindices_dynamic_array-cf-L81">81</span>
          <span class="line-number" id="file-test_getindices_dynamic_array-cf-L82" rel="file-test_getindices_dynamic_array-cf-L82">82</span>
          <span class="line-number" id="file-test_getindices_dynamic_array-cf-L83" rel="file-test_getindices_dynamic_array-cf-L83">83</span>
          <span class="line-number" id="file-test_getindices_dynamic_array-cf-L84" rel="file-test_getindices_dynamic_array-cf-L84">84</span>
          <span class="line-number" id="file-test_getindices_dynamic_array-cf-L85" rel="file-test_getindices_dynamic_array-cf-L85">85</span>
          <span class="line-number" id="file-test_getindices_dynamic_array-cf-L86" rel="file-test_getindices_dynamic_array-cf-L86">86</span>
          <span class="line-number" id="file-test_getindices_dynamic_array-cf-L87" rel="file-test_getindices_dynamic_array-cf-L87">87</span>
          <span class="line-number" id="file-test_getindices_dynamic_array-cf-L88" rel="file-test_getindices_dynamic_array-cf-L88">88</span>
          <span class="line-number" id="file-test_getindices_dynamic_array-cf-L89" rel="file-test_getindices_dynamic_array-cf-L89">89</span>
          <span class="line-number" id="file-test_getindices_dynamic_array-cf-L90" rel="file-test_getindices_dynamic_array-cf-L90">90</span>
          <span class="line-number" id="file-test_getindices_dynamic_array-cf-L91" rel="file-test_getindices_dynamic_array-cf-L91">91</span>
          <span class="line-number" id="file-test_getindices_dynamic_array-cf-L92" rel="file-test_getindices_dynamic_array-cf-L92">92</span>
          <span class="line-number" id="file-test_getindices_dynamic_array-cf-L93" rel="file-test_getindices_dynamic_array-cf-L93">93</span>
          <span class="line-number" id="file-test_getindices_dynamic_array-cf-L94" rel="file-test_getindices_dynamic_array-cf-L94">94</span>
          <span class="line-number" id="file-test_getindices_dynamic_array-cf-L95" rel="file-test_getindices_dynamic_array-cf-L95">95</span>
          <span class="line-number" id="file-test_getindices_dynamic_array-cf-L96" rel="file-test_getindices_dynamic_array-cf-L96">96</span>
          <span class="line-number" id="file-test_getindices_dynamic_array-cf-L97" rel="file-test_getindices_dynamic_array-cf-L97">97</span>
          <span class="line-number" id="file-test_getindices_dynamic_array-cf-L98" rel="file-test_getindices_dynamic_array-cf-L98">98</span>
          <span class="line-number" id="file-test_getindices_dynamic_array-cf-L99" rel="file-test_getindices_dynamic_array-cf-L99">99</span>
          <span class="line-number" id="file-test_getindices_dynamic_array-cf-L100" rel="file-test_getindices_dynamic_array-cf-L100">100</span>
          <span class="line-number" id="file-test_getindices_dynamic_array-cf-L101" rel="file-test_getindices_dynamic_array-cf-L101">101</span>
          <span class="line-number" id="file-test_getindices_dynamic_array-cf-L102" rel="file-test_getindices_dynamic_array-cf-L102">102</span>
          <span class="line-number" id="file-test_getindices_dynamic_array-cf-L103" rel="file-test_getindices_dynamic_array-cf-L103">103</span>
        </td>
        <td class="line-data">
          <pre class="line-pre"><div class="line" id="file-test_getindices_dynamic_array-cf-LC1">body common control</div><div class="line" id="file-test_getindices_dynamic_array-cf-LC2">{</div><div class="line" id="file-test_getindices_dynamic_array-cf-LC3">&nbsp;</div><div class="line" id="file-test_getindices_dynamic_array-cf-LC4">  bundlesequence =&gt; {</div><div class="line" id="file-test_getindices_dynamic_array-cf-LC5">                      &quot;example0&quot;,</div><div class="line" id="file-test_getindices_dynamic_array-cf-LC6">                      &quot;example1&quot;,</div><div class="line" id="file-test_getindices_dynamic_array-cf-LC7">                      &quot;example2&quot;,</div><div class="line" id="file-test_getindices_dynamic_array-cf-LC8">                    };</div><div class="line" id="file-test_getindices_dynamic_array-cf-LC9">}</div><div class="line" id="file-test_getindices_dynamic_array-cf-LC10">&nbsp;</div><div class="line" id="file-test_getindices_dynamic_array-cf-LC11">bundle agent example0</div><div class="line" id="file-test_getindices_dynamic_array-cf-LC12"># This pattern was shared on the CFEngine help mailing list by cyril</div><div class="line" id="file-test_getindices_dynamic_array-cf-LC13"># Thanks!</div><div class="line" id="file-test_getindices_dynamic_array-cf-LC14">{</div><div class="line" id="file-test_getindices_dynamic_array-cf-LC15">  vars:</div><div class="line" id="file-test_getindices_dynamic_array-cf-LC16">      &quot;list&quot; slist =&gt; { &quot;1&quot;, &quot;2&quot;, &quot;3&quot; };</div><div class="line" id="file-test_getindices_dynamic_array-cf-LC17">&nbsp;</div><div class="line" id="file-test_getindices_dynamic_array-cf-LC18">      # Autogenerate an array instead of typing it out</div><div class="line" id="file-test_getindices_dynamic_array-cf-LC19">      # &quot;array[item1]&quot; string =&gt; &quot;value1&quot;;</div><div class="line" id="file-test_getindices_dynamic_array-cf-LC20">      # &quot;array[item2]&quot; string =&gt; &quot;value2&quot;;</div><div class="line" id="file-test_getindices_dynamic_array-cf-LC21">      # &quot;array[item3]&quot; string =&gt; &quot;value3&quot;;</div><div class="line" id="file-test_getindices_dynamic_array-cf-LC22">      &quot;array[item$(list)]&quot; string =&gt; &quot;value$(list)&quot;;</div><div class="line" id="file-test_getindices_dynamic_array-cf-LC23">&nbsp;</div><div class="line" id="file-test_getindices_dynamic_array-cf-LC24">    !idx_defined::</div><div class="line" id="file-test_getindices_dynamic_array-cf-LC25">      &quot;idx&quot;</div><div class="line" id="file-test_getindices_dynamic_array-cf-LC26">        slist =&gt; { getindices(&quot;array&quot;) },</div><div class="line" id="file-test_getindices_dynamic_array-cf-LC27">        handle =&gt; &quot;$(this.bundle)_get_array_index&quot;;</div><div class="line" id="file-test_getindices_dynamic_array-cf-LC28">&nbsp;</div><div class="line" id="file-test_getindices_dynamic_array-cf-LC29">  classes:</div><div class="line" id="file-test_getindices_dynamic_array-cf-LC30">      &quot;idx_defined&quot; expression =&gt; isvariable(&quot;idx&quot;);</div><div class="line" id="file-test_getindices_dynamic_array-cf-LC31">&nbsp;</div><div class="line" id="file-test_getindices_dynamic_array-cf-LC32">  reports:</div><div class="line" id="file-test_getindices_dynamic_array-cf-LC33">    cfengine::</div><div class="line" id="file-test_getindices_dynamic_array-cf-LC34">      # should report 3 times itemx where x is a list value</div><div class="line" id="file-test_getindices_dynamic_array-cf-LC35">      &quot;$(this.bundle) $(idx)&quot;;</div><div class="line" id="file-test_getindices_dynamic_array-cf-LC36">&nbsp;</div><div class="line" id="file-test_getindices_dynamic_array-cf-LC37">}</div><div class="line" id="file-test_getindices_dynamic_array-cf-LC38">&nbsp;</div><div class="line" id="file-test_getindices_dynamic_array-cf-LC39">&nbsp;</div><div class="line" id="file-test_getindices_dynamic_array-cf-LC40">bundle agent example1</div><div class="line" id="file-test_getindices_dynamic_array-cf-LC41"># This pattern was shared on the CFEngine help mailing list by cyril</div><div class="line" id="file-test_getindices_dynamic_array-cf-LC42"># Thanks!</div><div class="line" id="file-test_getindices_dynamic_array-cf-LC43">{</div><div class="line" id="file-test_getindices_dynamic_array-cf-LC44">  vars:</div><div class="line" id="file-test_getindices_dynamic_array-cf-LC45">      &quot;list&quot; slist =&gt; { &quot;1&quot;, &quot;2&quot;, &quot;3&quot; };</div><div class="line" id="file-test_getindices_dynamic_array-cf-LC46">&nbsp;</div><div class="line" id="file-test_getindices_dynamic_array-cf-LC47">      # Autogenerate an array instead of typing it out</div><div class="line" id="file-test_getindices_dynamic_array-cf-LC48">      # &quot;array[item1]&quot; string =&gt; &quot;value1&quot;;</div><div class="line" id="file-test_getindices_dynamic_array-cf-LC49">      # &quot;array[item2]&quot; string =&gt; &quot;value2&quot;;</div><div class="line" id="file-test_getindices_dynamic_array-cf-LC50">      # &quot;array[item3]&quot; string =&gt; &quot;value3&quot;;</div><div class="line" id="file-test_getindices_dynamic_array-cf-LC51">      &quot;array[item$(list)]&quot; string =&gt; &quot;value$(list)&quot;;</div><div class="line" id="file-test_getindices_dynamic_array-cf-LC52">&nbsp;</div><div class="line" id="file-test_getindices_dynamic_array-cf-LC53">    list_defined.!idx_defined::</div><div class="line" id="file-test_getindices_dynamic_array-cf-LC54">      &quot;idx&quot;</div><div class="line" id="file-test_getindices_dynamic_array-cf-LC55">        slist =&gt; { getindices(&quot;array&quot;) },</div><div class="line" id="file-test_getindices_dynamic_array-cf-LC56">        handle =&gt; &quot;$(this.bundle)_get_array_index&quot;;</div><div class="line" id="file-test_getindices_dynamic_array-cf-LC57">&nbsp;</div><div class="line" id="file-test_getindices_dynamic_array-cf-LC58">  classes:</div><div class="line" id="file-test_getindices_dynamic_array-cf-LC59">      &quot;list_defined&quot;</div><div class="line" id="file-test_getindices_dynamic_array-cf-LC60">        expression =&gt; isvariable(&quot;list&quot;),</div><div class="line" id="file-test_getindices_dynamic_array-cf-LC61">        comment    =&gt; &quot;This is one way to work around &#39;Duplicate selection of</div><div class="line" id="file-test_getindices_dynamic_array-cf-LC62">                       value for variable&#39; messages. Your forcing get_array_index</div><div class="line" id="file-test_getindices_dynamic_array-cf-LC63">                       to not be evaluated until the next pass&quot;;</div><div class="line" id="file-test_getindices_dynamic_array-cf-LC64">&nbsp;</div><div class="line" id="file-test_getindices_dynamic_array-cf-LC65">      &quot;idx_defined&quot; expression =&gt; isvariable(&quot;idx&quot;);</div><div class="line" id="file-test_getindices_dynamic_array-cf-LC66">&nbsp;</div><div class="line" id="file-test_getindices_dynamic_array-cf-LC67">  reports:</div><div class="line" id="file-test_getindices_dynamic_array-cf-LC68">    cfengine::</div><div class="line" id="file-test_getindices_dynamic_array-cf-LC69">      # should report 3 times itemx where x is a list value</div><div class="line" id="file-test_getindices_dynamic_array-cf-LC70">      &quot;$(this.bundle) $(idx)&quot;;</div><div class="line" id="file-test_getindices_dynamic_array-cf-LC71">&nbsp;</div><div class="line" id="file-test_getindices_dynamic_array-cf-LC72">}</div><div class="line" id="file-test_getindices_dynamic_array-cf-LC73">&nbsp;</div><div class="line" id="file-test_getindices_dynamic_array-cf-LC74">bundle agent example2</div><div class="line" id="file-test_getindices_dynamic_array-cf-LC75"># This pattern was shared on the CFEngine help mailing list by cyril</div><div class="line" id="file-test_getindices_dynamic_array-cf-LC76"># Thanks!</div><div class="line" id="file-test_getindices_dynamic_array-cf-LC77">{</div><div class="line" id="file-test_getindices_dynamic_array-cf-LC78">  vars:</div><div class="line" id="file-test_getindices_dynamic_array-cf-LC79">      &quot;list&quot; slist =&gt; { &quot;1&quot;, &quot;2&quot;, &quot;3&quot; };</div><div class="line" id="file-test_getindices_dynamic_array-cf-LC80">&nbsp;</div><div class="line" id="file-test_getindices_dynamic_array-cf-LC81">      # Autogenerate an array instead of typing it out</div><div class="line" id="file-test_getindices_dynamic_array-cf-LC82">      # &quot;array[item1]&quot; string =&gt; &quot;value1&quot;;</div><div class="line" id="file-test_getindices_dynamic_array-cf-LC83">      # &quot;array[item2]&quot; string =&gt; &quot;value2&quot;;</div><div class="line" id="file-test_getindices_dynamic_array-cf-LC84">      # &quot;array[item3]&quot; string =&gt; &quot;value3&quot;;</div><div class="line" id="file-test_getindices_dynamic_array-cf-LC85">      &quot;array[item$(list)]&quot; string =&gt; &quot;value$(list)&quot;;</div><div class="line" id="file-test_getindices_dynamic_array-cf-LC86">&nbsp;</div><div class="line" id="file-test_getindices_dynamic_array-cf-LC87">    !idx_defined::</div><div class="line" id="file-test_getindices_dynamic_array-cf-LC88">      &quot;idx&quot;</div><div class="line" id="file-test_getindices_dynamic_array-cf-LC89">        slist   =&gt; { getindices(&quot;array&quot;) },</div><div class="line" id="file-test_getindices_dynamic_array-cf-LC90">        policy  =&gt; &quot;free&quot;,</div><div class="line" id="file-test_getindices_dynamic_array-cf-LC91">        handle  =&gt; &quot;$(this.bundle)_get_array_index&quot;,</div><div class="line" id="file-test_getindices_dynamic_array-cf-LC92">        comment =&gt; &quot;Setting policy free is another way to suppress &#39;Duplicate</div><div class="line" id="file-test_getindices_dynamic_array-cf-LC93">                    selection of value for variable&#39; messages.&quot;;</div><div class="line" id="file-test_getindices_dynamic_array-cf-LC94">&nbsp;</div><div class="line" id="file-test_getindices_dynamic_array-cf-LC95">  classes:</div><div class="line" id="file-test_getindices_dynamic_array-cf-LC96">      &quot;idx_defined&quot; expression =&gt; isvariable(&quot;idx&quot;);</div><div class="line" id="file-test_getindices_dynamic_array-cf-LC97">&nbsp;</div><div class="line" id="file-test_getindices_dynamic_array-cf-LC98">  reports:</div><div class="line" id="file-test_getindices_dynamic_array-cf-LC99">    cfengine::</div><div class="line" id="file-test_getindices_dynamic_array-cf-LC100">      # should report 3 times itemx where x is a list value</div><div class="line" id="file-test_getindices_dynamic_array-cf-LC101">      &quot;$(this.bundle) $(idx)&quot;;</div><div class="line" id="file-test_getindices_dynamic_array-cf-LC102">&nbsp;</div><div class="line" id="file-test_getindices_dynamic_array-cf-LC103">}</div></pre>
        </td>
      </tr>
    </table>
  </div>

        </div>

        <div class="gist-meta">
          <a href="https://gist.github.com/nickanderson/5154392/raw/d1b746f381b08a8e466820e0152676ab1fbf585a/test_getindices_dynamic_array.cf" style="float:right">view raw</a>
          <a href="https://gist.github.com/nickanderson/5154392#file-test_getindices_dynamic_array-cf" style="float:right; margin-right:10px; color:#666;">test_getindices_dynamic_array.cf</a>
          <a href="https://gist.github.com/nickanderson/5154392">This Gist</a> is brought to you using <a href="http://en.bainternet.info/2011/simple-gist-embed"><small>Simple Gist Embed</small></a>.
        </div>
      </div>
</div>
</div>
<p> </p>
<p> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.cmdln.org/2013/03/13/working-around-getindices-with-dynamically-generated-arrays-in-cfengine-3/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Deep thoughts</title>
		<link>http://www.cmdln.org/2013/03/09/deep-thoughts/</link>
		<comments>http://www.cmdln.org/2013/03/09/deep-thoughts/#comments</comments>
		<pubDate>Sat, 09 Mar 2013 19:23:10 +0000</pubDate>
		<dc:creator>Nick Anderson</dc:creator>
				<category><![CDATA[Posts]]></category>

		<guid isPermaLink="false">http://www.cmdln.org/?p=1141</guid>
		<description><![CDATA[bundle common knowledge(status) {   vars:     "software" string =&#62; "$(status)", policy =&#62; "free";     !isUsable::       "software" string =&#62; "usable", policy =&#62; "free";     isUsable::       "software" string =&#62; "reusable", policy =&#62; "free";   classes:     "isUsable" expression =&#62; regcmp("$(software)", "usable");     "reUsable" expression =&#62; regcmp("$(software)", "resuable");   reports:       Morning&#124;Afternoon&#124;Evening&#124;Night::         "Before software [...]]]></description>
				<content:encoded><![CDATA[<pre>bundle common knowledge(status)
{
  vars:
    "software" string =&gt; "$(status)", policy =&gt; "free";

    !isUsable::
      "software" string =&gt; "usable", policy =&gt; "free";

    isUsable::
      "software" string =&gt; "reusable", policy =&gt; "free";

  classes:
    "isUsable" expression =&gt; regcmp("$(software)", "usable");
    "reUsable" expression =&gt; regcmp("$(software)", "resuable");

  reports:
      Morning|Afternoon|Evening|Night::
        "Before software can be reusable it first has to be useable.",
          comment =&gt; "Ralph Johnson";
}</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.cmdln.org/2013/03/09/deep-thoughts/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CFEngine 3.4.2 Changelog for Breakfast</title>
		<link>http://www.cmdln.org/2013/01/11/cfengine-3-4-2-changelog-for-breakfast/</link>
		<comments>http://www.cmdln.org/2013/01/11/cfengine-3-4-2-changelog-for-breakfast/#comments</comments>
		<pubDate>Fri, 11 Jan 2013 14:44:58 +0000</pubDate>
		<dc:creator>Nick Anderson</dc:creator>
				<category><![CDATA[Posts]]></category>
		<category><![CDATA[CFEngine]]></category>

		<guid isPermaLink="false">http://www.cmdln.org/?p=1124</guid>
		<description><![CDATA[Changelogs are just as important as the most important meal of the day. OK so I don’t always eat breakfast, but I do make an effort to read changelogs. CFEngine 3.4.2 was released today. What I found interesting was that the default masterfiles policy has been updated. body executor control now calls $(sys.workdir)/inputs/update.cf instead of [...]]]></description>
				<content:encoded><![CDATA[<p>Changelogs <a href="http://www.cmdln.org/2013/01/11/cfengine-3-4-2-changelog-for-breakfast/the-dexter-eggs/" rel="attachment wp-att-1125"><img class="alignright size-medium wp-image-1125" alt="Dexter Eggs" src="http://www.cmdln.org/wp-content/uploads/2013/01/the-dexter-eggs-300x174.jpg" width="300" height="174" /></a>are just as important as the most important meal of the day. OK so I don’t always eat breakfast, but I do make an effort to read changelogs. <a title="CFEngine 3.4.2 Changelog" href="https://github.com/cfengine/core/blob/3.4.2/ChangeLog" target="_blank">CFEngine 3.4.2</a> was released today.</p>
<p>What I found interesting was that the default masterfiles policy has been updated. body executor control now calls $(sys.workdir)/inputs/update.cf instead of failsafe.cf. And $(sys.workdir)/failsafe/failsafe.cf (which was new as of 3.4.0) is gone. I think its a good change. As far as users are concerned failsafes main task is updating policy. Its also what is run if something in the policy fails (hence failsafe). I think we have conflated the two by using a failsafe mechanism for updates as a general practice. This means we will touch the failsafe file more, and there is more opportunity for us to shoot ourselves in the foot. I have not tested, but I believe that failsafe.cf should be generated by CFEngine. This is probably very similar if not identical to the bootstrap policy. I suspect if you have your own failsafe.cf it will be used but I believe the intention is for us to let CFEngine generate that unless we have a good reason to override it.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.cmdln.org/2013/01/11/cfengine-3-4-2-changelog-for-breakfast/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Quick Tip: Drilling into zenoss data with zendmd</title>
		<link>http://www.cmdln.org/2012/12/06/quick-tip-drilling-into-zenoss-data-with-zendmd/</link>
		<comments>http://www.cmdln.org/2012/12/06/quick-tip-drilling-into-zenoss-data-with-zendmd/#comments</comments>
		<pubDate>Thu, 06 Dec 2012 15:01:13 +0000</pubDate>
		<dc:creator>Nick Anderson</dc:creator>
				<category><![CDATA[Posts]]></category>
		<category><![CDATA[devops]]></category>
		<category><![CDATA[sysadmin]]></category>
		<category><![CDATA[zendmd]]></category>
		<category><![CDATA[zenoss]]></category>

		<guid isPermaLink="false">http://www.cmdln.org/?p=1120</guid>
		<description><![CDATA[Sometimes you want to know what value zenoss has for something. The numbers sent in alerts seem to be the value that zenoss has, but the graphs are usually formatted to make more sense. 1394606080 might come in an alert, but on the graph it would show as 1.3 or 1.4G. It can cause some [...]]]></description>
				<content:encoded><![CDATA[<p>Sometimes you want to know what value zenoss has for something. The numbers sent in alerts seem to be the value that zenoss has, but the graphs are usually formatted to make more sense. 1394606080 might come in an alert, but on the graph it would show as 1.3 or 1.4G. It can cause some slight confusion when other people expect 90% of 1.4G instead of 90% of 1394606080 to be an alert threshold.</p>
<p>Any way, log in to your zenoss box as the zenoss user at a terminal and run zendmd. We will select a device, and then get a value from one of the RRDs.</p>
<pre class="brush: plain; title: ; notranslate">

d = dmd.Devices.findDevice('myjavaserver')
d.getRRDValue('HeapMemory_max')

1394606080.0

</pre>
<p>You can look up other things from here as well for example zproperties, try d.zDeviceTemplates or d.zCommandCycleTime.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.cmdln.org/2012/12/06/quick-tip-drilling-into-zenoss-data-with-zendmd/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CFEngine 3 Policy Update or How cf_promises_validated Works</title>
		<link>http://www.cmdln.org/2012/10/24/cfengine-3-policy-update-or-how-cf_promises_validated-works/</link>
		<comments>http://www.cmdln.org/2012/10/24/cfengine-3-policy-update-or-how-cf_promises_validated-works/#comments</comments>
		<pubDate>Thu, 25 Oct 2012 02:07:09 +0000</pubDate>
		<dc:creator>Nick Anderson</dc:creator>
				<category><![CDATA[Posts]]></category>
		<category><![CDATA[CFEngine]]></category>
		<category><![CDATA[cf_promises_validated]]></category>
		<category><![CDATA[failsafe.cf]]></category>
		<category><![CDATA[update.cf]]></category>

		<guid isPermaLink="false">http://www.cmdln.org/?p=1092</guid>
		<description><![CDATA[Over the past several months 2 years (since 3.1.2 release, wow time flys when your having fun. I checked and 3.1.2 was released on Dec 9th 2010.) I have seen a few questions regarding how the default CFEngine policy update works, and more specifically how cf_promises_validated plays into the update process. This is my stab [...]]]></description>
				<content:encoded><![CDATA[<p>Over the past <del>several months</del> 2 years (since 3.1.2 release, wow time flys when your having fun. I checked and <a href="https://cfengine.com/cftimes/articles/0000000047.html" target="_blank">3.1.2</a><a href="http://www.cmdln.org/wp-content/uploads/2012/10/question-mark.jpg"><img class="alignright size-medium wp-image-1098" title="Little question" src="http://www.cmdln.org/wp-content/uploads/2012/10/question-mark-240x300.jpg" alt="" width="240" height="300" /></a><a href="https://cfengine.com/cftimes/articles/0000000047.html" target="_blank"> was released</a> on Dec 9th 2010.) I have <a href="https://groups.google.com/forum/?hl=en&amp;fromgroups=#!topic/help-cfengine/MD0w02t4dQc" target="_blank">seen</a> <a href="https://cfengine.com/forum/read.php?3,27307" target="_blank">a</a> <a href="https://cfengine.com/forum/read.php?6,26918,27451#msg-27451" target="_blank">few</a> <a href="https://cfengine.com/forum/read.php?3,26246,26259#msg-26259" target="_blank">questions</a> regarding how the default CFEngine policy update works, and more specifically how cf_promises_validated plays into the update process. This is my stab at describing the history and behaviour. I welcome any corrections.</p>
<p>The default failsafe.cf update policy is simple in nature. (We could probably debate what is <a title="Strangeloop 2011 - Rich Hickey - Simple Made Easy" href="http://www.infoq.com/presentations/Simple-Made-Easy" target="_blank">simple</a> or <a title="Complex vs Complicated" href="http://www.cmdln.org/2012/07/13/complex-vs-complicated/" target="_blank">complex</a>, but I am comfortable with the label in this case.) Agents copy policy from /var/cfengine/masterfiles on the policy hub, to /var/cfengine/inputs. This is the same for all agents, even the agent that runs on the policy hub, the only difference is that since the files are already local on the policy hub they don’t have to go over the network, but they are still copied from the same source, to the same destination.</p>
<p>The 3.1.2 release was an efficiency related release. One of the enhancements was the introduction of cf_promises_validated. <a title="Meet the CFEngine Team - Eystein Måløy Stenberg" href="http://cfengine.com/blog/meet-the-cfengine-team-eystein" target="_blank">Eystein</a> wrote a <a title="3.1.2 Extended Change Log" href="http://www.blogcompiler.com/2010/12/29/cfengine-3-1-2-extended-change-log/" target="_blank">great extended change log</a> on his blog covering the release including a section on cf_promises_validated which is where I first learned of the feature and how to use it. Again, the cf_promises_validated mechanism is simple in nature. From his post “this file (/var/cfengine/masterfiles) is created by <code>cf-agent</code> or any other CFEngine component after it has successfully verified the policy with <code>cf-promises</code>.” What I think is missing from this description is that /var/cfengine/masterfiles is created/updated when policy has been verified <strong><span style="text-decoration: underline;">after</span></strong> the policy has changed (so it’s not supposed to update this file every execution, there <a href="https://cfengine.com/bugtracker/view.php?id=1258" target="_blank">seems to be a bug</a> with this but that is not expected behaviour). I do not know what constitutes change but I suspect it’s some variation of a tripwire policy similar to the following. Remember this is a simple mechanism and is the same for <span style="text-decoration: underline;"><strong>any</strong></span> agent, policy hub or not.</p>
<pre style="padding-left: 30px;">files:
  any::
    "/var/cfengine/masterfiles"
      changes      =&gt; detect_all_change,
      depth_search =&gt; recurse("inf"),
      classes      =&gt; if_repaired("cf_promises_validated");

  cf_promises_validated::
    "/var/cfengine/masterfiles/cf_promises_validated"
      create =&gt; "true",
      touch  =&gt; "true";</pre>
<p>The difference between a policy hub (am_policy_hub) and a non policy hub as I understand it is determined by comparing the contents of /var/cfengine/policy_server.dat to the ips/hostnames associated with the interfaces on the system. If the policy server found in policy_server.dat file resolves to an ip on the current system, it raises the am_policy_hub class. This am_policy_hub class is used in the default failsafe.cf update policy to determine when to copy files from /var/cfengine/masterfiles on the policy hub to /var/cfengine/inputs (locally to the executing agent).</p>
<p>Initially cf_promises_validated was an empty file, and mtime was used to determine if the file was newer. This was problematic for hosts that had time skews and a time stamp was introduced in <a title="CFEngine 3.3.0 Release Notes" href="https://cfengine.com/blog/cfengine-330-release-notes" target="_blank">3.3.0</a> so that digest could be used to determine difference more accurately. The fact that a time value is now stored in the file is only relevant to a human reading the file.</p>
<p>Spend a few minutes reading this snippet from the default update policy.</p>
<pre>01 files:
02  
03  !am_policy_hub::  # policy hub should not alter inputs/ uneccessary
04
05   "$(inputs_dir)/cf_promises_validated"
06        comment =&gt; "Check whether a validation stamp is available for a new policy update to reduce the distributed load",
07         handle =&gt; "update_files_check_valid_update",
08      copy_from =&gt; u_rcp("$(master_location)/cf_promises_validated","$(sys.policy_hub)"),
09         action =&gt; u_immediate,
10        classes =&gt; u_if_repaired("validated_updates_ready");
11 
12   "$(modules_dir)"
13          comment =&gt; "Always update modules files on client side",
14           handle =&gt; "update_files_update_modules",
15        copy_from =&gt; u_rcp("$(modules_dir)","$(sys.policy_hub)"),
16     depth_search =&gt; u_recurse("inf"),
17            perms =&gt; u_m("755"),
18           action =&gt; u_immediate;
19
20  am_policy_hub|validated_updates_ready::  # policy hub should always put masterfiles in inputs in order to check new policy
21
22   "$(inputs_dir)"
23           comment =&gt; "Copy policy updates from master source on policy server if a new validation was acquired",
24            handle =&gt; "update_files_inputs_dir",
25         copy_from =&gt; u_rcp("$(master_location)","$(sys.policy_hub)"),
26      depth_search =&gt; u_recurse("inf"),
27      file_select  =&gt; u_input_files,
28            action =&gt; u_immediate,
29           classes =&gt; u_if_repaired("update_report");</pre>
<p>The first thing that happens is for non policy hubs (line 3 starts the context class restriction, and line 5 begins the promiser). /var/cfengine/inputs/cf_promises_validated is checked against /var/cfengine/masterfiles/cf_promises_validated on the policy hub. If the file is different it is copied down and the validated_updates_ready class is defined. Skipping down to line 20 a new context class is defined for policy hubs or for agents which have validated that updates are ready (their cf_promises_validated in /var/cfengine/inputs was different from the cf_promises_validated file in /var/cfengine/masterfiles on the policy hub). If either of those classes are defined the agent recursively scans /var/cfengine/masterfiles on the policy hub and copies files that are different to /var/cfengine/inputs locally on the executing agent.</p>
<p>So, policy hubs <span style="text-decoration: underline;"><strong>always</strong></span> perform this update and copy files that are different from /var/cfengine/masterfiles to /var/cfengine/inputs. and non policy hubs only update /var/cfengine/inputs from /var/cfengine/masterfiles on the policy hub if cf_promises_validated has changes. The hub must always perform this update if you recall how cf_promises_validated is created/updated. New policy that successfully validates in /var/cfengine/inputs triggers cf_promises_validated to be updated in /var/cfengine/masterfiles. Agents need to see that file be different from the cf_promises_validated file in /var/cfengine/inputs in order to trigger a full policy update.</p>
<p>If its still not clear, read it a few more times. Things are usually pretty hard until they aren’t <img src='http://www.cmdln.org/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> . I recall reading the extended change log from 3.1.2 several times, as well as the example policy until I thought I had a good grasp on the flow. I hope you find this useful and I expect that this post will become less useful in the near future. I have filed a <a href="https://cfengine.com/dev/issues/1541#change-5063" target="_blank">bug</a> requesting better documentation coverage of the default update policy.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.cmdln.org/2012/10/24/cfengine-3-policy-update-or-how-cf_promises_validated-works/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>CFEngine 3 Tip: Find out what classes are being defined</title>
		<link>http://www.cmdln.org/2012/10/18/cfengine-3-tip-find-out-what-classes-are-being-defined/</link>
		<comments>http://www.cmdln.org/2012/10/18/cfengine-3-tip-find-out-what-classes-are-being-defined/#comments</comments>
		<pubDate>Thu, 18 Oct 2012 21:00:49 +0000</pubDate>
		<dc:creator>Nick Anderson</dc:creator>
				<category><![CDATA[Posts]]></category>
		<category><![CDATA[allclassesreport]]></category>
		<category><![CDATA[CFEngine]]></category>
		<category><![CDATA[classes]]></category>
		<category><![CDATA[tip]]></category>

		<guid isPermaLink="false">http://www.cmdln.org/?p=1083</guid>
		<description><![CDATA[CFEngine defines a classes for decision making during runs. Many of these hard classes you can see by running cf-promises –v. That wont show you all the other classes that are raised during a policy run. You could run something like this to see what classes are raised during execution. But that isn’t really a [...]]]></description>
				<content:encoded><![CDATA[<p>CFEngine defines a classes for dec<a href="http://www.cmdln.org/wp-content/uploads/2012/10/produc4.jpg"><img class="alignright size-medium wp-image-1085" title="A+ report" src="http://www.cmdln.org/wp-content/uploads/2012/10/produc4-300x199.jpg" alt="" width="300" height="199" /></a>ision making during runs. Many of these hard classes you can see by running cf-promises –v. That wont show you all the other classes that are raised during a policy run.</p>
<p>You could run something like this to see what classes are raised during execution.</p>
<pre class="brush: bash; title: ; notranslate">cf-agent -KIv | grep &quot;cf3&gt;\s*+&quot; | grep -v :</pre>
<p>But that isn’t really a clear picture under normal operation. You can use the <a href="http://cfengine.com/manuals/cf3-reference#allclassesreport-in-agent" target="_blank">allclassesreport in body agent control </a>to write out a list of classes defined during execution in /var/cfengine/state/allclasses.txt. It can be handy to have. I was recently wanting to do something when policy was executed by cf-execd but not when executed manually. Based on all the other automatic classes defined I had a suspicion there was an automatic class for that, and I had no need to manually add a class to exec_command in body executor control. I turned on the allclassesreport and sure enough, I found from_cfexecd was being raised.</p>
<p>Of course all of this information is readily available for remote agents in the dashboard of the enterprise version. And with the <a href="http://cfengine.com/25free" target="_blank">25free program</a> to get started, you should definitely take a look.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.cmdln.org/2012/10/18/cfengine-3-tip-find-out-what-classes-are-being-defined/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Dynamic method calls in CFEngine</title>
		<link>http://www.cmdln.org/2012/10/16/dynamic-method-calls-in-cfengine/</link>
		<comments>http://www.cmdln.org/2012/10/16/dynamic-method-calls-in-cfengine/#comments</comments>
		<pubDate>Tue, 16 Oct 2012 20:07:21 +0000</pubDate>
		<dc:creator>Nick Anderson</dc:creator>
				<category><![CDATA[Posts]]></category>
		<category><![CDATA[CFEngine]]></category>

		<guid isPermaLink="false">http://www.cmdln.org/?p=1070</guid>
		<description><![CDATA[Methods type promises are powerful abstraction tools in CFEngine 3. Methods allow you to activate bundles (optionally parametrized) from other bundles. This allows encapsulation of knowledge and lends itself to re-usability. I just want to share an example of calling bundles dynamically. It’s a contrived example, but I thought it was neat so here it [...]]]></description>
				<content:encoded><![CDATA[<p><a href="http://www.cmdln.org/wp-content/uploads/2012/10/dynamic.jpg"><img class="alignright size-medium wp-image-1076" title="dynamic" src="http://www.cmdln.org/wp-content/uploads/2012/10/dynamic-300x225.jpg" alt="" width="300" height="225" /></a>Methods type promises are powerful abstraction tools in CFEngine 3. Methods allow you to activate bundles (optionally parametrized) from other bundles. This allows encapsulation of knowledge and lends itself to re-usability.</p>
<p>I just want to share an example of calling bundles dynamically. It’s a contrived example, but I thought it was neat so here it is.</p>
<div class="gistem"><div id="gist-3901453" class="gist">
    

        <div class="gist-file">
          <div class="gist-data gist-syntax">
              <div class="highlight"><pre><div class='line' id='LC1'>R: in bundle agent handler1: I got value1</div><div class='line' id='LC2'>R: in bundle agent handler1: I got value2</div><div class='line' id='LC3'>&nbsp;!! Method invoked repairs</div><div class='line' id='LC4'>&nbsp;!! Method invoked repairs</div><div class='line' id='LC5'>R: in bundle agent handler2: I got value1</div><div class='line' id='LC6'>R: in bundle agent handler2: I got value2</div><div class='line' id='LC7'>&nbsp;!! Method invoked repairs</div><div class='line' id='LC8'>&nbsp;!! Method invoked repairs</div><div class='line' id='LC9'><br/></div></pre></div>
          </div>

          <div class="gist-meta">
            <a href="https://gist.github.com/raw/3901453/0b683269921c056b4e821dd2c63ca6b622122e26/output" style="float:right;">view raw</a>
            <a href="https://gist.github.com/3901453#file_output" style="float:right;margin-right:10px;color:#666">output</a>
            <a href="https://gist.github.com/3901453">This Gist</a> is brought to you using <a href="http://en.bainternet.info/2011/simple-gist-embed"><small>Simple Gist Embed</small></a>.
          </div>
        </div>

        <div class="gist-file">
          <div class="gist-data gist-syntax">
              <div class="highlight"><pre><div class='line' id='LC1'>body common control {</div><div class='line' id='LC2'><br/></div><div class='line' id='LC3'>&nbsp;&nbsp;&nbsp;&nbsp;bundlesequence =&gt; {&quot;main&quot;,};</div><div class='line' id='LC4'><br/></div><div class='line' id='LC5'>}</div><div class='line' id='LC6'><br/></div><div class='line' id='LC7'>bundle agent main{</div><div class='line' id='LC8'>vars:</div><div class='line' id='LC9'>&nbsp;&nbsp;&quot;mybundles&quot; slist =&gt; { &quot;handler1&quot;,&quot;handler2&quot; };</div><div class='line' id='LC10'>&nbsp;&nbsp;&quot;myvalues&quot; slist =&gt; { &quot;value1&quot;, &quot;value2&quot; };</div><div class='line' id='LC11'><br/></div><div class='line' id='LC12'>methods:</div><div class='line' id='LC13'>&nbsp;&nbsp;&quot;$(mybundle)&quot; usebundle =&gt; handler_iterator(&quot;$(mybundles)&quot;, &quot;@(main.myvalues)&quot;);</div><div class='line' id='LC14'><br/></div><div class='line' id='LC15'>}</div><div class='line' id='LC16'><br/></div><div class='line' id='LC17'>bundle agent handler_iterator(handler, values)</div><div class='line' id='LC18'># This expects a single value</div><div class='line' id='LC19'>{</div><div class='line' id='LC20'>methods:</div><div class='line' id='LC21'>&nbsp;&nbsp;&quot;$(handler)&quot; usebundle =&gt; $(handler)(&quot;@(handler_iterator.values)&quot;);</div><div class='line' id='LC22'><br/></div><div class='line' id='LC23'>}</div><div class='line' id='LC24'>bundle agent handler1(value1)</div><div class='line' id='LC25'>{</div><div class='line' id='LC26'>reports:</div><div class='line' id='LC27'>&nbsp;&nbsp;cfengine::</div><div class='line' id='LC28'>&nbsp;&nbsp;&nbsp;&nbsp;&quot;in bundle agent handler1: I got $(value1)&quot;;</div><div class='line' id='LC29'>}</div><div class='line' id='LC30'><br/></div><div class='line' id='LC31'>bundle agent handler2(value1)</div><div class='line' id='LC32'>{</div><div class='line' id='LC33'>reports:</div><div class='line' id='LC34'>&nbsp;&nbsp;cfengine::</div><div class='line' id='LC35'>&nbsp;&nbsp;&quot;in bundle agent handler2: I got $(value1)&quot;;</div><div class='line' id='LC36'>}</div><div class='line' id='LC37'><br/></div></pre></div>
          </div>

          <div class="gist-meta">
            <a href="https://gist.github.com/raw/3901453/67c8bda449460da4d5b8c1983d5b0bbaacc63b13/test.cf" style="float:right;">view raw</a>
            <a href="https://gist.github.com/3901453#file_test.cf" style="float:right;margin-right:10px;color:#666">test.cf</a>
            <a href="https://gist.github.com/3901453">This Gist</a> is brought to you using <a href="http://en.bainternet.info/2011/simple-gist-embed"><small>Simple Gist Embed</small></a>.
          </div>
        </div>
</div>
</div>
<h4>Breakdown</h4>
<h5>bundle agent main</h5>
<p>Here we define two lists, a list of bundle names and a list of values. Because of implicit list iteration we then call “handler_iterator” 2 times. Once for each value of the mybundles list. Each activation also passes in the myvalues list.</p>
<h5>Bundle agent handler_iterator</h5>
<p>handler_iterator is where the neat part happens. You can see that we call the bundle $(handler) (outside of quotes) with the parameter @(handler_iterator.values). This is what I found so interesting. I Have called bundles dynamically in the past, but I have always put the variable inside of quotes. That worked fine but it prevented me from using parameters when calling because the parameters were seen as part of the bundle name.  Here is an example of the handler_iterator bundle trying to use a parametrized value inside of quotes.</p>
<div class="gistem"><div id="gist-3901469" class="gist">
    

        <div class="gist-file">
          <div class="gist-data gist-syntax">
              <div class="highlight"><pre><div class='line' id='LC1'>bundle agent handler_iterator(handler, values)</div><div class='line' id='LC2'># This expects a single value</div><div class='line' id='LC3'>{</div><div class='line' id='LC4'>methods:</div><div class='line' id='LC5'>&nbsp;&nbsp;&quot;$(handler) $(values)&quot; usebundle =&gt; &quot;$(handler)($(values))&quot;;</div><div class='line' id='LC6'><br/></div><div class='line' id='LC7'>}</div></pre></div>
          </div>

          <div class="gist-meta">
            <a href="https://gist.github.com/raw/3901469/68b0a864b987496cdd8d936bb5d8777ca6fc6f6a/example%20of%20bundle%20inside%20quotes" style="float:right;">view raw</a>
            <a href="https://gist.github.com/3901469#file_example of bundle inside quotes" style="float:right;margin-right:10px;color:#666">example of bundle inside quotes</a>
            <a href="https://gist.github.com/3901469">This Gist</a> is brought to you using <a href="http://en.bainternet.info/2011/simple-gist-embed"><small>Simple Gist Embed</small></a>.
          </div>
        </div>

        <div class="gist-file">
          <div class="gist-data gist-syntax">
              <div class="highlight"><pre><div class='line' id='LC1'>&nbsp;!! A method attempted to use a bundle &quot;handler1(value1)&quot; that was apparently not defined!</div><div class='line' id='LC2'>I: Report relates to a promise with handle &quot;&quot;</div><div class='line' id='LC3'>I: Made in version &#39;not specified&#39; of &#39;./test.cf&#39; near line 21</div><div class='line' id='LC4'>&nbsp;!! A method attempted to use a bundle &quot;handler1(value2)&quot; that was apparently not defined!</div><div class='line' id='LC5'>I: Report relates to a promise with handle &quot;&quot;</div><div class='line' id='LC6'>I: Made in version &#39;not specified&#39; of &#39;./test.cf&#39; near line 21</div><div class='line' id='LC7'>&nbsp;!! Method failed in some repairs or aborted</div><div class='line' id='LC8'>&nbsp;!! A method attempted to use a bundle &quot;handler2(value1)&quot; that was apparently not defined!</div><div class='line' id='LC9'>I: Report relates to a promise with handle &quot;&quot;</div><div class='line' id='LC10'>I: Made in version &#39;not specified&#39; of &#39;./test.cf&#39; near line 21</div><div class='line' id='LC11'>&nbsp;!! A method attempted to use a bundle &quot;handler2(value2)&quot; that was apparently not defined!</div><div class='line' id='LC12'>I: Report relates to a promise with handle &quot;&quot;</div><div class='line' id='LC13'>I: Made in version &#39;not specified&#39; of &#39;./test.cf&#39; near line 21</div><div class='line' id='LC14'>&nbsp;!! Method failed in some repairs or aborted</div><div class='line' id='LC15'><br/></div></pre></div>
          </div>

          <div class="gist-meta">
            <a href="https://gist.github.com/raw/3901469/718fbe133ea02c04d6d55badaf599f90fdc7679b/output" style="float:right;">view raw</a>
            <a href="https://gist.github.com/3901469#file_output" style="float:right;margin-right:10px;color:#666">output</a>
            <a href="https://gist.github.com/3901469">This Gist</a> is brought to you using <a href="http://en.bainternet.info/2011/simple-gist-embed"><small>Simple Gist Embed</small></a>.
          </div>
        </div>
</div>
</div>
<p>Since $(handler) is a single value (we iterated over the list of bundles in bundle agent main) only one method activation will happen for each activation of handler_iterator.</p>
<h5>bundle agent handlerx</h5>
<p>The handlers themselves just report once for each item in the list passed to them.</p>
<h5>Specific Use Case</h5>
<p>Well, I don’t have one. I can however imagine that based on some variable event you might want to call a bundle with some variable parameter. Something like the <a href="https://github.com/cfengine/design-center/tree/master/sketches/utilities/nagios_plugin_agent" target="_blank">nagios_plugin_agent</a> sketch comes to mind. (It can call a variable bundle right now).</p>
]]></content:encoded>
			<wfw:commentRss>http://www.cmdln.org/2012/10/16/dynamic-method-calls-in-cfengine/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>LinuxCon/CloudOpen 2012</title>
		<link>http://www.cmdln.org/2012/08/01/linuxconcloudopen-2012/</link>
		<comments>http://www.cmdln.org/2012/08/01/linuxconcloudopen-2012/#comments</comments>
		<pubDate>Wed, 01 Aug 2012 13:55:30 +0000</pubDate>
		<dc:creator>Nick Anderson</dc:creator>
				<category><![CDATA[Posts]]></category>
		<category><![CDATA[automation]]></category>
		<category><![CDATA[canonical]]></category>
		<category><![CDATA[CFEngine]]></category>
		<category><![CDATA[citrix]]></category>
		<category><![CDATA[cloud]]></category>
		<category><![CDATA[cloudopen]]></category>
		<category><![CDATA[configuration management]]></category>
		<category><![CDATA[confrence]]></category>
		<category><![CDATA[dell]]></category>
		<category><![CDATA[devops]]></category>
		<category><![CDATA[juju]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[linuxcon]]></category>
		<category><![CDATA[opennebula]]></category>
		<category><![CDATA[openstack]]></category>
		<category><![CDATA[sysadmin]]></category>
		<category><![CDATA[vi]]></category>
		<category><![CDATA[vim]]></category>
		<category><![CDATA[webops]]></category>
		<category><![CDATA[xcp]]></category>
		<category><![CDATA[xen]]></category>

		<guid isPermaLink="false">http://www.cmdln.org/?p=1057</guid>
		<description><![CDATA[Are you going to LinuxCon/CloudOpen 2012? I am, and I think I have settled on my picks (at least until I look at the schedule again, lots of great options). Special thanks to CFEngine for sponsering me! Here are my picks for the minute. Building the Open Cloud — Mark Hinkle, Citrix The OpenNebula Cloud [...]]]></description>
				<content:encoded><![CDATA[<p>A<a href="http://www.cmdln.org/wp-content/uploads/2012/07/linuxon_cloudopen2012.png"><img class="alignright size-full wp-image-1058" title="linuxon_cloudopen2012" src="http://www.cmdln.org/wp-content/uploads/2012/07/linuxon_cloudopen2012.png" alt="" width="200" height="122" /></a>re you going to LinuxCon/CloudOpen 2012? I am, and I think I have settled on my picks (at least until I look at the schedule again, lots of great options).</p>
<p>Special thanks to <a href="http://www.cfengine.com">CFEngine</a> for sponsering me!</p>
<p>Here are my picks for the minute.</p>
<ul>
<li><a id="9046eff8494ef50f48da95349905592e" href="http://cloudopen2012.sched.org/event/9046eff8494ef50f48da95349905592e?iframe=yes&amp;w=900&amp;sidebar=yes&amp;bg=no#?iframe=yes&amp;w=900&amp;sidebar=yes&amp;bg=no#sched-body-outer">Building the Open Cloud — Mark Hinkle, Citrix</a></li>
<li><a id="5561a1f9b3d063dcca4b7abdc5dbc44b" href="http://cloudopen2012.sched.org/event/5561a1f9b3d063dcca4b7abdc5dbc44b?iframe=yes&amp;w=900&amp;sidebar=yes&amp;bg=no#?iframe=yes&amp;w=900&amp;sidebar=yes&amp;bg=no#sched-body-outer">The OpenNebula Cloud Platform for Data Center Virtualization — Carlos Martin, OpenNebula</a></li>
<li><a id="82e5d5410f32e11be9bd9bddf2b81570" href="http://cloudopen2012.sched.org/event/82e5d5410f32e11be9bd9bddf2b81570?iframe=yes&amp;w=900&amp;sidebar=yes&amp;bg=no#?iframe=yes&amp;w=900&amp;sidebar=yes&amp;bg=no#sched-body-outer">Cloning SysAdmins with the Cloud and Juju — Clint Byrum, Canonical</a></li>
<li><a id="da5dea5f6f017f925dac66eec964f13f" href="http://lcna2012.sched.org/event/da5dea5f6f017f925dac66eec964f13f?iframe=yes&amp;w=900&amp;sidebar=yes&amp;bg=no#?iframe=yes&amp;w=900&amp;sidebar=yes&amp;bg=no#sched-body-outer">A Collaborative Approach to Managing Linux Configurations — Diego Zamboni, CFEngine</a></li>
<li><a id="c28982d2a4f52cbfbb4000ce030a1771" href="http://cloudopen2012.sched.org/event/c28982d2a4f52cbfbb4000ce030a1771?iframe=yes&amp;w=900&amp;sidebar=yes&amp;bg=no#?iframe=yes&amp;w=900&amp;sidebar=yes&amp;bg=no#sched-body-outer">Building FOSS Clouds — Joe Brockmeier, Citrix</a></li>
<li><a id="f0cd279b854c642d12e7d531c68c53f0" href="http://cloudopen2012.sched.org/event/f0cd279b854c642d12e7d531c68c53f0?iframe=yes&amp;w=900&amp;sidebar=yes&amp;bg=no#sched-body-outer">Automation and DevOps Best Practices — Rob Hirschfeld, Dell</a></li>
<li><a id="e9936ee3a0369080a61b61f5eb9a88d4" href="http://cloudopen2012.sched.org/event/e9936ee3a0369080a61b61f5eb9a88d4?iframe=yes&amp;w=900&amp;sidebar=yes&amp;bg=no#?iframe=yes&amp;w=900&amp;sidebar=yes&amp;bg=no#sched-body-outer">Scaling Configuration Management Across Data Center and Cloud — Mark Burgess, CFEngine</a></li>
<li><a id="79ec0d894e2c56d92fd0a779bc873e3f" href="http://lcna2012.sched.org/event/79ec0d894e2c56d92fd0a779bc873e3f?iframe=yes&amp;w=900&amp;sidebar=yes&amp;bg=no#?iframe=yes&amp;w=900&amp;sidebar=yes&amp;bg=no#sched-body-outer">Editing with vi: Advanced Topics, Part I — Aleksey Tsaloikhin, Vertical Sysadmin, Inc.</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.cmdln.org/2012/08/01/linuxconcloudopen-2012/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
