@@ -228,21 +228,31 @@ def update(
228
228
"""Update an existing profile."""
229
229
c42profile = cliprofile .get_profile (name )
230
230
231
- if c42profile .api_client_auth == "True" :
232
- if not any (
233
- [
234
- server ,
235
- api_client_id ,
236
- secret ,
237
- disable_ssl_errors is not None ,
238
- use_v2_file_events is not None ,
239
- ]
240
- ):
231
+ if not any (
232
+ [
233
+ server ,
234
+ api_client_id ,
235
+ secret ,
236
+ username ,
237
+ password ,
238
+ disable_ssl_errors is not None ,
239
+ use_v2_file_events is not None ,
240
+ ]
241
+ ):
242
+ if c42profile .api_client_auth == "True" :
241
243
raise click .UsageError (
242
244
"Must provide at least one of `--server`, `--api-client-id`, `--secret`, `--use-v2-file-events` or "
243
245
"`--disable-ssl-errors` when updating an API client profile. "
244
246
"Provide both `--username` and `--password` options to switch this profile to username/password authentication."
245
247
)
248
+ else :
249
+ raise click .UsageError (
250
+ "Must provide at least one of `--server`, `--username`, `--password`, `--use-v2-file-events` or "
251
+ "`--disable-ssl-errors` when updating a username/password authenticated profile. "
252
+ "Provide both `--api-client-id` and `--secret` options to switch this profile to Code42 API client authentication."
253
+ )
254
+
255
+ if c42profile .api_client_auth == "True" :
246
256
if (username and not password ) or (password and not username ):
247
257
raise click .UsageError (
248
258
"This profile currently uses API client authentication. "
@@ -277,18 +287,6 @@ def update(
277
287
_set_pw (c42profile .name , secret , debug , api_client = True )
278
288
279
289
else :
280
- if (
281
- not server
282
- and not username
283
- and not password
284
- and disable_ssl_errors is None
285
- and use_v2_file_events is None
286
- ):
287
- raise click .UsageError (
288
- "Must provide at least one of `--server`, `--username`, `--password`, `--use-v2-file-events` or "
289
- "`--disable-ssl-errors` when updating a username/password authenticated profile. "
290
- "Provide both `--api-client-id` and `--secret` options to switch this profile to Code42 API client authentication."
291
- )
292
290
if (api_client_id and not secret ) or (api_client_id and not secret ):
293
291
raise click .UsageError (
294
292
"This profile currently uses username/password authentication. "
0 commit comments