Example #1
0
 def __init__(self):
     self.sclsnme = self.__class__.__name__
     self.opygenericroutines = PyGenericRoutines(self.sclsnme)
     self.opygenericroutines.setupLogging()
     self.bcnfgfloprtn = self.opygenericroutines.setupConfigFlOprtn()
     self.senv = ''
     self.snodes = ''
     self.sloginuser = ''
     self.sloginpswd = ''
     self.djobs = {
         '': {
             '': '',
             '': '',
         },
     }
Example #2
0
    def __init__(self):
        '''
            Class constructor to utilize required data structurs.
        '''

        self.opygenericroutines = PyGenericRoutines(self.__class__.__name__)
        self.opygenericroutines.setupLogging()
        self.bcnfgfloprtn = self.opygenericroutines.setupConfigFlOprtn()
        self.tposargs = ('dirname',)
        self.swrkgdir    = '.'
        self.bcnfgfl     = False
        self.sclsnme     = self.__class__.__name__
        self.susage      = 'usage: %prog [options] dir1 dir2 dir3 ...'
        self.tdirs       = ()
        self.tsubdirs    = ()
        
        self.doptsargs = {
                          'dir' : {
                                   'shortopt' : '-d',
                                   'longopt'  : '--dir',
                                   'type'     : 'string',
                                   'dest'     : 'directory',
                                   'default'  : '.',
                                   'action'   : 'store',
                                   'help'     : 'set working directory',
                                  },

                          'dirs': {
                                   'shortopt' : '-p',
                                   'longopt'  : '--parents',
                                   'type'     : 'string',
                                   'dest'     : 'directories',
                                   'default'  : '',
                                   'action'   : 'store',
                                   'help'     : ('set list of directories'
                                                  + ' to be created'),
                                  },

                          'sub' : {
                                   'shortopt' : '-s',
                                   'longopt'  : '--subdirs',
                                   'type'     : 'string',
                                   'dest'     : 'subdirectories',
                                   'default'  : '',
                                   'action'   : 'store',
                                   'help'     : ('set list of'
                                                  + ' subdirectories to be'
                                                  + ' created in parents'),
                                  },

                          'configfile' : {
                                          'shortopt' : '-c',
                                          'longopt'  : '--config',
                                          'dest'     : 'configfile',
                                          'action'   : 'store_true',
                                          'help'     : ('read from config'
                                                         + ' file'),
                                         }

                         }
Example #3
0
 def __init__(self):
     self.sclsnme = self.__class__.__name__
     self.opygenericroutines = PyGenericRoutines(self.sclsnme)
     self.opygenericroutines.setupLogging()
     self.bcnfgfloprtn = self.opygenericroutines.setupConfigFlOprtn()
     self.dopts = {
         'prll': {
             'shortopt': '-p',
             'longopt': '--prll',
             'dest': 'prllflag',
             'action': 'store_true',
             'help': 'use parallel mode',
         },
     }
     self.susage = 'usage: %prog [-p|--prll|-h|--help]'
     self.bprll = False
     self.twinnds = ()
     self.senv = ''
     self.twincmds = ()
     self.suser = ''
     self.spswrd = ''
    def __init__(self):
        self.sclsnme = self.__class__.__name__	    
        self.opygenericroutines = PyGenericRoutines(self.sclsnme)
        self.opygenericroutines.setupLogging()
        self.bcnfgfloprtn = self.opygenericroutines.setupConfigFlOprtn()
        self.senv = ''	
        self.snodes = ''
        self.sloginuser = ''	
        self.sloginpswd = ''
        self.djobs = {
                      '' : {
                                                      '' : '',
						      '' : '',
						      },
                     }		      
class TriggerToolchainJobs:

    def __init__(self):
        self.sclsnme = self.__class__.__name__	    
        self.opygenericroutines = PyGenericRoutines(self.sclsnme)
        self.opygenericroutines.setupLogging()
        self.bcnfgfloprtn = self.opygenericroutines.setupConfigFlOprtn()
        self.senv = ''	
        self.snodes = ''
        self.sloginuser = ''	
        self.sloginpswd = ''
        self.djobs = {
                      '' : {
                                                      '' : '',
						      '' : '',
						      },
                     }		      

    def cacheValsFromCnfgFl(self):
        ssection = os.path.basename(sys.argv[0]).split('.')[0]
        sreturn = ''

        try:
            sreturn = self.opygenericroutines.getValFromConfigFl(\
                      ssection, 'ENV')
            if sreturn:
                self.senv = sreturn.strip()
        except Exception, e:
            serr = ('%s::cacheValsFromCnfgFl(...):\
                     getValFromConfigFile(\'LOGINPSWD\'), %s'
                     %(self.sclsnme, str(e)))
            self.opygenericroutines.prntLogErrWarnInfo(serr,\
                                                       smsgtype = 'err',\
                                                       bresume = True)
            return False

        try:
            sreturn = self.opygenericroutines.getValFromConfigFl(\
                      ssection, 'LOGINUSR')
            if sreturn:
                self.sloginusr = sreturn.strip()
        except Exception, e:
            serr = ('%s::cacheValsFromCnfgFl(...):\
                     getValFromConfigFile(\'LOGINUSR\'), %s'
                     %(self.sclsnme, str(e)))
            self.opygenericroutines.prntLogErrWarnInfo(serr,\
                                                       smsgtype = 'err',\
                                                       bresume = True)
            return False
Example #6
0
 def __init__(self):
   self.sclsnme = self.__class__.__name__	    
   self.opygenericroutines = PyGenericRoutines(self.sclsnme)
   self.opygenericroutines.setupLogging()
   self.bcnfgfloprtn = self.opygenericroutines.setupConfigFlOprtn()
   self.dopts = {
                 'prll' : {
                           'shortopt' : '-p',
                           'longopt'  : '--prll',
                           'dest'     : 'prllflag',
                           'action'   : 'store_true',
                           'help'     : 'use parallel mode',
                          },
                }
   self.susage = 'usage: %prog [-p|--prll|-h|--help]'
   self.bprll = False
   self.twinnds = ()
   self.senv = ''
   self.twincmds = ()
   self.suser = ''
   self.spswrd = ''
