Closed novaksam closed 1 year ago
I added a patch to novaksam's repo to simply the logic for multiple SMB DPs.
I also had a thought of setting the SMB share attributes (url, username, password) in a dictionary within an array and then you could simply loop through as many of them as there were. That would negate having all the smb_<attr><#>
listed in the Processor/Recipe Overrides/Prefs file.
I'll happily review the PR once @MLBZ521's suggestions have been merged in.
Thank you. I have some amendments to make, but I'll do them myself the JamfUpload repo.
@MLBZ521 @novaksam I have made amendments which now allow for infinite number of SMB DPs. You still supply SMB_URL, SMB2_URL etc, but a while loop keeps adding to the list of tuples until it reaches an empty SMBx_URL. This also saves manually adding code for each extra SMB DP, and accommodates someone coming along who has 30 DPs around the world or whatever.
I've tested it on 2 DPs, and I've tested it with JCDS + 2 DPs. It seems to work, though I have no idea how Jamf handles multiple DPs in reality, having never had to deal with that kind of setup.
Let me know if either of you get to test it out.
I don't have any way to test SMB DPs any more -- I just noticed a way to improve the logic.
I also had an idea to make the SMB shares an array of dictionaries that could be looped through, instead of the SMB#_<ATTRIBUTE>
, and not having to account for an infinite number of DPs in the input variables, some what to what you've done.
e.g.
<key>smb_shares</key>
<array>
<dict>
<key>smb_url</key>
<string>smb://server</string>
<key>smb_username</key>
<string>username</string>
<key>smb_password</key>
<string>password</string>
</dict>
<dict>
<key>smb_url</key>
<string>smb://server</string>
<key>smb_username</key>
<string>username</string>
<key>smb_password</key>
<string>password</string>
</dict>
<dict>
<key>smb_url</key>
<string>smb://server</string>
<key>smb_username</key>
<string>username</string>
<key>smb_password</key>
<string>password</string>
</dict>
</array>
That's how JSSImporter did it, but I don't want to do that, because it's impossible to override or supply from the command line, which breaks the convention of AutoPkg shared processors. My current method achieves a similar result while complying to the restrictions of Input lists.
Actually, I've now figured out how to offer both possibilities, so that an array can be used in the prefs, but alternatively, individual keys can be used in recipes or at the command line (or in the autopkg prefs, or in a recipe-list.plist), allowing for overrides.
Moved away from my delimited strings to separate fields. Tested and confirmed functionality for two on-prem DPs using SMB_URL and SMB2_URL