diff --git a/.envrc b/.envrc index 1f0c038..13044e5 100644 --- a/.envrc +++ b/.envrc @@ -4,6 +4,8 @@ export SNAPCRAFT_BUILD_ENVIRONMENT=multipass PATH_add ./rocket_craft +if ! test -f .venv_initialized; then pip3 install -r rocket_craft/requirements.txt && touch .venv_initialized; fi + _ROCKETCRAFT_COMPLETE=bash_source rocketcraft > ._rocketcraft_completion.bash _ROCKETCRAFT_COMPLETE=zsh_source rocketcraft > ._rocketcraft_completion.zsh diff --git a/.gitignore b/.gitignore index fb52bc3..ac5dab2 100644 --- a/.gitignore +++ b/.gitignore @@ -22,3 +22,4 @@ tests/ ._rocketcraft_completion.bash ._rocketcraft_completion.zsh +.venv_initialized diff --git a/migrations/post_refresh/02-remove-mongod-storage_journal_enabled.sh b/migrations/post_refresh/02-remove-mongod-storage_journal_enabled.sh new file mode 100755 index 0000000..a904516 --- /dev/null +++ b/migrations/post_refresh/02-remove-mongod-storage_journal_enabled.sh @@ -0,0 +1,36 @@ +#!/bin/bash + +>/dev/null cat < + +is no longer a supported config flag; having it breaks mongod startup. + +CommentEnd + +start() { + python3 -c ' +import sys + +from ruamel.yaml import YAML +yaml = YAML() +# important since mongod.conf is user editable, we want to preserve their comments; +yaml.preserve_quotes = True +yaml.indent(mapping=2, sequence=2, offset=0) + +mongod_conf = {} +with open(sys.argv[1], "r") as f: + mongod_conf = yaml.load(f) + + +if "storage" in mongod_conf and "journal" in mongod_conf["storage"]: + del mongod_conf["storage"]["journal"] + if not mongod_conf["storage"]: + del mongod_conf["storage"] + +with open(sys.argv[1], "w") as f: + yaml.dump(mongod_conf, f) + ' $SNAP_DATA/mongod.conf +} diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml index 5dc088c..35b7312 100644 --- a/snap/snapcraft.yaml +++ b/snap/snapcraft.yaml @@ -137,6 +137,9 @@ parts: '*': migrations/ plugin: dump source: ./migrations + stage-packages: + - python3-ruamel.yaml + - python3 mongodb-libssl-backwards-compat: plugin: dump source: