flyingcircusio / batou

batou is a universal, fractal deployment utility using Python.
https://batou.readthedocs.org
Other
47 stars 12 forks source link

crashing on migrate when there is no environments folder #461

Open frlan opened 4 weeks ago

frlan commented 4 weeks ago

Fresh deployment without any configured environments. Running a ./batou migrate causes a crash. experienced with 2.5b2

 ./batou migrate
Current version: 0
Version: 2300

🔧 Colliding attributes in environment and secrets

batou will now fail explicitly if an attribute exists both as an environment
override as well as a secret.

You will usually want to delete it from the environment config as that was
being used previously.

Version: 2301

✅ Environments have separate directories now

Each environment has been turned into a separate directory containing all the
configuration files:

* unencrypted configuration is now stored in
  `environments/<env>/environment.cfg`
* encrypted configuration is now stored in `environments/<env>/secrets.cfg`
* additional encrypted files are stored in `environments/<env>/secret-*`

The old `secrets` directory is now gone.

All data was migrated automatically for you, but you will need to commit those
changes manually.

Traceback (most recent call last):
  File "/mein/projekt.batou/./.appenv/76c7e883/bin/batou", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/mein/projekt.batou/.appenv/76c7e883/lib/python3.11/site-packages/batou/main.py", line 225, in main
    return args.func(**func_args)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/mein/projekt.batou/.appenv/76c7e883/lib/python3.11/site-packages/batou/migrate/__init__.py", line 117, in main
    new_version = migrate(base_version)
                  ^^^^^^^^^^^^^^^^^^^^^
  File "/mein/projekt.batou/.appenv/76c7e883/lib/python3.11/site-packages/batou/migrate/__init__.py", line 71, in migrate
    module.migrate(output_migration_step)
  File "/mein/projekt.batou/.appenv/76c7e883/lib/python3.11/site-packages/batou/migrate/migrations/2301.py", line 26, in migrate
    environments = _get_environment_names()
                   ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/mein/projekt.batou/.appenv/76c7e883/lib/python3.11/site-packages/batou/migrate/migrations/2301.py", line 35, in _get_environment_names
    return [
           ^
  File "/mein/projekt.batou/.appenv/76c7e883/lib/python3.11/site-packages/batou/migrate/migrations/2301.py", line 35, in <listcomp>
    return [
           ^
  File "/Users/flanitz/.nix-profile/lib/python3.11/pathlib.py", line 931, in iterdir
    for name in os.listdir(self):
                ^^^^^^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: '/mein/projekt.batou/environments'