ganesha: fix execute call using invalid argument
An execute call in the ganesha manager module that writes ganesha export config files is made with 'process_input' argument. This argument is invalid for processutils's ssh_execute() method which is used by the execute call to write config files to a remote ganesha server node. Fix this by not using the 'process_input' argument instead use other arguments that would still enable the execute call to write ganesha config files. Change-Id: I58369468ac7be1de38364a1c1bf6cbf8695b9a1d Closes-Bug: #1422235
This commit is contained in:
parent
00184fbf54
commit
a0097bfe15
@ -81,7 +81,7 @@ service: CommandFilter, service, root
|
|||||||
mktemp: CommandFilter, mktemp, root
|
mktemp: CommandFilter, mktemp, root
|
||||||
|
|
||||||
# manila/share/drivers/ganesha/manager.py:
|
# manila/share/drivers/ganesha/manager.py:
|
||||||
shcat: RegExpFilter, sh, root, sh, -c, cat > /.*
|
shcat: RegExpFilter, sh, root, sh, -c, echo '((.|\n)*)' > /.*
|
||||||
|
|
||||||
# manila/share/drivers/ganesha/manager.py:
|
# manila/share/drivers/ganesha/manager.py:
|
||||||
dbus-addexport: RegExpFilter, dbus-send, root, dbus-send, --print-reply, --system, --dest=org\.ganesha\.nfsd, /org/ganesha/nfsd/ExportMgr, org\.ganesha\.nfsd\.exportmgr\.(Add|Remove)Export, .*, .*
|
dbus-addexport: RegExpFilter, dbus-send, root, dbus-send, --print-reply, --system, --dest=org\.ganesha\.nfsd, /org/ganesha/nfsd/ExportMgr, org\.ganesha\.nfsd\.exportmgr\.(Add|Remove)Export, .*, .*
|
||||||
|
@ -226,8 +226,10 @@ class GaneshaManager(object):
|
|||||||
("dir", "base"))
|
("dir", "base"))
|
||||||
tmpf = self.execute('mktemp', '-p', dirpath, "-t",
|
tmpf = self.execute('mktemp', '-p', dirpath, "-t",
|
||||||
fname + ".XXXXXX")[0][:-1]
|
fname + ".XXXXXX")[0][:-1]
|
||||||
self.execute('sh', '-c', 'cat > ' + pipes.quote(tmpf),
|
self.execute(
|
||||||
process_input=data, message='writing ' + tmpf)
|
'sh', '-c',
|
||||||
|
'echo %s > %s' % (pipes.quote(data), pipes.quote(tmpf)),
|
||||||
|
message='writing ' + tmpf)
|
||||||
self.execute('mv', tmpf, path)
|
self.execute('mv', tmpf, path)
|
||||||
|
|
||||||
def _write_conf_file(self, name, data):
|
def _write_conf_file(self, name, data):
|
||||||
|
@ -227,14 +227,14 @@ class GaneshaManagerTestCase(test.TestCase):
|
|||||||
def test_write_file(self):
|
def test_write_file(self):
|
||||||
test_data = 'fakedata'
|
test_data = 'fakedata'
|
||||||
self.mock_object(manager.pipes, 'quote',
|
self.mock_object(manager.pipes, 'quote',
|
||||||
mock.Mock(return_value='fakefile.conf.RANDOM'))
|
mock.Mock(side_effect=['fakedata',
|
||||||
|
'fakefile.conf.RANDOM']))
|
||||||
test_args = [
|
test_args = [
|
||||||
('mktemp', '-p', '/fakedir0/export.d', '-t',
|
('mktemp', '-p', '/fakedir0/export.d', '-t',
|
||||||
'fakefile.conf.XXXXXX'),
|
'fakefile.conf.XXXXXX'),
|
||||||
('sh', '-c', 'cat > fakefile.conf.RANDOM'),
|
('sh', '-c', 'echo fakedata > fakefile.conf.RANDOM'),
|
||||||
('mv', 'fakefile.conf.RANDOM', test_path)]
|
('mv', 'fakefile.conf.RANDOM', test_path)]
|
||||||
test_kwargs = {
|
test_kwargs = {
|
||||||
'process_input': test_data,
|
|
||||||
'message': 'writing fakefile.conf.RANDOM'
|
'message': 'writing fakefile.conf.RANDOM'
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -249,7 +249,9 @@ class GaneshaManagerTestCase(test.TestCase):
|
|||||||
mock.call(*test_args[0]),
|
mock.call(*test_args[0]),
|
||||||
mock.call(*test_args[1], **test_kwargs),
|
mock.call(*test_args[1], **test_kwargs),
|
||||||
mock.call(*test_args[2])])
|
mock.call(*test_args[2])])
|
||||||
manager.pipes.quote.assert_called_once_with('fakefile.conf.RANDOM')
|
manager.pipes.quote.assert_has_calls([
|
||||||
|
mock.call('fakedata'),
|
||||||
|
mock.call('fakefile.conf.RANDOM')])
|
||||||
|
|
||||||
def test_write_conf_file(self):
|
def test_write_conf_file(self):
|
||||||
test_data = 'fakedata'
|
test_data = 'fakedata'
|
||||||
|
Loading…
Reference in New Issue
Block a user