diff options
author | Andy Grover <agrover@redhat.com> | 2014-11-20 15:26:38 -0800 |
---|---|---|
committer | Andy Grover <agrover@redhat.com> | 2014-11-20 15:26:38 -0800 |
commit | 8388ada59fed8c18ce622901d3b4590cc4162d16 (patch) | |
tree | aa75f7a1337ffcb62041ad7d7cf540c26f33d152 | |
parent | 83f435ba5c52611773a9d5f134c9f69f74f1f22a (diff) | |
download | rtslib-fb-8388ada59fed8c18ce622901d3b4590cc4162d16.tar.gz |
Define list of auth properties one time
Instead of defining for both TPG and NodeACL use, just define once.
Signed-off-by: Andy Grover <agrover@redhat.com>
-rw-r--r-- | rtslib/target.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/rtslib/target.py b/rtslib/target.py index de90a62..c02c0ed 100644 --- a/rtslib/target.py +++ b/rtslib/target.py @@ -32,6 +32,8 @@ from utils import _get_auth_attr, _set_auth_attr import tcm from functools import partial +auth_params = ('userid', 'password', 'mutual_userid', 'mutual_password') + class Target(CFSNode): ''' This is an interface to Targets in configFS. @@ -431,7 +433,7 @@ class TPG(CFSNode): d['portals'] = [portal.dump() for portal in self.network_portals] d['node_acls'] = [acl.dump() for acl in self.node_acls] if self.has_feature("auth"): - for attr in ("userid", "password", "mutual_userid", "mutual_password"): + for attr in auth_params: val = getattr(self, "chap_" + attr, None) if val: d["chap_" + attr] = val @@ -966,7 +968,7 @@ class NodeACL(CFSNode): if self.tag: d['tag'] = self.tag if self.has_feature("auth"): - for attr in ("userid", "password", "mutual_userid", "mutual_password"): + for attr in auth_params: val = getattr(self, "chap_" + attr, None) if val: d["chap_" + attr] = val |