summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPaul C. Buetow <paul@buetow.org>2014-04-12 13:14:59 +0200
committerPaul C. Buetow <paul@buetow.org>2014-04-12 13:14:59 +0200
commit6e509e340169fc7363244feef7ef437fea932058 (patch)
tree38e821e084fbb3c9247703abb20e4b1b7c887777 /src
parent3ef838a6402a7cc8846671c0c5d65f45970afcb0 (diff)
can create and delete node addresses
Diffstat (limited to 'src')
-rwxr-xr-xsrc/fapi.py28
1 files changed, 17 insertions, 11 deletions
diff --git a/src/fapi.py b/src/fapi.py
index 98ecad1..eabe478 100755
--- a/src/fapi.py
+++ b/src/fapi.py
@@ -84,24 +84,29 @@ class Fapi(object):
if a.arg == 'show':
if a.subarg == 'status':
- self.info('Getting pool status')
- poolname = a.subarg2
- print f.LocalLB.Pool.get_object_status([poolname])
- return True
-
- elif a.subarg == 'members':
- self.info('Get pool members')
- poolname = a.subarg2
- print f.LocalLB.Pool.get_member_v2([poolname])
+ self.info('Getting node monitor status')
+ nodename = a.subarg2
+ print f.LocalLB.NodeAddressV2.get_monitor_status([nodename])
return True
else:
self.info('Get node list')
- print f.LocalLB.Node.get_list()
+ print f.LocalLB.NodeAddressV2.get_list()
return True
elif a.arg == 'create':
- return False
+ nodename = a.subarg
+ nodeip = a.subarg2
+ limits = 0
+ self.info('Creating node \'%s\' \'%s\'' % (nodename, nodeip))
+ f.LocalLB.NodeAddressV2.create([nodename],[nodeip],[limits])
+ return True
+
+ elif a.arg == 'delete':
+ nodename = a.subarg
+ self.info('Deleting node \'%s\'' % (nodename))
+ f.LocalLB.NodeAddressV2.delete_node_address([nodename])
+ return True
return False
@@ -198,6 +203,7 @@ if __name__ == '__main__':
parser.add_argument('arg', help='The argument for the action')
parser.add_argument('subarg', nargs='?', help='A sub argument')
parser.add_argument('subarg2', nargs='?', help='Another sub argument')
+ parser.add_argument('subarg3', nargs='?', help='Another sub argument')
args = parser.parse_args()