From 0b22b3715aca2bfacbf26cfc6b4e18ab483ff396 Mon Sep 17 00:00:00 2001 From: Valeriy Ponomaryov Date: Wed, 6 Aug 2014 10:44:32 -0400 Subject: [PATCH] Rename 'sid' to 'user' in access rules and sec services Rename 'sid' (secure identifier) to 'user' for better understanding by user. Changed parts: - share access rule type - security services Change-Id: I75eceab6ef6d91cebb9143abeaa8a5400c72848b --- manilaclient/v1/security_services.py | 20 ++++++------ manilaclient/v1/shares.py | 4 +-- manilaclient/v1/shell.py | 46 +++++++++++++++------------- tests/v1/test_security_services.py | 32 ++++++++++--------- 4 files changed, 55 insertions(+), 47 deletions(-) diff --git a/manilaclient/v1/security_services.py b/manilaclient/v1/security_services.py index c6baaf1d0..391238b50 100644 --- a/manilaclient/v1/security_services.py +++ b/manilaclient/v1/security_services.py @@ -39,7 +39,7 @@ class SecurityServiceManager(base.Manager): resource_class = SecurityService - def create(self, type, dns_ip=None, server=None, domain=None, sid=None, + def create(self, type, dns_ip=None, server=None, domain=None, user=None, password=None, name=None, description=None): """Create security service for NAS. @@ -48,8 +48,8 @@ class SecurityServiceManager(base.Manager): :param dns_ip: dns ip address used inside tenant's network :param server: security service server ip address or hostname :param domain: security service domain - :param sid: security identifier used by tenant - :param password: password used by sid + :param user: security identifier used by tenant + :param password: password used by user :param name: security service name :param description: security service description :rtype: :class:`SecurityService` @@ -61,8 +61,8 @@ class SecurityServiceManager(base.Manager): values['server'] = server if domain: values['domain'] = domain - if sid: - values['sid'] = sid + if user: + values['user'] = user if password: values['password'] = password if name: @@ -83,15 +83,15 @@ class SecurityServiceManager(base.Manager): return self._get(RESOURCE_PATH % security_service, RESOURCE_NAME) def update(self, security_service, dns_ip=None, server=None, domain=None, - password=None, sid=None, name=None, description=None): + password=None, user=None, name=None, description=None): """Updates a security service. :param security_service: security service to update. :param dns_ip: dns ip address used inside tenant's network :param server: security service server ip address or hostname :param domain: security service domain - :param sid: security identifier used by tenant - :param password: password used by sid + :param user: security identifier used by tenant + :param password: password used by user :param name: security service name :param description: security service description :rtype: :class:`SecurityService` @@ -104,8 +104,8 @@ class SecurityServiceManager(base.Manager): values['server'] = server if domain: values['domain'] = domain - if sid: - values['sid'] = sid + if user: + values['user'] = user if password: values['password'] = password if name: diff --git a/manilaclient/v1/shares.py b/manilaclient/v1/shares.py index 2cb86ec91..281cfaa67 100644 --- a/manilaclient/v1/shares.py +++ b/manilaclient/v1/shares.py @@ -59,11 +59,11 @@ class Share(common_base.Resource): def _validate_access(self, access_type, access): if access_type == 'ip': self._validate_ip_range(access) - elif access_type == 'sid': + elif access_type == 'user': self._validate_username(access) else: raise exceptions.CommandError( - 'Only ip and sid type are supported') + 'Only ip and user type are supported') def update_all_metadata(self, metadata): """Update all metadata of this share.""" diff --git a/manilaclient/v1/shell.py b/manilaclient/v1/shell.py index 7aa1e8440..f16de1872 100644 --- a/manilaclient/v1/shell.py +++ b/manilaclient/v1/shell.py @@ -485,7 +485,7 @@ def do_show(cs, args): @cliutils.arg( 'access_type', metavar='', - help='access rule type (only "ip" and "sid"(user or group) ' + help='access rule type (only "ip" and "user"(user or group) ' 'are supported).') @cliutils.arg( 'access_to', @@ -945,15 +945,15 @@ def do_share_network_delete(cs, args): default=None, help="security service domain") @cliutils.arg( - '--sid', - metavar='', + '--user', + metavar='', default=None, help="security service user or group used by tenant") @cliutils.arg( '--password', metavar='', default=None, - help="password used by sid") + help="password used by user") @cliutils.arg( '--name', metavar='', @@ -966,13 +966,15 @@ def do_share_network_delete(cs, args): help="security service description") def do_security_service_create(cs, args): """Create security service used by tenant.""" - values = {'dns_ip': args.dns_ip, - 'server': args.server, - 'domain': args.domain, - 'sid': args.sid, - 'password': args.password, - 'name': args.name, - 'description': args.description} + values = { + 'dns_ip': args.dns_ip, + 'server': args.server, + 'domain': args.domain, + 'user': args.user, + 'password': args.password, + 'name': args.name, + 'description': args.description, + } security_service = cs.security_services.create(args.type, **values) info = security_service._info.copy() utils.print_dict(info) @@ -998,15 +1000,15 @@ def do_security_service_create(cs, args): default=None, help="security service domain") @cliutils.arg( - '--sid', - metavar='', + '--user', + metavar='', default=None, help="security service user or group used by tenant") @cliutils.arg( '--password', metavar='', default=None, - help="password used by sid") + help="password used by user") @cliutils.arg( '--name', metavar='', @@ -1019,13 +1021,15 @@ def do_security_service_create(cs, args): help="security service description") def do_security_service_update(cs, args): """Update security service.""" - values = {'dns_ip': args.dns_ip, - 'server': args.server, - 'domain': args.domain, - 'sid': args.sid, - 'password': args.password, - 'name': args.name, - 'description': args.description} + values = { + 'dns_ip': args.dns_ip, + 'server': args.server, + 'domain': args.domain, + 'user': args.user, + 'password': args.password, + 'name': args.name, + 'description': args.description, + } security_service = cs.security_services.update(args.security_service, **values) info = security_service._info.copy() diff --git a/tests/v1/test_security_services.py b/tests/v1/test_security_services.py index 766592ce4..a8e64c6d6 100644 --- a/tests/v1/test_security_services.py +++ b/tests/v1/test_security_services.py @@ -32,14 +32,16 @@ class SecurityServiceTest(utils.TestCase): self.manager = security_services.SecurityServiceManager(api=None) def test_create_all_fields(self): - values = {'type': 'ldap', - 'dns_ip': 'fake dns ip', - 'server': 'fake.ldap.server', - 'domain': 'fake.ldap.domain', - 'sid': 'fake sid', - 'password': 'fake password', - 'name': 'fake name', - 'description': 'fake description'} + values = { + 'type': 'ldap', + 'dns_ip': 'fake dns ip', + 'server': 'fake.ldap.server', + 'domain': 'fake.ldap.domain', + 'user': 'fake user', + 'password': 'fake password', + 'name': 'fake name', + 'description': 'fake description', + } with mock.patch.object(self.manager, '_create', fakes.fake_create): result = self.manager.create(**values) @@ -52,11 +54,13 @@ class SecurityServiceTest(utils.TestCase): values) def test_create_some_fields(self): - values = {'type': 'ldap', - 'dns_ip': 'fake dns ip', - 'server': 'fake.ldap.server', - 'domain': 'fake.ldap.domain', - 'sid': 'fake sid'} + values = { + 'type': 'ldap', + 'dns_ip': 'fake dns ip', + 'server': 'fake.ldap.server', + 'domain': 'fake.ldap.domain', + 'user': 'fake user', + } with mock.patch.object(self.manager, '_create', fakes.fake_create): result = self.manager.create(**values) @@ -118,7 +122,7 @@ class SecurityServiceTest(utils.TestCase): 'dns_ip': 'new dns ip', 'server': 'new.ldap.server', 'domain': 'new.ldap.domain', - 'sid': 'new sid', + 'user': 'new user', 'password': 'fake password', }