summaryrefslogtreecommitdiffstats
path: root/func/overlord/base_command.py
blob: 8f16eca508112d5d41a10fd29989c36e1bdebecd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/usr/bin/python
"""
Copyright 2008, Red Hat, Inc
Adrian Likins <alikins@redhat.com>
also see AUTHORS

This software may be freely redistributed under the terms of the GNU
general public license.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
"""

import command
import client

DEFAULT_PORT = 51234
class BaseCommand(command.Command):
    """ wrapper class for commands with some convience functions, namely
    getOverlord() for getting a overlord client api handle"""

    interactive = False
    verbose=0
    port=DEFAULT_PORT
    def getOverlord(self):
        self.overlord_obj = client.Overlord(self.server_spec,
                                            port=self.port,
                                            interactive=self.interactive,
                                            verbose=self.verbose,
                                            config=self.config,
                                            async=self.options.async,
                                            nforks=self.options.forks)