Example #7
0
class TriggerToolchainJobs:
    def __init__(self):
        self.sclsnme = self.__class__.__name__
        self.opygenericroutines = PyGenericRoutines(self.sclsnme)
        self.opygenericroutines.setupLogging()
        self.bcnfgfloprtn = self.opygenericroutines.setupConfigFlOprtn()
        self.senv = ''
        self.snodes = ''
        self.sloginuser = ''
        self.sloginpswd = ''
        self.djobs = {
            '': {
                '': '',
                '': '',
            },
        }

    def cacheValsFromCnfgFl(self):
        ssection = os.path.basename(sys.argv[0]).split('.')[0]
        sreturn = ''

        try:
            sreturn = self.opygenericroutines.getValFromConfigFl(\
                      ssection, 'ENV')
            if sreturn:
                self.senv = sreturn.strip()
        except Exception, e:
            serr = ('%s::cacheValsFromCnfgFl(...):\
                     getValFromConfigFile(\'LOGINPSWD\'), %s' %
                    (self.sclsnme, str(e)))
            self.opygenericroutines.prntLogErrWarnInfo(serr,\
                                                       smsgtype = 'err',\
                                                       bresume = True)
            return False

        try:
            sreturn = self.opygenericroutines.getValFromConfigFl(\
                      ssection, 'LOGINUSR')
            if sreturn:
                self.sloginusr = sreturn.strip()
        except Exception, e:
            serr = ('%s::cacheValsFromCnfgFl(...):\
                     getValFromConfigFile(\'LOGINUSR\'), %s' %
                    (self.sclsnme, str(e)))
            self.opygenericroutines.prntLogErrWarnInfo(serr,\
                                                       smsgtype = 'err',\
                                                       bresume = True)
            return False
Example #8
0
class WinRmtExec:
    def __init__(self):
        self.sclsnme = self.__class__.__name__
        self.opygenericroutines = PyGenericRoutines(self.sclsnme)
        self.opygenericroutines.setupLogging()
        self.bcnfgfloprtn = self.opygenericroutines.setupConfigFlOprtn()
        self.dopts = {
            'prll': {
                'shortopt': '-p',
                'longopt': '--prll',
                'dest': 'prllflag',
                'action': 'store_true',
                'help': 'use parallel mode',
            },
        }
        self.susage = 'usage: %prog [-p|--prll|-h|--help]'
        self.bprll = False
        self.twinnds = ()
        self.senv = ''
        self.twincmds = ()
        self.suser = ''
        self.spswrd = ''

    def parseOptsArgs(self):
        options = None
        args = None
        try:
            (options, args) = self.opygenericroutines.parseCmdLine( \
                               self.dopts, susage = self.susage)
        except Exception, e:
            serr = (self.sclsnme + '::' + 'parseOptsArgs(...)' + ':' +
                    'parseCmdLine(...)' + ', ' + str(e))
            self.opygenericroutines.prntLogErrWarnInfo(serr,
                                                       smsgtype='err',
                                                       bresume=True)
            return False

        if options.prllflag:
            self.prll = options.prllflag

        return True
Example #9
0
class WinRmtExec:

  def __init__(self):
    self.sclsnme = self.__class__.__name__	    
    self.opygenericroutines = PyGenericRoutines(self.sclsnme)
    self.opygenericroutines.setupLogging()
    self.bcnfgfloprtn = self.opygenericroutines.setupConfigFlOprtn()
    self.dopts = {
                  'prll' : {
                            'shortopt' : '-p',
                            'longopt'  : '--prll',
                            'dest'     : 'prllflag',
                            'action'   : 'store_true',
                            'help'     : 'use parallel mode',
                           },
                 }
    self.susage = 'usage: %prog [-p|--prll|-h|--help]'
    self.bprll = False
    self.twinnds = ()
    self.senv = ''
    self.twincmds = ()
    self.suser = ''
    self.spswrd = ''

  def parseOptsArgs(self):
    options = None
    args    = None
    try:
      (options, args) = self.opygenericroutines.parseCmdLine( \
                         self.dopts, susage = self.susage)
    except Exception, e:
      serr = (self.sclsnme + '::' + 'parseOptsArgs(...)' + ':'
              + 'parseCmdLine(...)' + ', ' + str(e))
      self.opygenericroutines.prntLogErrWarnInfo(serr, smsgtype = 'err', bresume = True)
      return False

    if options.prllflag:
      self.prll = options.prllflag	    

    return True
Example #10
0
class PyCreateMySpace:
    '''
        This python module provides functionality to create directories
        hierarchy to efficiently maintain one's data/work.
    '''
    
    def __init__(self):
        '''
            Class constructor to utilize required data structurs.
        '''

        self.opygenericroutines = PyGenericRoutines(self.__class__.__name__)
        self.opygenericroutines.setupLogging()
        self.bcnfgfloprtn = self.opygenericroutines.setupConfigFlOprtn()
        self.tposargs = ('dirname',)
        self.swrkgdir    = '.'
        self.bcnfgfl     = False
        self.sclsnme     = self.__class__.__name__
        self.susage      = 'usage: %prog [options] dir1 dir2 dir3 ...'
        self.tdirs       = ()
        self.tsubdirs    = ()
        
        self.doptsargs = {
                          'dir' : {
                                   'shortopt' : '-d',
                                   'longopt'  : '--dir',
                                   'type'     : 'string',
                                   'dest'     : 'directory',
                                   'default'  : '.',
                                   'action'   : 'store',
                                   'help'     : 'set working directory',
                                  },

                          'dirs': {
                                   'shortopt' : '-p',
                                   'longopt'  : '--parents',
                                   'type'     : 'string',
                                   'dest'     : 'directories',
                                   'default'  : '',
                                   'action'   : 'store',
                                   'help'     : ('set list of directories'
                                                  + ' to be created'),
                                  },

                          'sub' : {
                                   'shortopt' : '-s',
                                   'longopt'  : '--subdirs',
                                   'type'     : 'string',
                                   'dest'     : 'subdirectories',
                                   'default'  : '',
                                   'action'   : 'store',
                                   'help'     : ('set list of'
                                                  + ' subdirectories to be'
                                                  + ' created in parents'),
                                  },

                          'configfile' : {
                                          'shortopt' : '-c',
                                          'longopt'  : '--config',
                                          'dest'     : 'configfile',
                                          'action'   : 'store_true',
                                          'help'     : ('read from config'
                                                         + ' file'),
                                         }

                         }


    def parseOptsArgs(self):
        '''
            Method to parse command line options and arguments.
        '''

        options = None
        args    = None    
        try:
            (options, args) = self.opygenericroutines.parseCmdLine(\
                                  self.doptsargs, tposargs = self.tposargs,\
                                  susage = self.susage, bminposargs = False,\
                                  bexactposargs = False)
        except Exception, e:
            serr = ('%s::parseOptsArgs(...):parseCmdLine(...), %s'
                     %(self.sclsnme, str(e)))
            self.opygenericroutines.prntLogErrWarnInfo(serr,\
                                                       smsgtype = 'err',\
                                                       bresume = True)
            return False
                                 
        if options.directory:
            self.swrkgdir = options.directory

        if options.directories:
            self.tdirs = tuple(options.directories.split())

        if options.subdirectories:
            self.tsubdirs = tuple(options.subdirectories.split())

        if options.configfile:
            self.bcnfgfl = options.configfile

        return True
