summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--fapi.conf.sample3
-rwxr-xr-xsrc/fapi.py29
2 files changed, 27 insertions, 5 deletions
diff --git a/fapi.conf.sample b/fapi.conf.sample
index 3a9cddf..a265092 100644
--- a/fapi.conf.sample
+++ b/fapi.conf.sample
@@ -2,5 +2,4 @@
username: paul
password64: SECRET
hostname: bigip.example.com
-# Use Common if you want
-partition: administrativepartitionname
+partition: Common
diff --git a/src/fapi.py b/src/fapi.py
index 68ca0f6..daa36e9 100755
--- a/src/fapi.py
+++ b/src/fapi.py
@@ -76,6 +76,11 @@ class Fapi(object):
print >> sys.stderr, '%s %s' % (__prompt__, message)
+ def help(self, message):
+ ''' Prints an help message to stderr '''
+ print >> sys.stderr, 'Possible subcommands: %s' % message
+
+
def __run_node(self):
''' Do stuff concerning nodes '''
@@ -88,11 +93,13 @@ class Fapi(object):
nodename = a.arg3
print "\n".join(f.LocalLB.NodeAddressV2.get_monitor_status([nodename]))
return True
-
- else:
+ elif a.arg2 == 'list':
self.info('Getting node list')
print "\n".join(f.LocalLB.NodeAddressV2.get_list())
return True
+ else:
+ self.help('status list')
+ return True
elif a.arg == 'create':
nodename = a.arg2
@@ -108,6 +115,11 @@ class Fapi(object):
f.LocalLB.NodeAddressV2.delete_node_address([nodename])
return True
+ elif a.arg == 'help':
+ nodename = a.arg2
+ self.help('show create delete')
+ return True
+
return False
@@ -130,11 +142,15 @@ class Fapi(object):
print "\n".join(f.LocalLB.Pool.get_member_v2([poolname]))
return True
- else:
+ elif a.arg2 == 'list':
self.info('Get pool list')
print "\n".join(f.LocalLB.Pool.get_list())
return True
+ else:
+ self.help('status members list')
+ return True
+
elif a.arg == 'create':
poolname = a.arg2
poolmembers = []
@@ -157,6 +173,11 @@ class Fapi(object):
f.LocalLB.Pool.delete_pool([poolname])
return True
+ else:
+ self.help('show create delete')
+ f.LocalLB.Pool.delete_pool([poolname])
+ return True
+
return False
@@ -177,6 +198,8 @@ class Fapi(object):
elif a.action == 'pool': return self.__run_pool()
elif a.action == 'service': return self.__run_service()
+ self.help('node pool service')
+ return True
if __name__ == '__main__':