Skip to content
This repository has been archived by the owner on Jan 9, 2019. It is now read-only.

Commit

Permalink
Refactored import implementation to be service-based. Controller
Browse files Browse the repository at this point in the history
layer now works just as a web gateway.
Fixes #180
  • Loading branch information
Alex Honor committed Jul 30, 2012
1 parent 514f006 commit a2cdfc1
Show file tree
Hide file tree
Showing 9 changed files with 1,001 additions and 209 deletions.
120 changes: 120 additions & 0 deletions grails-app/conf/import/example1.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
<yana>

<attributes>
<attribute id="Friendly_Name" filter="String"/>
<attribute id="Brand" filter="String"/>
<attribute id="Model" filter="String"/>
<attribute id="Serial_Number" filter="String"/>
<attribute id="Management_IP" filter="IP"/>
<attribute id="Gateway" filter="IP"/>
<attribute id="Number_of_CPUs" filter="String"/>
<attribute id="RAM" filter="String"/>
<attribute id="HDD" filter="String"/>
<attribute id="Blackout_Starttime" filter="Time"/>
<attribute id="Blackout_Endtime" filter="Time"/>
<attribute id="OS_Name" filter="String"/>
<attribute id="OS_Family" filter="OS"/>
<attribute id="Hostname" filter="URL"/>

<attribute id="Version" filter="String"/>
<attribute id="License" filter="String"/>

<attribute id="Provider_Name" filter="String"/>
<attribute id="City" filter="String"/>
<attribute id="State" filter="String"/>
<attribute id="Country" filter="String"/>
<attribute id="Postal_Code" filter="String"/>
</attributes>

<nodetypes>
<nodetype id="Server">
<description>this is the server description</description>
<image>Node.png</image>
<nodeAttributes>
<nodeAttribute id="ta1" attribute="Friendly_Name" required="false"/>
<nodeAttribute id="ta2" attribute="Brand" required="false"/>
<nodeAttribute id="ta3" attribute="Model" required="false"/>
<nodeAttribute id="ta4" attribute="Serial_Number" required="false"/>
<nodeAttribute id="ta5" attribute="Management_IP" required="false"/>
<nodeAttribute id="ta6" attribute="Gateway" required="false"/>
<nodeAttribute id="ta7" attribute="Number_of_CPUs" required="false"/>
<nodeAttribute id="ta8" attribute="RAM" required="false"/>
<nodeAttribute id="ta9" attribute="HDD" required="false"/>
<nodeAttribute id="ta10" attribute="Blackout_Starttime" required="false"/>
<nodeAttribute id="ta11" attribute="Blackout_Endtime" required="false"/>
<nodeAttribute id="ta12" attribute="OS_Name" required="false"/>
<nodeAttribute id="ta13" attribute="OS_Family" required="false"/>
<nodeAttribute id="ta14" attribute="Hostname" required="false"/>
</nodeAttributes>
</nodetype>
<nodetype id="Software">
<description>This is the software description</description>
<image>Package.png</image>
<nodeAttributes>
<nodeAttribute id="ta15" attribute="Version" required="false"/>
<nodeAttribute id="ta16" attribute="License" required="false"/>
</nodeAttributes>
</nodetype>
<nodetype id="Location">
<description>This is the location description</description>
<image>Site.png</image>
<nodeAttributes>
<nodeAttribute id="ta17" attribute="Provider_Name" required="false"/>
<nodeAttribute id="ta18" attribute="City" required="false"/>
<nodeAttribute id="ta19" attribute="State" required="false"/>
<nodeAttribute id="ta20" attribute="Country" required="false"/>
<nodeAttribute id="ta21" attribute="Postal_Code" required="false"/>
</nodeAttributes>
</nodetype>
</nodetypes>

<nodes>
<node id="test.server.com" nodetype="Server" tags="server,test">
<description>This is a server</description>
<values>
<attributeValue nodeAttribute="ta1">Test_Server</attributeValue>
<attributeValue nodeAttribute="ta2">Dell</attributeValue>
<attributeValue nodeAttribute="ta3">dps-256</attributeValue>
<attributeValue nodeAttribute="ta4">12345</attributeValue>
<attributeValue nodeAttribute="ta5">127.0.0.1</attributeValue>
<attributeValue nodeAttribute="ta6">127.0.0.1</attributeValue>
<attributeValue nodeAttribute="ta7">2</attributeValue>
<attributeValue nodeAttribute="ta8">4GB</attributeValue>
<attributeValue nodeAttribute="ta9">2TB</attributeValue>
<attributeValue nodeAttribute="ta10">10am</attributeValue>
<attributeValue nodeAttribute="ta11">12pm</attributeValue>
<attributeValue nodeAttribute="ta12">Ubuntu_Test_Server</attributeValue>
<attributeValue nodeAttribute="ta13">Linux</attributeValue>
<attributeValue nodeAttribute="ta14">hostname.test.com</attributeValue>
</values>
</node>
<node id="Jetty" nodetype="Software" tags="jetty,software">
<description>This is a software attached to the server</description>
<values>
<attributeValue nodeAttribute="ta15">1.0</attributeValue>
<attributeValue nodeAttribute="ta16">1.234.56.7</attributeValue>
</values>
</node>
<node id="Main_Location" nodetype="Location" tags="location,berkeley,ca">
<description>This is a location attached to the server</description>
<values>
<attributeValue nodeAttribute="ta17">Rackspace</attributeValue>
<attributeValue nodeAttribute="ta18">Berkeley</attributeValue>
<attributeValue nodeAttribute="ta19">CA</attributeValue>
<attributeValue nodeAttribute="ta20">USA</attributeValue>
<attributeValue nodeAttribute="ta21">94703</attributeValue>
</values>
</node>
</nodes>

<nodetyperelationships>
<nodetyperelationship rolename="sofwareInstallation" parent="Server" child="Software"/>
<nodetyperelationship rolename="serverInstallation" parent="Location" child="Server"/>
</nodetyperelationships>

<noderelationships>
<noderelationship relationshipname="test.server.com_Jetty [softwareInstallation]" parent="test.server.com" child="Jetty"/>
<noderelationship relationshipname="Main_Location_test.server.com [serverInstallation]" parent="Main_Location" child="test.server.com" />
</noderelationships>

</yana>
182 changes: 182 additions & 0 deletions grails-app/conf/import/example2.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,182 @@
<yana>
<attributes>

<attribute id="controller" filter="String"/>

<!-- Package -->
<attribute id="arch" filter="String"/>
<attribute id="base" filter="String"/>
<attribute id="buildtime" filter="String"/>
<attribute id="filename" filter="String"/>
<attribute id="filetype" filter="String"/>
<attribute id="installroot" filter="String"/>
<attribute id="installrank" filter="String"/>
<attribute id="release" filter="String"/>
<attribute id="releasetag" filter="String"/>
<attribute id="repoUrl" filter="URL"/>
<attribute id="vendor" filter="String"/>
<attribute id="version" filter="String"/>

<!-- Host -->
<attribute id="hostname" filter="String"/>
<attribute id="osFamily" filter="String"/>
<attribute id="osName" filter="String"/>
<attribute id="osVersion" filter="String"/>
<attribute id="osArch" filter="String"/>
<attribute id="username" filter="String"/>
<attribute id="appname" filter="String"/>
<attribute id="environment" filter="String"/>
<attribute id="service" filter="String"/>

<!-- Service -->
<attribute id="basedir" filter="String"/>
<attribute id="startuprank" filter="String"/>
<attribute id="port" filter="String"/>
</attributes>

<nodetypes>

<nodetype id="Host">
<description>An application host</description>
<image>Node.png</image>
<nodeAttributes>
<nodeAttribute id="host.hostname" attribute="hostname" required="true"/>
<nodeAttribute id="host.osArch" attribute="arch" required="false"/>
<nodeAttribute id="host.osFamily" attribute="osFamily" required="false"/>
<nodeAttribute id="host.osName" attribute="osName" required="false"/>
<nodeAttribute id="host.osVersion" attribute="osVersion" required="false"/>
<nodeAttribute id="host.username" attribute="username" required="false"/>
<nodeAttribute id="host.port" attribute="port" required="false"/>
<nodeAttribute id="host.basedir" attribute="basedir" required="false"/>
<nodeAttribute id="host.appname" attribute="appname" required="false"/>
<nodeAttribute id="host.service" attribute="service" required="false"/>
<nodeAttribute id="host.environment" attribute="environment" required="false"/>
</nodeAttributes>