Example #11
0
class DumpAwsInfo():
  '''
    This class provides the functionalities to dump various AWS
    info.
  '''

  def __init__(self):
      '''
          Class constructor to initialize required data structures.
      '''
      
      self.opygenericroutines = PyGenericRoutines(self.__class__.__name__)
      self.opygenericroutines.setupLogging()
      self.bcnfgfloprtn = self.opygenericroutines.setupConfigFlOprtn()
      self.sclsnme     = self.__class__.__name__
      self.botoprfl = "default"
      self.iflag = False
      self.sflag = False
      self.kflag = False
      self.uflag = False
      self.bflag = False
      self.qflag = False
      self.rflag = False
      self.eflag = False
      self.nflag = False
      self.mflag = False
      self.trsinfo = (
                       'ClusterIdentifier',
                       'ClusterCreateTime',
                       'ClusterStatus',
                       'DBName',
                       'MasterUsername',
                       'Endpoint',
                       'NodeType',
                       'NumberOfNodes',
                       'ClusterNodes',
                       'PubliclyAccessible',
                       'VpcSecurityGroups',
                       'ElasticIpStatus',
                       #'ClusterPublicKey',
                       'ModifyStatus',
                       #'PendingModifiedValues',
                       'VpcId',
                       'ClusterVersion',
                       'AutomatedSnapshotRetentionPeriod',
                       'ClusterParameterGroups',
                       'PreferredMaintenanceWindow',
                       'HsmStatus',
                       'RestoreStatus',
                       'AllowVersionUpgrade',
                       'ClusterSubnetGroupName',
                       'ClusterSecurityGroups',
                       'AvailabilityZone',
                       'Encrypted',
                       'ClusterRevisionNumber',
                       'ClusterSnapshotCopyStatus',
                     )
      self.tsqsinfo = ( 
                        'ApproximateNumberOfMessagesNotVisible',
                        'MessageRetentionPeriod',
                        'ApproximateNumberOfMessagesDelayed',
                        'MaximumMessageSize',
                        'CreatedTimestamp',
                        'ApproximateNumberOfMessages',
                        'ReceiveMessageWaitTimeSeconds',
                        'DelaySeconds',
                        'VisibilityTimeout',
                        'LastModifiedTimestamp',
                        #'QueueArn',
                      )
      self.doptsargs = {
                         'instances' : {
                                        'shortopt' : '-i',
                                        'longopt'  : '--instances',
                                        'dest'     : 'iflag',
                                        'action'   : 'store_true',
                                        'help'     : 'show EC2/VPC instances',
                                       },
                         'securitygps' : {
                                          'shortopt' : '-s',
                                          'longopt'  : '--securitygps',
                                          'dest'     : 'sflag',
                                          'action'   : 'store_true',
                                          'help'     : 'show EC2/VPC security groups',
                                         },
                         'keypairs' : {
                                      'shortopt' : '-k',
                                      'longopt'  : '--keypairs',
                                      'dest'     : 'kflag',
                                      'action'   : 'store_true',
                                      'help'     : 'show EC2/VPC IAM keypairs',
                                     },
                         'subnets' : {
                                      'shortopt' : '-u',
                                      'longopt'  : '--subnets',
                                      'dest'     : 'uflag',
                                      'action'   : 'store_true',
                                      'help'     : 'show VPC subnets',
                                     },
                         's3buckets' : {
                                        'shortopt' : '-b',
                                        'longopt'  : '--s3buckets',
                                        'dest'     : 'bflag',
                                        'action'   : 'store_true',
                                        'help'     : 'show S3 buckets',
                                       },
                         'sqsqueues' : {
                                        'shortopt' : '-q',
                                        'longopt'  : '--sqsqueues',
                                        'dest'     : 'qflag',
                                        'action'   : 'store_true',
                                        'help'     : 'show SQS queues',
                                       },
                         'redshift' : {
                                       'shortopt' : '-r',
                                       'longopt'  : '--redshift',
                                       'dest'     : 'rflag',
                                       'action'   : 'store_true',
                                       'help'     : 'show Redshift clusters',
                                      },
                         'emrclstrs' : {
                                       'shortopt' : '-e',
                                       'longopt'  : '--emrclstrs',
                                       'dest'     : 'eflag',
                                       'action'   : 'store_true',
                                       'help'     : 'show EMR clusters',
                                      },
                         'kinesis' : {
                                       'shortopt' : '-n',
                                       'longopt'  : '--kinesis',
                                       'dest'     : 'nflag',
                                       'action'   : 'store_true',
                                       'help'     : 'show Kinesis streams',
                                     },
                         'ami'     : {
                                       'shortopt' : '-m',
                                       'longopt'  : '--ami',
                                       'dest'     : 'mflag',
                                       'action'   : 'store_true',
                                       'help'     : 'show AMIs',
                                     },
                       }

      self.susage = '''usage: %prog [-i|--instances|-s|--securitygps|-k|--keypairs|
                       -u|--subnets|-b|--s3buckets|-q|--sqsqueues|
                       -r|--redshift|-e|--emrclstrs|-n|--kinesis|
                       -m|--ami] <BotoProfileName>'''

  def parseOptsArgs(self):
    '''
      Method to parse command line options and arguments.
    '''

    options = None
    args    = None
    try:
      (options, args) = self.opygenericroutines.parseCmdLine( \
                          self.doptsargs, \
                          tposargs = tuple(self.botoprfl), \
                          susage = self.susage, \
                          bexactposargs = False)
    except Exception, e:
      serr = (self.sclsnme + '::' + 'parseOptsArgs(...)' + ':'
              + 'parseCmdLine(...)' + ', ' + str(e))
      self.opygenericroutines.prntLogErrWarnInfo(serr, bresume = True)
      return False

    if options.iflag:
      self.iflag = options.iflag

    if options.sflag:
      self.sflag = options.sflag

    if options.kflag:
      self.kflag = options.kflag

    if options.uflag:
      self.uflag = options.uflag

    if options.bflag:
      self.bflag = options.bflag

    if options.qflag:
      self.qflag = options.qflag

    if options.rflag:
      self.rflag = options.rflag

    if options.eflag:
      self.eflag = options.eflag

    if options.nflag:
      self.nflag = options.nflag

    if options.mflag:
      self.mflag = options.mflag

    if args and args[0] != self.botoprfl:
      self.botoprfl = args[0]

    return True
