def checkOptions(self):
        if not self.vmIds:
            self.parser.error('Missing vm-id')

        AuthnCommand.checkCloudEndpointOptionsOnly(self)
        PortTranslationCommand.checkCommonOptions(self)
        self._checkPrivateKeyFile()

        super(MainProgram, self).checkOptions()
    def parse(self):
        defaultOptions = self._setDefaultOptions()

        self.parser.usage = '%prog [options] vm-id'
        self.parser.description = '''
Connects to the given virtual machine via SSH.  Automatically retries
the connection on failures. The vm-id argument is the virtual machine
identifier.
'''

        self.parser.add_option('-k', '--key', dest='userPrivateKeyFile',
                               help='SSH private key file to log on the machine. Default %s.' % defaultOptions[
                                   'userPrivateKeyFile'],
                               metavar='FILE',
                               default=defaultOptions['userPrivateKeyFile'])

        PortTranslationCommand.addCommonOptions(self.parser)
        AuthnCommand.addCloudEndpointOptions(self.parser)

        super(MainProgram, self).parse()

        self.options, self.vmIds = self.parser.parse_args()
    def parse(self):

        self.parser.usage = '%prog [options] [vm-id ...]'

        self.parser.description = '''
Provides information about the virtual machine with the given
identifiers or all virtual machine if no identifier is given.  The
vm-id arguments are the identifiers of the machines to list. All
virtual machines will be listed if no argument is given.
'''

        PortTranslationCommand.addCommonOptions(self.parser)
        AuthnCommand.addCloudEndpointOptions(self.parser)
        Monitor.addOptions(self.parser)

        self.parser.add_option('-m', dest='multi_site', action='store_true',
                               help='Print state of virtual machines on multiple sites. '
                                    '"endpoints" parameter should be set in user configuration '
                                    'file.',
                               default=False)

        super(MainProgram, self).parse()

        self.options, self.vmIds = self.parser.parse_args()
 def checkOptions(self):
     AuthnCommand.checkCloudEndpointOptionsOnly(self)
     PortTranslationCommand.checkCommonOptions(self)
     super(MainProgram, self).checkOptions()