</nodetype>

<nodetype id="Package">
<description>A software package</description>
<image>Package.png</image>
<nodeAttributes>
<nodeAttribute id="package.arch" attribute="arch" required="false"/>
<nodeAttribute id="package.base" attribute="base" required="false"/>
<nodeAttribute id="package.buildtime" attribute="buildtime" required="false"/>
<nodeAttribute id="package.filename" attribute="filename" required="false"/>
<nodeAttribute id="package.filetype" attribute="filetype" required="false"/>
<nodeAttribute id="package.installroot" attribute="installroot" required="false"/>
<nodeAttribute id="package.installrank" attribute="installrank" required="false"/>
<nodeAttribute id="package.release" attribute="release" required="false"/>
<nodeAttribute id="package.releasetag" attribute="releasetag" required="false"/>
<nodeAttribute id="package.repoUrl" attribute="repoUrl" required="false"/>
<nodeAttribute id="package.vendor" attribute="vendor" required="false"/>
<nodeAttribute id="package.version" attribute="version" required="false"/>
<nodeAttribute id="package.controller" attribute="controller" required="false"/>
</nodeAttributes>
</nodetype>

<nodetype id="Service">
<description>A software service</description>
<image>Service.png</image>
<nodeAttributes>
<nodeAttribute id="service.basedir" attribute="basedir" required="false"/>
<nodeAttribute id="service.startuprank" attribute="startuprank" required="false"/>
<nodeAttribute id="service.controller" attribute="controller" required="false"/>
<nodeAttribute id="service.port" attribute="port" required="false"/>
</nodeAttributes>
</nodetype>

<nodetype id="Site">
<description>A service site</description>
<image>Site.png</image>
<nodeAttributes>
<nodeAttribute id="site.startuprank" attribute="startuprank" required="false"/>
</nodeAttributes>
</nodetype>

</nodetypes>
<!--
Host Instances
-->
<nodes>
<node id="ubuntu" nodetype="Host" tags="tomcat,simpleapp,qa">
<description>The ubuntu server</description>
<values>
<attributeValue nodeAttribute="host.hostname">ubuntu</attributeValue>
<attributeValue nodeAttribute="host.osArch">i386</attributeValue>
<attributeValue nodeAttribute="host.osFamily">unix</attributeValue>
<attributeValue nodeAttribute="host.osName">Linux</attributeValue>
<attributeValue nodeAttribute="host.osVersion">2.6.32-28-generic</attributeValue>
<attributeValue nodeAttribute="host.username">alexh</attributeValue>
<attributeValue nodeAttribute="host.port">18080</attributeValue>
<attributeValue nodeAttribute="host.basedir">/tmp/demo/tomcat</attributeValue>
<attributeValue nodeAttribute="host.appname">simpleapp</attributeValue>
<attributeValue nodeAttribute="host.service">tomcat</attributeValue>
<attributeValue nodeAttribute="host.environment">qa</attributeValue>
</values>
</node>

<node id="tomcat" nodetype="Service" tags="QA">
<description>The tomcat service</description>
<values>
<attributeValue nodeAttribute="service.basedir">/tmp/demo/tomcat</attributeValue>
<attributeValue nodeAttribute="service.startuprank">1</attributeValue>
<attributeValue nodeAttribute="service.controller">tomcat</attributeValue>
<attributeValue nodeAttribute="service.port">18080</attributeValue>
</values>
</node>

<node id="qa" nodetype="Site" tags="QA">
<description>The QA site</description>
<values>
<attributeValue nodeAttribute="site.startuprank">1</attributeValue>
</values>
</node>