Example #12
0
class DumpAwsInfo():
    '''
    This class provides the functionalities to dump various AWS
    info.
  '''
    def __init__(self):
        '''
          Class constructor to initialize required data structures.
      '''

        self.opygenericroutines = PyGenericRoutines(self.__class__.__name__)
        self.opygenericroutines.setupLogging()
        self.bcnfgfloprtn = self.opygenericroutines.setupConfigFlOprtn()
        self.sclsnme = self.__class__.__name__
        self.botoprfl = "default"
        self.iflag = False
        self.sflag = False
        self.kflag = False
        self.uflag = False
        self.bflag = False
        self.qflag = False
        self.rflag = False
        self.eflag = False
        self.nflag = False
        self.mflag = False
        self.trsinfo = (
            'ClusterIdentifier',
            'ClusterCreateTime',
            'ClusterStatus',
            'DBName',
            'MasterUsername',
            'Endpoint',
            'NodeType',
            'NumberOfNodes',
            'ClusterNodes',
            'PubliclyAccessible',
            'VpcSecurityGroups',
            'ElasticIpStatus',
            #'ClusterPublicKey',
            'ModifyStatus',
            #'PendingModifiedValues',
            'VpcId',
            'ClusterVersion',
            'AutomatedSnapshotRetentionPeriod',
            'ClusterParameterGroups',
            'PreferredMaintenanceWindow',
            'HsmStatus',
            'RestoreStatus',
            'AllowVersionUpgrade',
            'ClusterSubnetGroupName',
            'ClusterSecurityGroups',
            'AvailabilityZone',
            'Encrypted',
            'ClusterRevisionNumber',
            'ClusterSnapshotCopyStatus',
        )
        self.tsqsinfo = (
            'ApproximateNumberOfMessagesNotVisible',
            'MessageRetentionPeriod',
            'ApproximateNumberOfMessagesDelayed',
            'MaximumMessageSize',
            'CreatedTimestamp',
            'ApproximateNumberOfMessages',
            'ReceiveMessageWaitTimeSeconds',
            'DelaySeconds',
            'VisibilityTimeout',
            'LastModifiedTimestamp',
            #'QueueArn',
        )
        self.doptsargs = {
            'instances': {
                'shortopt': '-i',
                'longopt': '--instances',
                'dest': 'iflag',
                'action': 'store_true',
                'help': 'show EC2/VPC instances',
            },
            'securitygps': {
                'shortopt': '-s',
                'longopt': '--securitygps',
                'dest': 'sflag',
                'action': 'store_true',
                'help': 'show EC2/VPC security groups',
            },
            'keypairs': {
                'shortopt': '-k',
                'longopt': '--keypairs',
                'dest': 'kflag',
                'action': 'store_true',
                'help': 'show EC2/VPC IAM keypairs',
            },
            'subnets': {
                'shortopt': '-u',
                'longopt': '--subnets',
                'dest': 'uflag',
                'action': 'store_true',
                'help': 'show VPC subnets',
            },
            's3buckets': {
                'shortopt': '-b',
                'longopt': '--s3buckets',
                'dest': 'bflag',
                'action': 'store_true',
                'help': 'show S3 buckets',
            },
            'sqsqueues': {
                'shortopt': '-q',
                'longopt': '--sqsqueues',
                'dest': 'qflag',
                'action': 'store_true',
                'help': 'show SQS queues',
            },
            'redshift': {
                'shortopt': '-r',
                'longopt': '--redshift',
                'dest': 'rflag',
                'action': 'store_true',
                'help': 'show Redshift clusters',
            },
            'emrclstrs': {
                'shortopt': '-e',
                'longopt': '--emrclstrs',
                'dest': 'eflag',
                'action': 'store_true',
                'help': 'show EMR clusters',
            },
            'kinesis': {
                'shortopt': '-n',
                'longopt': '--kinesis',
                'dest': 'nflag',
                'action': 'store_true',
                'help': 'show Kinesis streams',
            },
            'ami': {
                'shortopt': '-m',
                'longopt': '--ami',
                'dest': 'mflag',
                'action': 'store_true',
                'help': 'show AMIs',
            },
        }

        self.susage = '''usage: %prog [-i|--instances|-s|--securitygps|-k|--keypairs|
                       -u|--subnets|-b|--s3buckets|-q|--sqsqueues|
                       -r|--redshift|-e|--emrclstrs|-n|--kinesis|
                       -m|--ami] <BotoProfileName>'''

    def parseOptsArgs(self):
        '''
      Method to parse command line options and arguments.
    '''

        options = None
        args = None
        try:
            (options, args) = self.opygenericroutines.parseCmdLine( \
                                self.doptsargs, \
                                tposargs = tuple(self.botoprfl), \
                                susage = self.susage, \
                                bexactposargs = False)
        except Exception, e:
            serr = (self.sclsnme + '::' + 'parseOptsArgs(...)' + ':' +
                    'parseCmdLine(...)' + ', ' + str(e))
            self.opygenericroutines.prntLogErrWarnInfo(serr, bresume=True)
            return False

        if options.iflag:
            self.iflag = options.iflag

        if options.sflag:
            self.sflag = options.sflag

        if options.kflag:
            self.kflag = options.kflag

        if options.uflag:
            self.uflag = options.uflag

        if options.bflag:
            self.bflag = options.bflag

        if options.qflag:
            self.qflag = options.qflag

        if options.rflag:
            self.rflag = options.rflag

        if options.eflag:
            self.eflag = options.eflag

        if options.nflag:
            self.nflag = options.nflag

        if options.mflag:
            self.mflag = options.mflag

        if args and args[0] != self.botoprfl:
            self.botoprfl = args[0]

        return True
