setvars_linux.xsl 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!--
  3. ################################################################################
  4. # HPCC SYSTEMS software Copyright (C) 2012 HPCC Systems®.
  5. #
  6. # Licensed under the Apache License, Version 2.0 (the "License");
  7. # you may not use this file except in compliance with the License.
  8. # You may obtain a copy of the License at
  9. #
  10. # http://www.apache.org/licenses/LICENSE-2.0
  11. #
  12. # Unless required by applicable law or agreed to in writing, software
  13. # distributed under the License is distributed on an "AS IS" BASIS,
  14. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  15. # See the License for the specific language governing permissions and
  16. # limitations under the License.
  17. ################################################################################
  18. -->
  19. <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format" xml:space="default">
  20. <xsl:strip-space elements="*"/>
  21. <xsl:output method="text" media-type="text/plain" encoding="US-ASCII"/>
  22. <xsl:param name="process" select="'thor'"/>
  23. <xsl:param name="clusterType"/>
  24. <xsl:template match="text()"/>
  25. <xsl:template match="/">
  26. <xsl:apply-templates select="Environment/Software/ThorCluster[@name=$process]"/>
  27. </xsl:template>
  28. <xsl:template match="ThorCluster">
  29. <xsl:variable name="computerName" select="@computer"/>
  30. <xsl:variable name="domainName"><xsl:call-template name="getDomain"><xsl:with-param name="computer" select="@computer"/></xsl:call-template></xsl:variable>
  31. <xsl:variable name="domainNode" select="/Environment/Hardware/Domain[@name=$domainName]"/>
  32. <xsl:variable name="thoruser" select="$domainNode/@username"/>
  33. <xsl:variable name="thorpasswd" select="$domainNode/@password"/>
  34. # setvars script generated by setvars_linux.xsl
  35. #
  36. # General settings
  37. <xsl:if test="@name">
  38. export THORNAME=<xsl:value-of select="@name"/>
  39. </xsl:if>
  40. <xsl:if test="@nodeGroup">
  41. export THORPRIMARY=<xsl:value-of select="@nodeGroup"/>
  42. </xsl:if>
  43. <xsl:if test="@valgrindOptions">
  44. export valgrindOptions="<xsl:value-of select='@valgrindOptions'/>"
  45. </xsl:if>
  46. export THORMASTER=<xsl:call-template name="getNetAddress">
  47. <xsl:with-param name="computer" select="ThorMasterProcess/@computer"/>
  48. </xsl:call-template>
  49. export THORMASTERPORT=<xsl:call-template name="setOrDefault">
  50. <xsl:with-param name="attribute" select="@masterport"/>
  51. <xsl:with-param name="default" select="'20000'"/>
  52. </xsl:call-template>
  53. export THORSLAVEPORT=<xsl:call-template name="setOrDefault">
  54. <xsl:with-param name="attribute" select="@slaveport"/>
  55. <xsl:with-param name="default" select="'20100'"/>
  56. </xsl:call-template>
  57. export localthorportinc=<xsl:call-template name="setOrDefault">
  58. <xsl:with-param name="attribute" select="@localThorPortInc"/>
  59. <xsl:with-param name="default" select="'20'"/>
  60. </xsl:call-template>
  61. export slavespernode=<xsl:call-template name="setOrDefault">
  62. <xsl:with-param name="attribute" select="@slavesPerNode"/>
  63. <xsl:with-param name="default" select="'1'"/>
  64. </xsl:call-template>
  65. export channelsperslave=<xsl:call-template name="setOrDefault">
  66. <xsl:with-param name="attribute" select="@channelsPerSlave"/>
  67. <xsl:with-param name="default" select="'1'"/>
  68. </xsl:call-template>
  69. export DALISERVER=<xsl:call-template name="getDaliServers">
  70. <xsl:with-param name="daliServer" select="@daliServers"/>
  71. </xsl:call-template>
  72. export localthor=<xsl:call-template name="setOrDefault">
  73. <xsl:with-param name="attribute" select="@localThor"/>
  74. <xsl:with-param name="default" select="'false'"/>
  75. </xsl:call-template>
  76. export breakoutlimit=<xsl:call-template name="setOrDefault">
  77. <xsl:with-param name="attribute" select="Storage/@breakoutLimit"/>
  78. <xsl:with-param name="default" select="'3600'"/>
  79. </xsl:call-template>
  80. export refreshrate=<xsl:call-template name="setOrDefault">
  81. <xsl:with-param name="attribute" select="Storage/@refreshRate"/>
  82. <xsl:with-param name="default" select="'3'"/>
  83. </xsl:call-template>
  84. export autoSwapNode=<xsl:choose>
  85. <xsl:when test="SwapNode/@AutoSwapNode = 'true'">true</xsl:when>
  86. <xsl:otherwise>false</xsl:otherwise>
  87. </xsl:choose>
  88. <!-- Following SSH elements are required, being empty is fine -->
  89. export SSHidentityfile=<xsl:value-of select="SSH/@SSHidentityfile"/>
  90. export SSHusername=<xsl:value-of select="SSH/@SSHusername"/>
  91. export SSHpassword=<xsl:value-of select="SSH/@SSHpassword"/>
  92. export SSHtimeout=<xsl:value-of select="SSH/@SSHtimeout"/>
  93. export SSHretries=<xsl:value-of select="SSH/@SSHretries"/>
  94. export SSHsudomount=<xsl:value-of select="SSH/@SSHsudomount"/>
  95. </xsl:template><!--/Environment/Software/ThorCluster-->
  96. <xsl:template name="getDaliServers">
  97. <xsl:param name="daliServer"/>
  98. <xsl:for-each select="/Environment/Software/DaliServerProcess[@name=$daliServer]/Instance">
  99. <xsl:call-template name="getNetAddress">
  100. <xsl:with-param name="computer" select="@computer"/>
  101. </xsl:call-template>
  102. <xsl:if test="string(@port) != ''">:<xsl:value-of select="@port"/></xsl:if>
  103. <xsl:if test="position() != last()">, </xsl:if>
  104. </xsl:for-each>
  105. </xsl:template><!--getDaliServers-->
  106. <xsl:template name="getNetAddress">
  107. <xsl:param name="computer"/>
  108. <xsl:value-of select="/Environment/Hardware/Computer[@name=$computer]/@netAddress"/>
  109. </xsl:template><!--getNetAddress-->
  110. <xsl:template name="getDomain">
  111. <xsl:param name="computer"/>
  112. <xsl:value-of select="/Environment/Hardware/Computer[@name=$computer]/@domain"/>
  113. </xsl:template>
  114. <xsl:template name="setOrDefault">
  115. <xsl:param name="attribute"/>
  116. <xsl:param name="default"/>
  117. <xsl:choose>
  118. <xsl:when test="string($attribute) != ''">
  119. <xsl:value-of select="string($attribute)"/>
  120. </xsl:when>
  121. <xsl:otherwise>
  122. <xsl:value-of select="$default"/>
  123. </xsl:otherwise>
  124. </xsl:choose>
  125. </xsl:template>
  126. </xsl:stylesheet>