<node id="apache-tomcat-5.5.31" nodetype="Package" tags="tomcat">
<description>the tomcat container</description>
<values>
<attributeValue nodeAttribute="package.arch">no-arch</attributeValue>
<attributeValue nodeAttribute="package.base">apache-tomcat-5.5.31</attributeValue>
<attributeValue nodeAttribute="package.filename">apache-tomcat-5.5.31.zip</attributeValue>
<attributeValue nodeAttribute="package.filetype">zip</attributeValue>
<attributeValue nodeAttribute="package.installroot">/tmp/demo/tomcat</attributeValue>
<attributeValue nodeAttribute="package.installrank">1</attributeValue>
<attributeValue nodeAttribute="package.repoUrl">http://localhost/simpleapp/apache-tomcat-5.5.31.zip</attributeValue>
<attributeValue nodeAttribute="package.version">5.5.31</attributeValue>
<attributeValue nodeAttribute="package.controller">zip</attributeValue>
</values>
</node>


<node id="simple-1.0.0.war" nodetype="Package" tags="tomcat">
<description>the simple webapp</description>
<values>
<attributeValue nodeAttribute="package.arch">no-arch</attributeValue>
<attributeValue nodeAttribute="package.base">simple</attributeValue>
<attributeValue nodeAttribute="package.filename">simple-1.0.0.war</attributeValue>
<attributeValue nodeAttribute="package.filetype">war</attributeValue>
<attributeValue nodeAttribute="package.installroot">/tmp/demo/tomcat/webapps</attributeValue>
<attributeValue nodeAttribute="package.installrank">1</attributeValue>
<attributeValue nodeAttribute="package.repoUrl">http://localhost/simpleapp/simple-1.0.0.war</attributeValue>
<attributeValue nodeAttribute="package.version">1.0.0</attributeValue>
<attributeValue nodeAttribute="package.controller">war</attributeValue>
</values>
</node>
</nodes>

<nodetyperelationships>
<nodetyperelationship rolename="environment" parent="Site" child="Host"/>
<nodetyperelationship rolename="service" parent="Host" child="Service"/>
<nodetyperelationship rolename="package" parent="Service" child="Package"/>
</nodetyperelationships>


<noderelationships>
<noderelationship relationshipname="QA" parent="qa" child="ubuntu"/>
<noderelationship relationshipname="server" parent="ubuntu" child="tomcat"/>
<noderelationship relationshipname="zip" parent="tomcat" child="apache-tomcat-5.5.31"/>
<noderelationship relationshipname="war" parent="tomcat" child="simple-1.0.0.war"/>
</noderelationships>

</yana>
42 changes: 42 additions & 0 deletions grails-app/conf/import/rundeck.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<!-- Sample XML to establish the minimum set of node types to support default usage of the -->
<!-- Rundeck rundeck-yana2-nodes-plugin (https://github.com/sharadr/rundeck-yana2-nodes-plugin) -->

<yana>
<attributes>
<attribute id="hostname" filter="String"/>
<attribute id="osArch" filter="String"/>
<attribute id="osFamily" filter="String"/>
<attribute id="osName" filter="String"/>
<attribute id="osVersion" filter="String"/>
<attribute id="username" filter="String"/>
</attributes>

<nodetypes>
<nodetype id="node">
<description>Rundeck node (system/server) type</description>
<image>Node.png</image>
<nodeAttributes>
<nodeAttribute id="node.hostname" attribute="hostname" required="true"/>
<nodeAttribute id="node.osArch" attribute="osArch" required="false"/>
<nodeAttribute id="node.osFamily" attribute="osFamily" required="false"/>
<nodeAttribute id="node.osName" attribute="osName" required="false"/>
<nodeAttribute id="node.osVersion" attribute="osVersion" required="false"/>
<nodeAttribute id="node.username" attribute="username" required="false"/>
</nodeAttributes>
</nodetype>
</nodetypes>

<nodes>
<node id="centos62-rundeck-tomcat" nodetype="node" tags="tag1,tag2,tag3">
<description>Sample node instance</description>
<values>
<attributeValue nodeAttribute="node.hostname">centos62-rundeck-tomcat</attributeValue>
<attributeValue nodeAttribute="node.osArch">amd64</attributeValue>
<attributeValue nodeAttribute="node.osFamily">unix</attributeValue>
<attributeValue nodeAttribute="node.osName">Linux</attributeValue>
<attributeValue nodeAttribute="node.osVersion">2.6.32-220.el6.x86_64</attributeValue>
<attributeValue nodeAttribute="node.username">tomcat</attributeValue>
</values>
</node>
</nodes>
</yana>
Loading

0 comments on commit a2cdfc1

Please sign in to comment.