Fix generic share resize with 0.0.0.0/24 access
Add missing quotes to exportfs command to protect <world> being interpreted as file redirect Closes-Bug: #1911695 Change-Id: Ie95a476e9a81c58df998c3f44da137b023b53cc6
This commit is contained in:
parent
9b835f03d5
commit
2586252606
@ -383,8 +383,9 @@ class NFSHelper(NASHelperBase):
|
||||
out, err = self._ssh_exec(server, ['sudo', 'exportfs'])
|
||||
hosts = self.get_host_list(out, local_path)
|
||||
for host in hosts:
|
||||
self._ssh_exec(server, ['sudo', 'exportfs', '-u',
|
||||
':'.join((host, local_path))])
|
||||
self._ssh_exec(server,
|
||||
['sudo', 'exportfs', '-u',
|
||||
'"{}"'.format(':'.join((host, local_path)))])
|
||||
self._sync_nfs_temp_and_perm_files(server)
|
||||
|
||||
@nfs_synchronized
|
||||
|
@ -355,13 +355,16 @@ class NFSHelperTestCase(test.TestCase):
|
||||
@ddt.data(
|
||||
('/shares/fake_share1\n\t\t1.1.1.10\n'
|
||||
'/shares/fake_share2\n\t\t1.1.1.16\n'
|
||||
'/shares/fake_share3\n\t\t<world>\n'
|
||||
'/mnt/fake_share1 1.1.1.11', False),
|
||||
('/shares/fake_share_name\n\t\t1.1.1.10\n'
|
||||
'/shares/fake_share_name\n\t\t1.1.1.16\n'
|
||||
'/shares/fake_share_name\n\t\t<world>\n'
|
||||
'/mnt/fake_share1\n\t\t1.1.1.11', True),
|
||||
('/mnt/fake_share_name\n\t\t1.1.1.11\n'
|
||||
'/shares/fake_share_name\n\t\t1.1.1.10\n'
|
||||
'/shares/fake_share_name\n\t\t1.1.1.16\n', True))
|
||||
'/shares/fake_share_name\n\t\t1.1.1.16\n'
|
||||
'/shares/fake_share_name\n\t\t<world>\n', True))
|
||||
@ddt.unpack
|
||||
def test_disable_access_for_maintenance(self, output, hosts_match):
|
||||
fake_maintenance_path = "fake.path"
|
||||
@ -397,10 +400,15 @@ class NFSHelperTestCase(test.TestCase):
|
||||
|
||||
if hosts_match:
|
||||
self._helper._ssh_exec.assert_has_calls([
|
||||
mock.call(self.server, ['sudo', 'exportfs', '-u',
|
||||
':'.join(['1.1.1.10', local_path])]),
|
||||
mock.call(self.server, ['sudo', 'exportfs', '-u',
|
||||
':'.join(['1.1.1.16', local_path])]),
|
||||
mock.call(self.server,
|
||||
['sudo', 'exportfs', '-u',
|
||||
'"{}"'.format(':'.join(['1.1.1.10', local_path]))]),
|
||||
mock.call(self.server,
|
||||
['sudo', 'exportfs', '-u',
|
||||
'"{}"'.format(':'.join(['1.1.1.16', local_path]))]),
|
||||
mock.call(self.server,
|
||||
['sudo', 'exportfs', '-u',
|
||||
'"{}"'.format(':'.join(['<world>', local_path]))]),
|
||||
])
|
||||
|
||||
self._helper._sync_nfs_temp_and_perm_files.assert_called_once_with(
|
||||
|
@ -0,0 +1,4 @@
|
||||
---
|
||||
fixes:
|
||||
- |
|
||||
Resizing 0.0.0.0/24 accessible NFS shares with generic driver
|
Loading…
Reference in New Issue
Block a user