avoid getting creds from environment during autoenable

When autoenabling special remotes of type S3, weddav, or glacier, do not
take login credentials from environment variables, as the user may not be
expecting the autoenable to happen, and may have those set for other
purposes.
This commit is contained in:
Joey Hess 2021-03-17 09:41:12 -04:00
parent 02e74c010b
commit 0e44c252c8
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
14 changed files with 72 additions and 37 deletions

View file

@ -87,11 +87,8 @@ adjustExportImportRemoteType rt = rt { setup = setup' }
| configured pc && encryptionIsEnabled pc ->
giveup $ "cannot enable both encryption and " ++ fromProposedAccepted configfield
| otherwise -> cont
Enable oldc -> do
oldpc <- parsedRemoteConfig rt oldc
if configured pc /= configured oldpc
then giveup $ "cannot change " ++ fromProposedAccepted configfield ++ " of existing special remote"
else cont
Enable oldc -> enable oldc pc configured configfield cont
AutoEnable oldc -> enable oldc pc configured configfield cont
, if configured pc
then giveup $ fromProposedAccepted configfield ++ " is not supported by this special remote"
else cont
@ -99,6 +96,12 @@ adjustExportImportRemoteType rt = rt { setup = setup' }
checkconfig exportSupported exportTree exportTreeField $
checkconfig importSupported importTree importTreeField $
setup rt st mu cp c gc
enable oldc pc configured configfield cont = do
oldpc <- parsedRemoteConfig rt oldc
if configured pc /= configured oldpc
then giveup $ "cannot change " ++ fromProposedAccepted configfield ++ " of existing special remote"
else cont
-- | Adjust a remote to support exporttree=yes and/or importree=yes.
adjustExportImport :: Remote -> RemoteStateHandle -> Annex Remote