#coding:utf-8

import sunhpc
class Plugin(sunhpc.commands.Plugin):
    """
    Configure the sunhpc cluster security.
    """
    def run(self, args):

        with open('/opt/sunhpc/etc/safeputrc', 'w') as fe:
            fe.write('<?xml version="1.0" standalone="yes"?>\n')
            fe.write('<safeput>\n')
            fe.write('\t<PrivateNetwork id="%s" mask="%s"/>\n' % (
                    self.db.getHostAttr('localhost', 'Kickstart_PrivateAddress'), 
                    self.db.getHostAttr('localhost', 'Kickstart_PrivateNetmaskCIDR')))
            fe.write('</safeput>\n')

RollName = "base"
