summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul C. Buetow <paul@buetow.org>2014-04-12 08:57:05 +0200
committerPaul C. Buetow <paul@buetow.org>2014-04-12 08:57:05 +0200
commite15f2ad34bfb28598e7faf3c1bde03dbfab76d2a (patch)
treec114ed0dc508047b6d17405a2804ecb4909bc7da
parent3921a6ea87c48a4bf2a6f2f3f27bac55c70c188a (diff)
set partition after login
-rw-r--r--fapi.conf.sample3
-rwxr-xr-xfapi.py10
2 files changed, 11 insertions, 2 deletions
diff --git a/fapi.conf.sample b/fapi.conf.sample
index a76302e..944b427 100644
--- a/fapi.conf.sample
+++ b/fapi.conf.sample
@@ -1,4 +1,5 @@
[fapi]
username: paul
-password64: Zm9vYmFyYmF6
+password64: SECRET
hostname: bigip.example.com
+partition: administrativepartitionname
diff --git a/fapi.py b/fapi.py
index 83d5f70..9f68763 100755
--- a/fapi.py
+++ b/fapi.py
@@ -47,6 +47,12 @@ class Fapi(object):
self.__login(username, password)
+ try:
+ self.b.Management.Partition.set_active_partition(
+ config.get('fapi', 'partition'))
+ except Exception, e:
+ print "Exception: %s" % e
+
def __args_merge(self, args):
''' Merges args to the config object '''
@@ -68,7 +74,7 @@ class Fapi(object):
hostname = self.config.get('fapi', 'hostname')
try:
- b = bigsuds.BIGIP(
+ self.b = bigsuds.BIGIP(
hostname = hostname,
username = username,
password = password,
@@ -85,6 +91,8 @@ if __name__ == '__main__':
parser.add_argument('-V', action='store_true', help='Print version')
parser.add_argument('-C', action='store', help='Config file',
default=expanduser('~') + '/.fapi.conf')
+ parser.add_argument('list', action='store_true', help='List')
+ parser.add_argument('pools', action='store_true', help='Server pool')
args = vars(parser.parse_args())
if args['V']: