salt icon indicating copy to clipboard operation
salt copied to clipboard

[master] Fix 64433: Add dynamic loading of file_roots, pillar_roots, and thorium_roots

Open bluesliverx opened this issue 2 years ago • 23 comments

What does this PR do?

Adds dynamic expansion of file/pillar/thorium roots config.

What issues does this PR fix or reference?

Fixes: #64433

Previous Behavior

The roots were expanded only once at startup.

New Behavior

The roots are expanded on every access of the environments within the file_roots, pillar_roots, and thorium_roots options.

Merge requirements satisfied?

  • [x] Docs
  • [x] Changelog - https://docs.saltproject.io/en/master/topics/development/changelog.html
  • [x] Tests written/updated

Commits signed with GPG?

No

bluesliverx avatar Jun 06 '23 23:06 bluesliverx

@Ch3LL I have added tests and updated the documentation as requested. Let me know if you see anything else.

bluesliverx avatar Jun 11 '23 15:06 bluesliverx

Friendly ping for @dwoz/@twangboy for reviews :)

bluesliverx avatar Jun 20 '23 16:06 bluesliverx

Looked at this. I like the feature but am not sure about DynamicDict just yet. I'm going to chew on it for a bit before giving a final review.

dwoz avatar Jun 21 '23 21:06 dwoz

Looked at this. I like the feature but am not sure about DynamicDict just yet. I'm going to chew on it for a bit before giving a final review.

Thanks @dwoz, I should give you some background that the DynamicDict was written by someone else at my company, and it fell to me to get it into upstream Salt. The first thing I did is sat back and consider if there was a better way to do this, such as using a method in salt.config to retrieve the file roots or updating the opts when changes were detected (too hard for config on disparate filesystems such as NFS). In the end I ended up back with the dynamic dict since it provides a seamless interface to module writers, etc. i.e. opts['file_roots'] will work in either case with no changes to salt modules or third party modules.

We have been using pretty much this exact implementation for about 5 years now on clusters of 30k+ of salt minions, and it works well for us. With that said, I'm open to suggestions, just let me know.

bluesliverx avatar Jun 21 '23 22:06 bluesliverx

@dwoz, not trying to be pushy here, just curious if you had any further thoughts on this? (just in case it dropped off your radar :) )

bluesliverx avatar Jul 13 '23 00:07 bluesliverx

Sorry about the delayed response here. I was hoping to come around to allowing the DynamicDict thing to fly. However, that hasn't happened. I do no't like the 'magic' of dynamic dict and I do not like adding something other than simple data types to config and subsequently opts. If we're going to implement this feature, and I think we should. I think it'd be better to have a method in config or utils to grab the file_roots as needed and where needed.

dwoz avatar Aug 03 '23 21:08 dwoz

@dwoz I appreciate the honest feedback, and completely understand. Should the method in config/utils handle updating the file_roots or be used for actual retrieval? My only worry about doing it there is that something (even an execution module not in this repo) will use file_roots that will not be updated with the latest changes.

bluesliverx avatar Aug 04 '23 16:08 bluesliverx

@dwoz, wondering if I could get a little bit of guidance here with my previous question:

Should the method in config/utils handle updating the file_roots or be used for actual retrieval? My only worry about doing it there is that something (even an execution module not in this repo) will use file_roots that will not be updated with the latest changes.

I'm happy to work on this, but just want to set the direction first so that I don't do unnecessary or unwanted work. Thank you!

bluesliverx avatar Sep 25 '23 20:09 bluesliverx

@bluesliverx Looks like this is causing some tests to fail

dwoz avatar Dec 17 '23 05:12 dwoz

@dwoz, I'm a bit confused. You said you didn't want this PR merged in its current form. I'm looking for some feedback on what exactly you were thinking (see my last comment for questions there) before I rework it and bring it up to date with the latest master. Or has that opinion changed?

bluesliverx avatar Dec 17 '23 06:12 bluesliverx

@dwoz, I'm a bit confused. You said you didn't want this PR merged in its current form. I'm looking for some feedback on what exactly you were thinking (see my last comment for questions there) before I rework it and bring it up to date with the latest master. Or has that opinion changed?

I don't have the bandwidth to dive in and try and come up with a better solution. If the tests all passed I'd be more inclined to let it go without being my preferred implementation.

@s0undt3ch Thoughts on this one?

dwoz avatar Dec 18 '23 04:12 dwoz

Sorry @twangboy, thanks for the review! I'm still fixing up some tests that were affected by this change. I'm getting close but since I can't seem to run tests locally anymore (not sure why it freezes for me now but worked previously...), so I just have to run it up here unfortunately.

bluesliverx avatar Jan 09 '24 20:01 bluesliverx

No worries. Let me know when you're ready for a review.

twangboy avatar Jan 10 '24 19:01 twangboy

@twangboy I think this might be ready, but it's no longer running the build for some reason, so hard to tell. I was really close on the last commit though.

bluesliverx avatar Jan 10 '24 20:01 bluesliverx

@twangboy @dwoz this should be ready now.

bluesliverx avatar Jan 11 '24 14:01 bluesliverx

Sometimes it just takes a while for the jobs to start, looks like they're running now

twangboy avatar Jan 18 '24 22:01 twangboy

Not sure why those tests are failing

twangboy avatar Feb 01 '24 21:02 twangboy

@twangboy, yeah, me either. I've been trying to watch master, because I believe it is failing to build master in general and has nothing to do with my change: https://github.com/saltstack/salt/actions?query=branch%3Amaster

bluesliverx avatar Feb 02 '24 17:02 bluesliverx

Yeah, we've made a lot of fixes on 3006.x. Those are now being merged forward to 3007.x and then to master. Maybe the fixes are there.

twangboy avatar Feb 02 '24 20:02 twangboy

This will need a review from @dwoz

twangboy avatar Feb 26 '24 15:02 twangboy

You got some pre-commit and lint failures that need to be addressed

twangboy avatar Apr 22 '24 15:04 twangboy

@bluesliverx Would you mind rebasing and resolving the conflicts?

twangboy avatar May 13 '24 18:05 twangboy

@twangboy, sure thing. Apologies that this has been languishing. I have one consistently failed test that I can't seem to get to pass, and without a windows machine I'm finding this extremely difficult to test locally.

bluesliverx avatar May 15 '24 02:05 bluesliverx