示例#1
0
    def validate(self):
        CmdBase.validate(self)

        if len(self.params) != 2:
            raise ErrorCommandFormat("Command Params Error.")
        else:
            self.__sec = int(self.params[1])
 def __init__(self):
     CmdBase.__init__(self)
     signal.signal(signal.SIGINT, self.sigTerm)
     signal.signal(signal.SIGTERM, self.sigTerm)
     if self.options.daemon and sys.platform != 'win32':
         self.becomeDaemon() 
     self.dnstries = 3
     self.forwarddnscache = {}
     self.reversednscache = {}
示例#3
0
    def validate(self):
        CmdBase.validate(self)

        if len(self.params) != 3:
            raise ErrorCommandFormat("Command Params Error.")
        else:
            if self.params[1].startswith("c", 0, 1):
                self.__subCommand = CmdSet_C(self.params, self.db)
            elif self.params[1].startswith("r", 0, 1):
                self.__subCommand = CmdSet_R(self.params, self.db)
            elif self.params[1].startswith("f", 0, 1):
                self.__subCommand = CmdSet_F(self.params, self.db)
示例#4
0
    def validate(self):
        CmdBase.validate(self)

        if len(self.params) < 2:
            raise ErrorCommandFormat("Command Params Error.")
        else :
            frmtos = str.split(self.params[1].replace('-',','),',')

            if len(frmtos) == 1:
                self.frm = frmtos[0]
                self.to = None
            elif len(frmtos) == 2:
                self.frm = frmtos[0]
                self.to = frmtos[1]
            else:
                raise ErrorCommandFormat("Command Params Error.")
 def buildOptions(self):
     CmdBase.buildOptions(self)
     self.parser.add_option('-c', '--cycle',
                 dest='cycle',
                 default=0,
                 action="store_true",
                 help="Cycle continuously on cycleInterval from zope")
     self.parser.add_option('-d', '--daemon',
                 dest='daemon',
                 default=0,
                 action="store_true",
                 help="Become a unix daemon")
     self.parser.add_option('-T', '--configtries',
                 dest='configtries',
                 default=5,
                 type='int',
                 action="store",
                 help="How many times to retry config connection")
     self.parser.add_option('-S', '--configsleep',
                 dest='configsleep',
                 default=20,
                 type='int',
                 action="store",
                 help="How long to sleep between config connections")
示例#6
0
 def buildOptions(self):
     """
     Command-line options setup
     """
     CmdBase.buildOptions(self)
     connectionFactory = getUtility(IZodbFactoryLookup).get()
     connectionFactory.buildOptions(self.parser)
     self.parser.add_option('-v', '--verbose',
                            dest="verbose",
                            default=False,
                            action='store_true',
                            help='Send progress messages to stdout.')
     self.parser.add_option('--temp-dir',
                            dest="tempDir",
                            default=None,
                            help='Directory to use for temporary storage.')
     self.parser.add_option('--dont-fetch-args',
                            dest='fetchArgs',
                            default=True,
                            action='store_false',
                            help='By default MySQL connection information'
                                 ' is retrieved from Zenoss if not'
                                 ' specified and if Zenoss is available.'
                                 ' This disables fetching of these values'
                                 ' from Zenoss.')
     self.parser.add_option('--zepdbname',
                            dest='zepdbname',
                            default='zenoss_zep',
                            help='ZEP database name.'
                                 ' By default this will be fetched from Zenoss'
                                 ' unless --dont-fetch-args is set.'),
     self.parser.add_option('--zepdbuser',
                            dest='zepdbuser',
                            default='zenoss',
                            help='ZEP database username.'
                                 ' By default this will be fetched from Zenoss'
                                 ' unless --dont-fetch-args is set.'),
     self.parser.add_option('--zepdbpass',
                            dest='zepdbpass',
                            default='zenoss',
                            help='ZEP database password.'
                                 ' By default this will be fetched from Zenoss'
                                 ' unless --dont-fetch-args is set.'),
     self.parser.add_option('--zepdbhost',
                            dest='zepdbhost',
                            default='localhost',
                            help='ZEP database server host.'
                                 ' By default this will be fetched from Zenoss'
                                 ' unless --dont-fetch-args is set.'),
     self.parser.add_option('--zepdbport',
                            dest='zepdbport',
                            default='3306',
                            help='ZEP database server port number.'
                                 ' By default this will be fetched from Zenoss'
                                 ' unless --dont-fetch-args is set.'),
     self.parser.add_option('--compress-transport',
                            dest="compressTransport",
                            default=True,
                            help='Compress transport for MySQL backup/restore.'
                                 ' True by default, set to False to disable over'
                                 ' fast links that do not benefit from compression.')
     self.parser.add_option('--enterprise-tool-path',
                            dest='enterpriseToolPath',
                            default='mysqlbackup',
                            help='Path to the enterprise tool for backup')
示例#7
0
 def __init__(self, noopts=0):
     CmdBase.__init__(self, noopts)