###
# Licensed Materials - Property of IBM* and/or HCL**
# (c) Copyright IBM Corporation 2017. All Rights Reserved.
# (c) Copyright HCL Technologies Ltd. 2018. All Rights Reserved.
#
# U.S. Government Users Restricted Rights - Use, duplication or disclosure restricted by
# GSA ADP Schedule Contract with IBM Corp.
#
# * Trademark of International Business Machines
# ** Trademark of HCL Technologies Limited
#
# Filename: listNodesOnCluster.jython
#
#
###

import sys

clusterName = sys.argv[0]

clusterID = AdminConfig.getid('/ServerCluster:'+str(clusterName)+'/')
if not clusterID:
    raise "Cluster %s does not exist" %clusterName
clusterList = AdminConfig.list('ClusterMember', clusterID)

if(clusterList):
    nodeMembers = clusterList.split('\n')
    nodeMembers = [str(AdminConfig.showAttribute(item, 'nodeName')) for item in nodeMembers]

    noDupList = []
    for item in nodeMembers:
        if item not in noDupList:
            noDupList.append(item)
    for nodeMember in noDupList:
        sys.stdout.write("Node:" + nodeMember + '\n')