summaryrefslogtreecommitdiff
path: root/rtsadmin/ui_target.py
diff options
context:
space:
mode:
authorJerome Martin <jxm@risingtidesystems.com>2011-06-01 16:30:03 +0200
committerJerome Martin <jxm@risingtidesystems.com>2011-06-01 17:23:23 +0200
commitc68f4265a2810906227bb7e5f37bee711fb5b813 (patch)
tree52a250c2f4e0dd77c95c51bfe7080976d1098c39 /rtsadmin/ui_target.py
parentc436cb8031ef2883ac2e3b6677d4313dfb766d65 (diff)
downloadtargetcli-c68f4265a2810906227bb7e5f37bee711fb5b813.tar.gz
Added auto_cd_after_create global.
* Automatically cd's to newly created object after a 'create' command if true. * Added autosave (always) of last created node's path under @last bookmark.
Diffstat (limited to 'rtsadmin/ui_target.py')
-rw-r--r--rtsadmin/ui_target.py28
1 files changed, 21 insertions, 7 deletions
diff --git a/rtsadmin/ui_target.py b/rtsadmin/ui_target.py
index ba4ba23..523e6d3 100644
--- a/rtsadmin/ui_target.py
+++ b/rtsadmin/ui_target.py
@@ -73,10 +73,12 @@ class UIFabricModule(UIRTSLibNode):
ui_target = UIMultiTPGTarget(target)
self.add_child(ui_target)
self.log.info("Created target %s." % wwn)
- ui_target.ui_command_create()
+ return ui_target.ui_command_create()
else:
- self.add_child(UITarget(target))
+ ui_target = UITarget(target)
+ self.add_child(ui_target)
self.log.info("Created target %s." % wwn)
+ return self.new_node(ui_target)
def ui_complete_create(self, parameters, text, current_param):
'''
@@ -238,7 +240,9 @@ class UIMultiTPGTarget(UIRTSLibNode):
if self.prefs['auto_enable_tpgt']:
tpg.enable = True
self.log.info("Successfully created TPG %s." % tpg.tag)
- self.add_child(UITPG(tpg))
+ ui_tpg = UITPG(tpg)
+ self.add_child(ui_tpg)
+ return self.new_node(ui_tpg)
def ui_command_delete(self, tag):
'''
@@ -413,7 +417,8 @@ class UINodeACLs(UINode):
else:
self.log.info("Successfully created Node ACL for %s"
% node_acl.node_wwn)
- self.add_child(UINodeACL(node_acl))
+ ui_node_acl = UINodeACL(node_acl)
+ self.add_child(ui_node_acl)
if add_mapped_luns:
for lun in self.tpg.luns:
@@ -421,6 +426,8 @@ class UINodeACLs(UINode):
self.log.info("Created mapped LUN %d." % lun.lun)
self.refresh()
+ return self.new_node(ui_node_acl)
+
def ui_command_delete(self, wwn):
'''
Deletes the Node ACL with the specified I{wwn}.
@@ -549,8 +556,10 @@ class UINodeACL(UIRTSLibNode, UIAttributes, UIParameters):
return
mlun = MappedLUN(self.rtsnode, mapped_lun, tpg_lun, write_protect)
- self.add_child(UIMappedLUN(mlun))
+ ui_mlun = UIMappedLUN(mlun)
+ self.add_child(ui_mlun)
self.log.info("Created Mapped LUN %s." % mlun.mapped_lun)
+ return self.new_node(ui_mlun)
def ui_command_delete(self, mapped_lun):
'''
@@ -693,7 +702,8 @@ class UILUNs(UINode):
lun_object = LUN(self.tpg, lun, storage_object)
self.log.info("Successfully created LUN %s." % lun_object.lun)
- self.add_child(UILUN(lun_object))
+ ui_lun = UILUN(lun_object)
+ self.add_child(ui_lun)
if add_mapped_luns:
for acl in self.tpg.node_acls:
@@ -715,6 +725,8 @@ class UILUNs(UINode):
% (mapped_lun, acl.node_wwn))
self.parent.refresh()
+ return self.new_node(ui_lun)
+
def ui_complete_create(self, parameters, text, current_param):
'''
Parameter auto-completion method for user command create.
@@ -880,7 +892,9 @@ class UIPortals(UINode):
ip_port, mode='create')
self.log.info("Successfully created network portal %s:%d."
% (ip_address, ip_port))
- self.add_child(UIPortal(portal))
+ ui_portal = UIPortal(portal)
+ self.add_child(ui_portal)
+ return self.new_node(ui_portal)
def ui_complete_create(self, parameters, text, current_param):
'''