dirkpetersen / froster

Froster is a user-friendly archiving tool for teams that move data between Posix file systems and S3 like object storage systems such as AWS Glacier
Apache License 2.0
13 stars 1 forks source link

froster thinks my aws profile is not valid #75

Closed dirkpetersen closed 1 week ago

dirkpetersen commented 2 weeks ago

I am getting this credentials error

[?] Enter the path to aws credentials directory (default: ~/.aws): ~/.aws
[?] Choose your aws profile:
   default
 > aws
   dpcri
   rgw
   dipeit
   + Create new profile

Checking AWS credentials...
    ...AWS credentials are NOT valid

Configure new aws credentials using the command:
    froster config --aws

but my profile is simple

grep -A2 -B1 "profile aws" ~/.aws/config

[profile aws]
region = us-west-2

and is working fine

aws --profile aws s3 ls
2024-03-07 20:08:49 asm-dp
2024-01-19 17:35:46 cedararchive-dpcri
2024-04-29 15:10:37 cf-templates-4n6kij8omad9-us-east-1
2024-04-29 15:37:16 dpcri-nvflare
2023-12-02 15:30:20 easybuild-cache-ohsu
2023-05-03 20:59:26 froster-dpcri
2024-01-06 16:06:19 juicefs-dp
2023-05-03 18:06:31 parallelcluster-c3cc34d4a3a23444-v1-do-not-delete
victormachadoperez commented 2 weeks ago

The ~/.aws/config file had a bug: it did not add the word "profile" before the actual profile name. This is fixed in the already released froster v0.12.31. This bug is fixed, but this may differ from the reason you see this error.

Also, I expanded the exit error codes in this release when credentials are invalid. Please update Froster to v.12.31 or higher and recheck it.

Also, check the syntax on the ~/.aws/credentials file.

Thanks

dirkpetersen commented 2 weeks ago

@victormachadoperez , in this case it is important that the froster config only references the aws profile but does not duplicate any aws configurations beyond that, for example region information, etc does not belong in the froster config. The reason for this is more difficult trouble shooting for IT staff. An early version of froster used to duplicate this information and it lead to inconsistencies so i changed it

dirkpetersen commented 1 week ago

@victormachadoperez .... i believe this is not working because in line 1426

https://github.com/dirkpetersen/froster/blob/main/froster/froster.py#L1426

                if not self.cfg.aws_init or not os.path.exists(self.cfg.aws_credentials_file):
                    return False

self.cfg.aws_init is always false because it was not preconfigured and picking the profile does not set this one to true.

also i see https://github.com/dirkpetersen/froster/blob/main/froster/froster.py#L609 that there is region info in config.ini. This should not be the case. The only info in config.ini should be the AWS profile and if that does not have the correct region info there should be an error or a prompt to fix it in the aws profile not config.ini

dirkpetersen commented 1 week ago

Thanks @victormachadoperez . This does now work with 14.1