Skip to content
This repository has been archived by the owner on Aug 27, 2023. It is now read-only.

Exception while using ppc-create-s3-sync #323

Open
ppelletier opened this issue Oct 4, 2022 · 1 comment
Open

Exception while using ppc-create-s3-sync #323

ppelletier opened this issue Oct 4, 2022 · 1 comment

Comments

@ppelletier
Copy link

Hi!

I'm trying to follow the instructions about 'Using S3 Notifications to sync caches' and I have an exception when running the script

ppc-create-s3-sync config.ini

Traceback (most recent call last):
  File "/opt/homebrew/bin/ppc-create-s3-sync", line 9, in <module>
    sys.exit(create_sync_scripts())
  File "/opt/homebrew/lib/python3.10/site-packages/pypicloud/lambda_scripts.py", line 291, in create_sync_scripts
    kwargs = S3Storage.configure(settings)
  File "/opt/homebrew/lib/python3.10/site-packages/pypicloud/storage/object_store.py", line 83, in configure
    kwargs.update(cls._subclass_specific_config(settings, kwargs))
  File "/opt/homebrew/lib/python3.10/site-packages/pypicloud/storage/s3.py", line 58, in _subclass_specific_config
    return {"sse": sse, "bucket": cls.get_bucket(bucket_name, settings)}
  File "/opt/homebrew/lib/python3.10/site-packages/pypicloud/storage/s3.py", line 66, in get_bucket
    config_settings = settings.get_as_dict(
AttributeError: 'ConfigDict' object has no attribute 'get_as_dict'

I tried to debug a bit and while settings is defined as EnvironSettings when I print the class I get <class 'plaster_pastedeploy.ConfigDict'>

def get_bucket(
        cls, bucket_name: str, settings: EnvironSettings
    ) -> "boto3.s3.Bucket":
        config_settings = settings.get_as_dict(

Any ideas why it doesn't work? And how I could make it work? :)
Thanks!

@stevearc
Copy link
Owner

stevearc commented Oct 6, 2022

Ah, this probably broke when I added the EnvironSettings helper. This flow has never been well tested because I suspect it's rarely used, so I'm not surprised to see some code rot. If that's the only issue, the fix might be pretty simple.

settings = get_appsettings(args.config)

Try changing this line to settings = EnvironSettings(get_appsettings(args.config)) (and add from pypicloud.util import EnvironSettings at the top)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants