@@ -167,6 +167,32 @@ var userPartOfCrcUsersAndHypervAdminsGroupCheck = Check{
167
167
labels : labels {Os : Windows },
168
168
}
169
169
170
+ // Checks to verify and setup SMB share is created and file sharing is enabled
171
+ var smbShareCreatedAndFileSharingEnabledChecks = []Check {
172
+ {
173
+ configKeySuffix : "check-file-sharing-enabled" ,
174
+ checkDescription : "Checking if Printer and File Sharing is enabled" ,
175
+ check : checkFileAndPrinterSharingIsEnabled ,
176
+ fixDescription : "Enabling Printer and File Sharing" ,
177
+ fix : fixFileAndPrinterSharing ,
178
+ cleanupDescription : "Disabling Printer and File Sharing" ,
179
+ cleanup : removeFirewallRuleAllowingPrinterAndFileSharing ,
180
+
181
+ labels : labels {Os : Windows , SharedDir : Enabled },
182
+ },
183
+ {
184
+ configKeySuffix : "check-smb-share-exists" ,
185
+ checkDescription : "Checking if SMB share crc-dir0 exists" ,
186
+ check : checkCRCSmbShareCreated ,
187
+ fixDescription : "Creating SMB share crc-dir0" ,
188
+ fix : fixCRCSmbShareCreated ,
189
+ cleanupDescription : "Removing SMB share crc-dir0" ,
190
+ cleanup : removeSmbShare ,
191
+
192
+ labels : labels {Os : Windows , SharedDir : Enabled },
193
+ },
194
+ }
195
+
170
196
var errReboot = errors .New ("Please reboot your system and run 'crc setup' to complete the setup process" )
171
197
172
198
func username () string {
@@ -202,7 +228,7 @@ func checkVsock() error {
202
228
// Passing 'UserNetworkingMode' to getPreflightChecks currently achieves this
203
229
// as there are no system networking specific checks
204
230
func getAllPreflightChecks () []Check {
205
- return getPreflightChecks (true , network .UserNetworkingMode , constants .GetDefaultBundlePath (preset .OpenShift ), preset .OpenShift , false )
231
+ return getPreflightChecks (true , network .UserNetworkingMode , constants .GetDefaultBundlePath (preset .OpenShift ), preset .OpenShift , true , true )
206
232
}
207
233
208
234
func getChecks (bundlePath string , preset crcpreset.Preset , enableBundleQuayFallback bool ) []Check {
@@ -219,12 +245,14 @@ func getChecks(bundlePath string, preset crcpreset.Preset, enableBundleQuayFallb
219
245
checks = append (checks , daemonTaskChecks ... )
220
246
checks = append (checks , adminHelperServiceCheks ... )
221
247
checks = append (checks , sshPortCheck ())
248
+ checks = append (checks , smbShareCreatedAndFileSharingEnabledChecks ... )
222
249
return checks
223
250
}
224
251
225
252
func getPreflightChecks (_ bool , networkMode network.Mode , bundlePath string , preset crcpreset.Preset , enableBundleQuayFallback , sharedDirEnabled bool ) []Check {
226
253
filter := newFilter ()
227
254
filter .SetNetworkMode (networkMode )
255
+ filter .SetSharedDirStatus (sharedDirEnabled )
228
256
229
257
return filter .Apply (getChecks (bundlePath , preset , enableBundleQuayFallback ))
230
258
}
0 commit comments