pyinfra icon indicating copy to clipboard operation
pyinfra copied to clipboard

New config.py behaviour confusing

Open mjmare opened this issue 3 years ago • 2 comments

With the latest PyInfra release 1.6.3 and this config.py (in accordance to docs):

SUDO=True
REQUIRE_PACKAGES = []

I'm getting this error:

--> Loading config...
    file: /Users/mjm/Dropbox/Devel/ACHN/Swarmlet/infra/config.py
        Defining config variables directly is deprecated, please use `config.SUDO = True`.
--> pyinfra error: No deploy file: deploys/01_get_server_data.py
error: Recipe `get_droplet_data` failed on line 12 with exit code 1

However changing my config.py to:

config.SUDO=True
config.REQUIRE_PACKAGES = []

doesn't work either:

NameError: name 'config' is not defined

mjmare avatar Feb 23 '22 19:02 mjmare

Sorry, I was wrong to assume that the error was caused by the deprecation warning. But it was my own doing.

you might consider updating the docs to warn people about the upcoming change. TIA

mjmare avatar Feb 23 '22 20:02 mjmare

This was documented in the README here: https://github.com/Fizzadar/pyinfra/blob/current/CHANGELOG.md#v15. I do need to expand the documentation pages for this though as config is largely ignored.

Fizzadar avatar Mar 06 '22 08:03 Fizzadar