Jython script for creating a WAS VH

ceVHName = ‘ce_wss_host’
ceVHPort = ‘10001’
# the ceVHhostname would change for each environment. currently going for *, uncomment the one to suite the environment
ceVHhostname = ‘abc.prod.com’

cName = AdminConfig.list(‘Cell’)
cellName = AdminConfig.showAttribute(cName,”name”)
cellConfigID = AdminConfig.getid(‘/Cell:’+cellName+’/’)

ceVHExist = AdminConfig.getid(‘/Cell:’ + cellName + ‘/VirtualHost:’ + ceVHName + ‘/’)

if (ceVHExist == ” ):
AdminConfig.create(‘VirtualHost’, cellConfigID, ‘[[name “‘ + ceVHName + ‘”]]’)
AdminConfig.create(‘HostAlias’, AdminConfig.getid(‘/Cell:’ + cellName + ‘/VirtualHost:”‘ + ceVHName + ‘”/’), ‘[[hostname “‘ + ceVHhostname + ‘”] [port “‘ + ceVHPort + ‘”]]’)
else:
print ‘entry already exists, exiting without doing anything..’
#end if
AdminConfig.save()

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s