generate-rundeck-resources problem

25 views
Skip to first unread message

chengkai liang

unread,
Oct 1, 2011, 9:50:38 PM10/1/11
to contr...@googlegroups.com, chengkai liang
When trying to use ctl -p reTest -t ProjectBuilder -r ppm -c generate-rundeck-resources -- -rundeckresourcesfile /opt/local/ctier/pkgs/jetty-6.1.21/controltier/configuration/resources/resources.reTest.xml to generate a resources file for consuming by rundeck, the resources file resources.reTest.xml it created seems to add a space for tag property if there are multiple tags being defined in the original resources file.

--- original resources file ---
    <node type="Node" name="ST-SSO" description="ControlTier managed node." ctlBase="d:/tools/ctier/ctl" ctlHome="d:\tools\ctier\pkgs\ctl-3.6.0" ctlUsername="ctieruser" osFamily="cygwin" osName="Windows Server 2008 R2" osArch="amd64" osVersion="6.1" hostname="ST-SSO" tags="reTest,sso">
        <resources>
            <resource type="PPMSSO" name="reTest" />
        </resources>
    </node>

--- output resources file for rundeck ---
<node name="ST-SSO" type="Node" description="ControlTier managed node." tags="reTest, sso" hostname="ST-SSO" osArch="amd64" osFamily="cygwin" osName="Windows Server 2008 R2" osVersion="6.1" username="ctieruser" editUrl="" remoteUrl=""/>

While rundeck server can load this output resources file without any problem, yet when filter this through job do have problem because of that extra space.  As you have to include that extra space in order to find the proper nodes.

I found out the problem is that it seems by looking at the ControlTier workbench, there is a space between each tag if multiple tags are defined.  How can we address this problem?

Thanks,
chengkai liang

The Z shell is to unix what OS X is to the rest of the computing world.

Charles Scott

unread,
Oct 7, 2011, 6:43:19 PM10/7/11
to contr...@googlegroups.com, chengkai liang
Hi Chengkai,

Here's a fix that should resolve your issue, it removes the spaces introduced in tags from this command when generating the xml.

bug info is here:  

The following has been committed into ProjectBuilder generate-rundeck-resources command source:


Charles-Scotts-DTO-MacBook-Pro:commands chuck$ svn diff generate-rundeck-resources.xml
Index: generate-rundeck-resources.xml
===================================================================
--- generate-rundeck-resources.xml      (revision 2303)
+++ generate-rundeck-resources.xml      (working copy)
@@ -28,7 +28,13 @@
         <typerestriction typeName="Node"/> 
       </entityquery>  
       <sequential> 
-        <propertyregex property="tags" override="true" input="@{default.selectedResourceTags}" regexp="\[(.*)\]" select="\1"/>  
+        <propertyregex property="tags.spaces" override="true" input="@{default.selectedResourceTags}" regexp="\[(.*)\]" select="\1"/>  
+        <loadresource property="tags">
+           <string>${tags.spaces}</string>
+           <filterchain>
+              <deletecharacters chars=" "/>
+           </filterchain>
+        </loadresource>
         <echo append="true" file="${opts.rundeckresourcesfile}">&lt;node name="@{default.name}" type="@{default.type}" description="@{default.description}" tags="${tags}" hostname="@{default.hostname}" osArch="@{default.osArch}" osFamily="@{default.osFamily}" osName="@{default.osName}" osVersion="@{default.osVersion}" username="@{default.ctlUsername}" editUrl="" remoteUrl=""/&gt;${line.separator}</echo> 
       </sequential> 
     </apply-macro>  
Charles-Scotts-DTO-MacBook-Pro:commands chuck$ svn commit -m 'fixed 3420454 bug where trailing  slash is introduced into dumped rundeck resource xml' generate-rundeck-resources.xml
Sending        generate-rundeck-resources.xml
Transmitting file data .
Committed revision 2304.


--
You received this message because you are subscribed to the Google Groups "ControlTier" group.
To post to this group, send email to contr...@googlegroups.com
To unsubscribe from this group, send email to controltier...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/controltier?hl=en
http://wiki.controltier.org

Reply all
Reply to author
Forward
0 new messages