Example #13
0
    def __init__(self):
        '''
          Class constructor to initialize required data structures.
      '''

        self.opygenericroutines = PyGenericRoutines(self.__class__.__name__)
        self.opygenericroutines.setupLogging()
        self.bcnfgfloprtn = self.opygenericroutines.setupConfigFlOprtn()
        self.sclsnme = self.__class__.__name__
        self.botoprfl = "default"
        self.iflag = False
        self.sflag = False
        self.kflag = False
        self.uflag = False
        self.bflag = False
        self.qflag = False
        self.rflag = False
        self.eflag = False
        self.nflag = False
        self.mflag = False
        self.trsinfo = (
            'ClusterIdentifier',
            'ClusterCreateTime',
            'ClusterStatus',
            'DBName',
            'MasterUsername',
            'Endpoint',
            'NodeType',
            'NumberOfNodes',
            'ClusterNodes',
            'PubliclyAccessible',
            'VpcSecurityGroups',
            'ElasticIpStatus',
            #'ClusterPublicKey',
            'ModifyStatus',
            #'PendingModifiedValues',
            'VpcId',
            'ClusterVersion',
            'AutomatedSnapshotRetentionPeriod',
            'ClusterParameterGroups',
            'PreferredMaintenanceWindow',
            'HsmStatus',
            'RestoreStatus',
            'AllowVersionUpgrade',
            'ClusterSubnetGroupName',
            'ClusterSecurityGroups',
            'AvailabilityZone',
            'Encrypted',
            'ClusterRevisionNumber',
            'ClusterSnapshotCopyStatus',
        )
        self.tsqsinfo = (
            'ApproximateNumberOfMessagesNotVisible',
            'MessageRetentionPeriod',
            'ApproximateNumberOfMessagesDelayed',
            'MaximumMessageSize',
            'CreatedTimestamp',
            'ApproximateNumberOfMessages',
            'ReceiveMessageWaitTimeSeconds',
            'DelaySeconds',
            'VisibilityTimeout',
            'LastModifiedTimestamp',
            #'QueueArn',
        )
        self.doptsargs = {
            'instances': {
                'shortopt': '-i',
                'longopt': '--instances',
                'dest': 'iflag',
                'action': 'store_true',
                'help': 'show EC2/VPC instances',
            },
            'securitygps': {
                'shortopt': '-s',
                'longopt': '--securitygps',
                'dest': 'sflag',
                'action': 'store_true',
                'help': 'show EC2/VPC security groups',
            },
            'keypairs': {
                'shortopt': '-k',
                'longopt': '--keypairs',
                'dest': 'kflag',
                'action': 'store_true',
                'help': 'show EC2/VPC IAM keypairs',
            },
            'subnets': {
                'shortopt': '-u',
                'longopt': '--subnets',
                'dest': 'uflag',
                'action': 'store_true',
                'help': 'show VPC subnets',
            },
            's3buckets': {
                'shortopt': '-b',
                'longopt': '--s3buckets',
                'dest': 'bflag',
                'action': 'store_true',
                'help': 'show S3 buckets',
            },
            'sqsqueues': {
                'shortopt': '-q',
                'longopt': '--sqsqueues',
                'dest': 'qflag',
                'action': 'store_true',
                'help': 'show SQS queues',
            },
            'redshift': {
                'shortopt': '-r',
                'longopt': '--redshift',
                'dest': 'rflag',
                'action': 'store_true',
                'help': 'show Redshift clusters',
            },
            'emrclstrs': {
                'shortopt': '-e',
                'longopt': '--emrclstrs',
                'dest': 'eflag',
                'action': 'store_true',
                'help': 'show EMR clusters',
            },
            'kinesis': {
                'shortopt': '-n',
                'longopt': '--kinesis',
                'dest': 'nflag',
                'action': 'store_true',
                'help': 'show Kinesis streams',
            },
            'ami': {
                'shortopt': '-m',
                'longopt': '--ami',
                'dest': 'mflag',
                'action': 'store_true',
                'help': 'show AMIs',
            },
        }

        self.susage = '''usage: %prog [-i|--instances|-s|--securitygps|-k|--keypairs|
Example #14
0
class PyCopyPaste:
    '''
        This class provides some of the functionality similar to sed and
        awk in Pythonic and Portable way.
    '''
    
    def __init__(self):
        '''
            Class constructor to initialize required data structures.
        '''

        self.__sclsnme = self.__class__.__name__
        self.__opygenericroutines = PyGenericRoutines(self.__sclsnme)
        self.__opygenericroutines.setupLogging()
        self.__bcnfgfloprtn = self.__opygenericroutines.setupConfigFlOprtn()
        self.__doptsargs = {
                            'srcdir' : {
                                         'shortopt' : '-s',
                                         'longopt'  : '--srcdir',
                                         'type'     : 'string',
                                         'dest'     : 'srcdir',
                                         'default'  : '.',
                                         'action'   : 'store',
                                         'help'     : 'sets source directory',
                                        },
                            'trgtdir' : {
                                         'shortopt' : '-t',
                                         'longopt'  : '--trgtdir',
                                         'type'     : 'string',
                                         'dest'     : 'trgtdir',
                                         'default'  : '.',
                                         'action'   : 'store',
                                         'help'     : 'sets target directory',
                                        },
                            'append'  : {
                                         'shortopt' : '-a',
                                         'longopt'  : '--append',
                                         'dest'     : 'appendflag',
                                         'action'   : 'store_true',
                                         'help'     : 'append from source',
                                        },
                            'insert'  : {
                                         'shortopt' : '-i',
                                         'longopt'  : '--insert',
                                         'dest'     : 'insertflag',
                                         'action'   : 'store_true',
                                         'help'     : 'insert from source',
                                        },
                            'confgfle': {
                                          'shortopt': '-c',
                                          'longopt' : '--config',
                                          'dest'    : 'configfile',
                                          'action'  : 'store_true',
                                          'help'    : 'read from config file',
                                        },   
                           'strtendsrc':{
                                         'shortopt' : '-f',
                                         'longopt'  : '--strtendsrc',
                                         'type'     : 'int',
                                         'dest'     : 'strtendsrc',
                                         'nargs'    : 2,
                                         'action'   : 'store',
                                         'help'     : 'start & end lines from source',
                                        },
                          'strttrgt':{
                                         'shortopt' : '-d',
                                         'longopt'  : '--strttrgt',
                                         'type'     : 'int',
                                         'dest'     : 'strttrgt',
                                         'default'  : 1,
                                         'action'   : 'store',
                                         'help'     : 'start line for target',                                    },
                           }

  
        self.__susage = 'usage: %prog [options] sourcefile -f startlinenum endlinenum targetfile -d startlinenum -i|-a'

        self.__ssrcdir  = '.'
        self.__strgtdir = '.'
        self.__ssrcfle  = ''
        self.__strgtfle = ''
        self.__ssrcflewpth = ''
        self.__strgtflewpth = ''

        self.__dstlnnum = {
                           'source' : {
                                       'start' : 1,
                                       'end'   : 1,
                                      },
                           'target' : {
                                       'start' : 1,
                                      },
                          }
        self.__bappend = False
        self.__binsert = False
        self.__tposargs= ('sourcefile', 'trgtfile',)

        self.__osrcfile = None
        self.__lsrcfile = []
        self.__nsrclnes = 0
        self.__otrgtfile = None
        self.__ltrgtfile = []
        self.__ntrgtlnes = 0
        self.__ldsrdlnes = []              

                          
    def parseOptsArgs(self):
        '''
            Method to parse command line options and arguments.
        '''

        options = None
        args    = None
        try:
            (options, args) = self.__opygenericroutines.parseCmdLine(      \
                              self.__doptsargs, tposargs = self.__tposargs,\
                              susage = self.__susage)                                                               
        except Exception, e:
            serr = ("%s::parseOptsArgs(...):parseCmdLine(...), %s"
                     %(self.__sclsnme, str(e)))
            self.__opygenericroutines.prntLogErrWarnInfo(serr, smsgtype = 'err', bresume = True)
            return False

        if options.srcdir:
            self.__ssrcdir = options.srcdir

        if options.trgtdir:
            self.__strgtdir = options.trgtdir

        if options.appendflag:
            self.__bappend = options.appendflag
        
        if options.insertflag:
            self.__binsert = options.insertflag

        if options.strtendsrc:
            self.__dstlnnum['source']['start'] = min(options.strtendsrc)
            self.__dstlnnum['source']['end']   = max(options.strtendsrc)

        if options.strttrgt:
            self.__dstlnnum['target']['start'] = options.strttrgt

        self.__tposargs = tuple(args)

        return True
Example #15
0
    def __init__(self):
        '''
            Class constructor to initialize required data structures.
        '''

        self.__sclsnme = self.__class__.__name__
        self.__opygenericroutines = PyGenericRoutines(self.__sclsnme)
        self.__opygenericroutines.setupLogging()
        self.__bcnfgfloprtn = self.__opygenericroutines.setupConfigFlOprtn()
        self.__doptsargs = {
                            'srcdir' : {
                                         'shortopt' : '-s',
                                         'longopt'  : '--srcdir',
                                         'type'     : 'string',
                                         'dest'     : 'srcdir',
                                         'default'  : '.',
                                         'action'   : 'store',
                                         'help'     : 'sets source directory',
                                        },
                            'trgtdir' : {
                                         'shortopt' : '-t',
                                         'longopt'  : '--trgtdir',
                                         'type'     : 'string',
                                         'dest'     : 'trgtdir',
                                         'default'  : '.',
                                         'action'   : 'store',
                                         'help'     : 'sets target directory',
                                        },
                            'append'  : {
                                         'shortopt' : '-a',
                                         'longopt'  : '--append',
                                         'dest'     : 'appendflag',
                                         'action'   : 'store_true',
                                         'help'     : 'append from source',
                                        },
                            'insert'  : {
                                         'shortopt' : '-i',
                                         'longopt'  : '--insert',
                                         'dest'     : 'insertflag',
                                         'action'   : 'store_true',
                                         'help'     : 'insert from source',
                                        },
                            'confgfle': {
                                          'shortopt': '-c',
                                          'longopt' : '--config',
                                          'dest'    : 'configfile',
                                          'action'  : 'store_true',
                                          'help'    : 'read from config file',
                                        },   
                           'strtendsrc':{
                                         'shortopt' : '-f',
                                         'longopt'  : '--strtendsrc',
                                         'type'     : 'int',
                                         'dest'     : 'strtendsrc',
                                         'nargs'    : 2,
                                         'action'   : 'store',
                                         'help'     : 'start & end lines from source',
                                        },
                          'strttrgt':{
                                         'shortopt' : '-d',
                                         'longopt'  : '--strttrgt',
                                         'type'     : 'int',
                                         'dest'     : 'strttrgt',
                                         'default'  : 1,
                                         'action'   : 'store',
                                         'help'     : 'start line for target',                                    },
                           }

  
        self.__susage = 'usage: %prog [options] sourcefile -f startlinenum endlinenum targetfile -d startlinenum -i|-a'

        self.__ssrcdir  = '.'
        self.__strgtdir = '.'
        self.__ssrcfle  = ''
        self.__strgtfle = ''
        self.__ssrcflewpth = ''
        self.__strgtflewpth = ''

        self.__dstlnnum = {
                           'source' : {
                                       'start' : 1,
                                       'end'   : 1,
                                      },
                           'target' : {
                                       'start' : 1,
                                      },
                          }
        self.__bappend = False
        self.__binsert = False
        self.__tposargs= ('sourcefile', 'trgtfile',)

        self.__osrcfile = None
        self.__lsrcfile = []
        self.__nsrclnes = 0
        self.__otrgtfile = None
        self.__ltrgtfile = []
        self.__ntrgtlnes = 0
        self.__ldsrdlnes = []              
Example #16
0
  def __init__(self):
      '''
          Class constructor to initialize required data structures.
      '''
      
      self.opygenericroutines = PyGenericRoutines(self.__class__.__name__)
      self.opygenericroutines.setupLogging()
      self.bcnfgfloprtn = self.opygenericroutines.setupConfigFlOprtn()
      self.sclsnme     = self.__class__.__name__
      self.cflag = False
      self.rflag = False
      self.dflag = False
      self.lnewinstnc = []
      self.lremoveids = []
      self.lrebootids = []
      self.lstopids = []
      self.lkeypairs = []
      self.lservices = []
      self.limages = []
      self.lbuckets = []
      self.lactions = []
      self.dvldactns = {
                         'instances': (
                                        'create',
                                        'remove',
                                        'reboot',
                                        'stop',
                                        'start',
                                      ),
                         'keypairs': (
                                       'create',
                                       'remove',
                                     ),
                         'buckets': (
                                      'create',
                                      'remove',
                                    ),
                         'services': (
                                       'create',
                                       'remove',
                                     ),
                       }
      self.doptsargs = {
                         'create' : {
                                      'shortopt' : '-c',
                                      'longopt'  : '--create',
                                      'dest'     : 'cflag',
                                      'action'   : 'store_true',
                                      'help'     : 'Create AWS resources',
                                    },
                         'remove' : {
                                      'shortopt' : '-r',
                                      'longopt'  : '--remove',
                                      'dest'     : 'rflag',
                                      'action'   : 'store_true',
                                      'help'     : 'Delete AWS resources',
                                    },
                         'dryrun' : {
                                      'shortopt' : '-d',
                                      'longopt'  : '--dryrun',
                                      'dest'     : 'dflag',
                                      'action'   : 'store_true',
                                      'help'     : 'Dryrun AWS resources',
                                    },
                       }

      self.susage = 'usage: %prog [-c|--create|-r|--remove|-d|--dryrun|-h|--help]'
Example #17
0
class CreateAwsStuff():
  '''
    This class provides the functionalities to create/remove various
    AWS resources.
  '''

  def __init__(self):
      '''
          Class constructor to initialize required data structures.
      '''
      
      self.opygenericroutines = PyGenericRoutines(self.__class__.__name__)
      self.opygenericroutines.setupLogging()
      self.bcnfgfloprtn = self.opygenericroutines.setupConfigFlOprtn()
      self.sclsnme     = self.__class__.__name__
      self.cflag = False
      self.rflag = False
      self.dflag = False
      self.lnewinstnc = []
      self.lremoveids = []
      self.lrebootids = []
      self.lstopids = []
      self.lkeypairs = []
      self.lservices = []
      self.limages = []
      self.lbuckets = []
      self.lactions = []
      self.dvldactns = {
                         'instances': (
                                        'create',
                                        'remove',
                                        'reboot',
                                        'stop',
                                        'start',
                                      ),
                         'keypairs': (
                                       'create',
                                       'remove',
                                     ),
                         'buckets': (
                                      'create',
                                      'remove',
                                    ),
                         'services': (
                                       'create',
                                       'remove',
                                     ),
                       }
      self.doptsargs = {
                         'create' : {
                                      'shortopt' : '-c',
                                      'longopt'  : '--create',
                                      'dest'     : 'cflag',
                                      'action'   : 'store_true',
                                      'help'     : 'Create AWS resources',
                                    },
                         'remove' : {
                                      'shortopt' : '-r',
                                      'longopt'  : '--remove',
                                      'dest'     : 'rflag',
                                      'action'   : 'store_true',
                                      'help'     : 'Delete AWS resources',
                                    },
                         'dryrun' : {
                                      'shortopt' : '-d',
                                      'longopt'  : '--dryrun',
                                      'dest'     : 'dflag',
                                      'action'   : 'store_true',
                                      'help'     : 'Dryrun AWS resources',
                                    },
                       }

      self.susage = 'usage: %prog [-c|--create|-r|--remove|-d|--dryrun|-h|--help]'

  def parseOptsArgs(self):
    '''
      Method to parse command line options and arguments.
    '''

    options = None
    args    = None
    try:
      (options, args) = self.opygenericroutines.parseCmdLine( \
                          self.doptsargs, \
                          susage = self.susage, \
                          bexactposargs = False)
    except Exception, e:
      serr = (self.sclsnme + '::' + 'parseOptsArgs(...)' + ':'
              + 'parseCmdLine(...)' + ', ' + str(e))
      self.opygenericroutines.prntLogErrWarnInfo(serr, bresume = True)
      return False

    if options.cflag:
      self.cflag = options.cflag

    if options.rflag:
      self.rflag = options.rflag

    if options.dflag:
      self.dflag = options.dflag

    return True
Example #18
0
  def __init__(self):
      '''
          Class constructor to initialize required data structures.
      '''
      
      self.opygenericroutines = PyGenericRoutines(self.__class__.__name__)
      self.opygenericroutines.setupLogging()
      self.bcnfgfloprtn = self.opygenericroutines.setupConfigFlOprtn()
      self.sclsnme     = self.__class__.__name__
      self.botoprfl = "default"
      self.iflag = False
      self.sflag = False
      self.kflag = False
      self.uflag = False
      self.bflag = False
      self.qflag = False
      self.rflag = False
      self.eflag = False
      self.nflag = False
      self.mflag = False
      self.trsinfo = (
                       'ClusterIdentifier',
                       'ClusterCreateTime',
                       'ClusterStatus',
                       'DBName',
                       'MasterUsername',
                       'Endpoint',
                       'NodeType',
                       'NumberOfNodes',
                       'ClusterNodes',
                       'PubliclyAccessible',
                       'VpcSecurityGroups',
                       'ElasticIpStatus',
                       #'ClusterPublicKey',
                       'ModifyStatus',
                       #'PendingModifiedValues',
                       'VpcId',
                       'ClusterVersion',
                       'AutomatedSnapshotRetentionPeriod',
                       'ClusterParameterGroups',
                       'PreferredMaintenanceWindow',
                       'HsmStatus',
                       'RestoreStatus',
                       'AllowVersionUpgrade',
                       'ClusterSubnetGroupName',
                       'ClusterSecurityGroups',
                       'AvailabilityZone',
                       'Encrypted',
                       'ClusterRevisionNumber',
                       'ClusterSnapshotCopyStatus',
                     )
      self.tsqsinfo = ( 
                        'ApproximateNumberOfMessagesNotVisible',
                        'MessageRetentionPeriod',
                        'ApproximateNumberOfMessagesDelayed',
                        'MaximumMessageSize',
                        'CreatedTimestamp',
                        'ApproximateNumberOfMessages',
                        'ReceiveMessageWaitTimeSeconds',
                        'DelaySeconds',
                        'VisibilityTimeout',
                        'LastModifiedTimestamp',
                        #'QueueArn',
                      )
      self.doptsargs = {
                         'instances' : {
                                        'shortopt' : '-i',
                                        'longopt'  : '--instances',
                                        'dest'     : 'iflag',
                                        'action'   : 'store_true',
                                        'help'     : 'show EC2/VPC instances',
                                       },
                         'securitygps' : {
                                          'shortopt' : '-s',
                                          'longopt'  : '--securitygps',
                                          'dest'     : 'sflag',
                                          'action'   : 'store_true',
                                          'help'     : 'show EC2/VPC security groups',
                                         },
                         'keypairs' : {
                                      'shortopt' : '-k',
                                      'longopt'  : '--keypairs',
                                      'dest'     : 'kflag',
                                      'action'   : 'store_true',
                                      'help'     : 'show EC2/VPC IAM keypairs',
                                     },
                         'subnets' : {
                                      'shortopt' : '-u',
                                      'longopt'  : '--subnets',
                                      'dest'     : 'uflag',
                                      'action'   : 'store_true',
                                      'help'     : 'show VPC subnets',
                                     },
                         's3buckets' : {
                                        'shortopt' : '-b',
                                        'longopt'  : '--s3buckets',
                                        'dest'     : 'bflag',
                                        'action'   : 'store_true',
                                        'help'     : 'show S3 buckets',
                                       },
                         'sqsqueues' : {
                                        'shortopt' : '-q',
                                        'longopt'  : '--sqsqueues',
                                        'dest'     : 'qflag',
                                        'action'   : 'store_true',
                                        'help'     : 'show SQS queues',
                                       },
                         'redshift' : {
                                       'shortopt' : '-r',
                                       'longopt'  : '--redshift',
                                       'dest'     : 'rflag',
                                       'action'   : 'store_true',
                                       'help'     : 'show Redshift clusters',
                                      },
                         'emrclstrs' : {
                                       'shortopt' : '-e',
                                       'longopt'  : '--emrclstrs',
                                       'dest'     : 'eflag',
                                       'action'   : 'store_true',
                                       'help'     : 'show EMR clusters',
                                      },
                         'kinesis' : {
                                       'shortopt' : '-n',
                                       'longopt'  : '--kinesis',
                                       'dest'     : 'nflag',
                                       'action'   : 'store_true',
                                       'help'     : 'show Kinesis streams',
                                     },
                         'ami'     : {
                                       'shortopt' : '-m',
                                       'longopt'  : '--ami',
                                       'dest'     : 'mflag',
                                       'action'   : 'store_true',
                                       'help'     : 'show AMIs',
                                     },
                       }

      self.susage = '''usage: %prog [-i|--instances|-s|--securitygps|-k|--keypairs|
Example #19
0
    def __init__(self):
        '''
            Class constructor to initialize required data structures.
        '''
        
        self.opygenericroutines = PyGenericRoutines(self.__class__.__name__)
        self.opygenericroutines.setupLogging()
        self.bcnfgfloprtn = self.opygenericroutines.setupConfigFlOprtn()
        self.tposargs    = ('filename.ext',)
        self.tvldfls     = ()
        self.sflextn     = ''
        self.swrkgdir    = '.'
        self.bapnd       = False
        self.bcnfgfl     = False
        self.sflnme      = ''
        self.sclsnme     = self.__class__.__name__
        self.sathrnme    = os.getenv('USERNAME')
        self.sdwnldlnk   = 'http://www.%s.com' %(socket.gethostname())
        self.slcnsnme    = 'GNU GPL v3 http://www.gnu.org/licenses/gpl.html'
        self.sversion    = 'major.minor.release'
        self.dcmntsymnum = {
                            ('c', 'h', 'cpp', 'hpp', 'java',) : {
                                                                 'symbol' : '//',
                                                                 'count'  : 38,
                                                                },
                            ('py', 'pl', 'rb', 'sh', 'php', 'mak',) : {
                                                                       'symbol' : '#',
                                                                       'count'  : 76,
                                                                      },
                            ('lua', 'sql',) : {
                                               'symbol' : '--',
                                               'count'  : 38,
                                              }
                           }
        self.doptsargs = {
                           'dir' : {
                                    'shortopt' : '-d',
                                    'longopt'  : '--dir',
                                    'type'     : 'string',
                                    'dest'     : 'directory',
                                    'default'  : '.',
                                    'action'   : 'store',
                                    'help'     : 'sets working directory',
                                   },
                            
                           'append' : {
                                       'shortopt' : '-a',
                                       'longopt'  : '--append',
                                       'dest'     : 'appendflag',
                                       'action'   : 'store_true',
                                       'help'     : 'append info header',
                                      },

                           'configfile' : {
                                           'shortopt' : '-c',
                                           'longopt'  : '--config',
                                           'dest'     : 'configfile',
                                           'action'   : 'store_true',
                                           'help'     : 'read from config file'
                                          }
                            
                         }

        self.susage = 'usage: %prog [options] filename1.ext1 filename2.ext2 ...'
        self.thdrttls = (
                         'File name',
                         'Purpose',
                         'Usages',
                         'Start date',
                         'End date',
                         'Author',
                         'Download link',
                         'License',
                         'Version',
                         'Modification history',
                        )
        self.dintrprtrs = {
                           'py' : 'python',
                           'pl' : 'perl',
                           'sh' : 'bash',
                           'rb' : 'ruby',
                           'lua': 'lua',
                          }
        self.senvpath   = '#! /usr/bin/env' 
Example #20
0
class PyCreateFlsWthdr():

    '''
        This class provides the functionalities to create/append the
        info headers and then generate various kinds of source/header files.
    '''

    def __init__(self):
        '''
            Class constructor to initialize required data structures.
        '''
        
        self.opygenericroutines = PyGenericRoutines(self.__class__.__name__)
        self.opygenericroutines.setupLogging()
        self.bcnfgfloprtn = self.opygenericroutines.setupConfigFlOprtn()
        self.tposargs    = ('filename.ext',)
        self.tvldfls     = ()
        self.sflextn     = ''
        self.swrkgdir    = '.'
        self.bapnd       = False
        self.bcnfgfl     = False
        self.sflnme      = ''
        self.sclsnme     = self.__class__.__name__
        self.sathrnme    = os.getenv('USERNAME')
        self.sdwnldlnk   = 'http://www.%s.com' %(socket.gethostname())
        self.slcnsnme    = 'GNU GPL v3 http://www.gnu.org/licenses/gpl.html'
        self.sversion    = 'major.minor.release'
        self.dcmntsymnum = {
                            ('c', 'h', 'cpp', 'hpp', 'java',) : {
                                                                 'symbol' : '//',
                                                                 'count'  : 38,
                                                                },
                            ('py', 'pl', 'rb', 'sh', 'php', 'mak',) : {
                                                                       'symbol' : '#',
                                                                       'count'  : 76,
                                                                      },
                            ('lua', 'sql',) : {
                                               'symbol' : '--',
                                               'count'  : 38,
                                              }
                           }
        self.doptsargs = {
                           'dir' : {
                                    'shortopt' : '-d',
                                    'longopt'  : '--dir',
                                    'type'     : 'string',
                                    'dest'     : 'directory',
                                    'default'  : '.',
                                    'action'   : 'store',
                                    'help'     : 'sets working directory',
                                   },
                            
                           'append' : {
                                       'shortopt' : '-a',
                                       'longopt'  : '--append',
                                       'dest'     : 'appendflag',
                                       'action'   : 'store_true',
                                       'help'     : 'append info header',
                                      },

                           'configfile' : {
                                           'shortopt' : '-c',
                                           'longopt'  : '--config',
                                           'dest'     : 'configfile',
                                           'action'   : 'store_true',
                                           'help'     : 'read from config file'
                                          }
                            
                         }

        self.susage = 'usage: %prog [options] filename1.ext1 filename2.ext2 ...'
        self.thdrttls = (
                         'File name',
                         'Purpose',
                         'Usages',
                         'Start date',
                         'End date',
                         'Author',
                         'Download link',
                         'License',
                         'Version',
                         'Modification history',
                        )
        self.dintrprtrs = {
                           'py' : 'python',
                           'pl' : 'perl',
                           'sh' : 'bash',
                           'rb' : 'ruby',
                           'lua': 'lua',
                          }
        self.senvpath   = '#! /usr/bin/env' 
 

    def parseOptsArgs(self):
        '''
            Method to parse command line options and arguments.
        '''

        options = None
        args    = None
        try:
            (options, args) = self.opygenericroutines.parseCmdLine(         \
                                  self.doptsargs, tposargs = self.tposargs ,\
                                  susage = self.susage, bminposargs = True, \
                                  bexactposargs = False)
        except Exception, e:
            serr = (self.sclsnme + '::' + 'parseOptsArgs(...)' + ':'
                    + 'parseCmdLine(...)' + ', ' + str(e))
            self.opygenericroutines.prntLogErrWarnInfo(serr, smsgtype = 'err', bresume = True)
            return False

        if options.directory:
            self.swrkgdir = options.directory

        if options.appendflag:
            self.bapnd = options.appendflag

        if options.configfile:
            self.bcnfgfl = options.configfile

        self.tposargs = tuple(args)
        
        return True