Fix issue with VirtualBMC client path
If SELinux is enforcing we install VirtualBMC as a system Python package. The module is executed using become, and root typically doesn't have /usr/local/bin/ in it's PATH. Use an absolute path to resolve this issue. Change-Id: Ia278518d2c55351c55abca1122e7cad7179ad4d8
This commit is contained in:
parent
53246242e9
commit
1b01c94f15
@ -31,15 +31,13 @@ INTERVAL = 0.5
|
|||||||
|
|
||||||
|
|
||||||
def _vbmc_command(module, args):
|
def _vbmc_command(module, args):
|
||||||
path_prefix = ("%s/bin" % module.params["virtualenv"]
|
cmd = [module.params["vbmc_path"], "--no-daemon"]
|
||||||
if module.params["virtualenv"] else None)
|
|
||||||
cmd = ["vbmc", "--no-daemon"]
|
|
||||||
if module.params["log_directory"]:
|
if module.params["log_directory"]:
|
||||||
log_file = os.path.join(module.params["log_directory"],
|
log_file = os.path.join(module.params["log_directory"],
|
||||||
"vbmc-%s.log" % module.params["domain"])
|
"vbmc-%s.log" % module.params["domain"])
|
||||||
cmd += ["--log-file", log_file]
|
cmd += ["--log-file", log_file]
|
||||||
cmd += args
|
cmd += args
|
||||||
result = module.run_command(cmd, check_rc=True, path_prefix=path_prefix)
|
result = module.run_command(cmd, check_rc=True)
|
||||||
rc, out, err = result
|
rc, out, err = result
|
||||||
return out
|
return out
|
||||||
|
|
||||||
@ -150,7 +148,7 @@ def main():
|
|||||||
log_directory=dict(type='str'),
|
log_directory=dict(type='str'),
|
||||||
state=dict(type=str, default='present',
|
state=dict(type=str, default='present',
|
||||||
choices=['present', 'absent']),
|
choices=['present', 'absent']),
|
||||||
virtualenv=dict(type='str'),
|
vbmc_path=dict(type='str'),
|
||||||
),
|
),
|
||||||
supports_check_mode=True,
|
supports_check_mode=True,
|
||||||
)
|
)
|
||||||
|
@ -9,5 +9,5 @@
|
|||||||
libvirt_uri: "{{ vbmc_libvirt_uri | default(omit, true) }}"
|
libvirt_uri: "{{ vbmc_libvirt_uri | default(omit, true) }}"
|
||||||
log_directory: "{{ vbmc_log_directory | default(omit, true) }}"
|
log_directory: "{{ vbmc_log_directory | default(omit, true) }}"
|
||||||
state: "{{ vbmc_state }}"
|
state: "{{ vbmc_state }}"
|
||||||
virtualenv: "{{ vbmc_virtualenv_path | default(omit, true) }}"
|
vbmc_path: "{{ vbmc_virtualenv_path | default('/usr/local', true) ~ '/bin/vbmc' }}"
|
||||||
become: true
|
become: true
|
||||||
|
Loading…
Reference in New Issue
Block a user