theforeman / ansible-foreman_scap_client

GNU General Public License v3.0
4 stars 13 forks source link

Make some policy parameters optional #14

Open xstasi opened 4 years ago

xstasi commented 4 years ago

The scap client doesn't really need a lot of the parameters that are included in the template, however it will fail if they are left blank. This way if a parameter is not specified in the ansible variables the line will just not be added to the configuration file.

xprazak2 commented 4 years ago

Thank you for your patch. You are right, when there are missing keys for policy, the role fails - I have created a test scenario that shows that nicely.

What do you think about replacing the brackets with get method? That way we would have {{ policy.get('key') }} instead of {{ policy['key'] }}, which should take care of the failures and looks more compact.

xstasi commented 4 years ago

Hi Ondra,

I didn't even know that syntax existed, but sure. You're the developer, feel free to use the style that suits you best.

For what it's worth my comment only added the if's, the hash['key'] form was already there.