ansible / ansible-policy

ansible-policy is a prototype implementation which allows us to define and set constraints to the Ansible project in OPA Rego language.
Apache License 2.0
21 stars 10 forks source link

False message "ValueError: `opa` command is required to evaluate OPA policies #53

Open yoal-carlangas opened 2 weeks ago

yoal-carlangas commented 2 weeks ago

To evalute if opa is installed on the O.S. the function validate_opa_installation in utils.py use which command to determinate the absolute path of 0opa binary, the issue is that some linux flavors which command is not installed by default (i.e archlinux, fedora, centos..), but this requirement in not documented, install which command solve the issue, or deleting "which" in the line of code solved to.

$ cat ansible_policy/utils.py'

..   
def validate_opa_installation(executable_name: str = "opa"):    
    proc = subprocess.run(  
        f"which {executable_name}",     <-----  # Line 36   
        shell=True,  
...
hirokuni-kitahara commented 2 weeks ago

@yoal-carlangas Thank you very much for letting us know this! I have updated the part to use command -v with this PR. It would be merged soon.