saltstack-formulas / salt-formula

Yes, Salt can Salt itself!
http://docs.saltstack.com/en/latest/topics/development/conventions/formulas.html
Other
197 stars 423 forks source link

Discussion around "standalone" logic. #532

Closed ajcollett closed 2 years ago

ajcollett commented 2 years ago

Hello,

I have been struggling with using the "salt" state by itself, since it seems to always run the standalone minion config.

After looking into things, it seems that in "init.sls" the formula checks if master_type is "truthy". Which, since it was changed from "true" to "str" by default, it seems to always fail and always select the minion-standalone sls. See below.

https://github.com/saltstack-formulas/salt-formula/blob/7af4524f22db49a07b7afa783d71968ccf7341db/salt/init.sls#L19

I am not sure how it's possible that this can be, the change was introduced a long while ago, so I would have thought this would be picked up, but I can't see another way that this makes sense.

When I was thinking through this, I couldn't see what should actually be tested for though, since in the standalone sls, different master_types end up with different config.

So there it is. For my use-case, I will change the logic to check for 'str', since I don't currently use standalone, but that's probably not the correct way in general.

Thoughts? Also please let me know if it seems I have completely missed something...

ajcollett commented 2 years ago

Right, so I had the "master_type" variable in the wrong place. It was "salt:master_type" instead of "salt:minion:master_type".

Which didn't occur to me since it was showing up in the config.

Interestingly, the default "str" was not being set.

So the issue I have raised here is no longer valid. I'll close this.