Skip to content

Commit

Permalink
fix mitogen bug with distro 1.7.0
Browse files Browse the repository at this point in the history
  • Loading branch information
ivandeex committed Mar 28, 2022
1 parent 6ba2b2c commit d604402
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 54 deletions.
26 changes: 0 additions & 26 deletions .github/workflows/idempotence.patch

This file was deleted.

13 changes: 13 additions & 0 deletions .github/workflows/mitogen-distro.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
--- mitogen/master.py.bak 2022-03-28 19:43:35.594371211 +0300
+++ mitogen/master.py 2022-03-28 19:44:28.250723494 +0300
@@ -653,8 +653,9 @@
return [], None, modpath

pkg = sys.modules.get(pkgname)
+ name = getattr(pkg, '__name__', None)
path = getattr(pkg, '__path__', None)
- if pkg and path:
+ if pkg and pkgname == name and path:
return pkgname.split('.'), path, modpath

LOG.debug('%r: %r lacks __path__ attribute', self, pkgname)
37 changes: 10 additions & 27 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:

strategy:
fail-fast: false
max-parallel: 3
max-parallel: 5
matrix:
include:
- name: ivantory-docker
Expand Down Expand Up @@ -72,32 +72,22 @@ jobs:
sudo -H python3 -m pip install -U pip setuptools wheel
sudo -H pip3 install -r ./requirements.txt
- name: make mitogen strategy symlink
- name: fix mitogen and molecule
run: |
PKG=$(python3 -c "import ansible_mitogen as m; print(m.__path__[0])")
ln -sf $PKG/plugins/strategy ./plugins/strategy/mitogen
MDIR=$(python3 -c "import ansible_mitogen as m; print(m.__path__[0])")
VENV=$(dirname $MDIR)
PROJ=$(pwd)
SRC=$PROJ/.github/workflows
sudo patch -d $VENV/molecule_docker -p1 -i $SRC/docker-mitogen.patch
sudo patch -d $VENV/mitogen -p1 -i $SRC/mitogen-distro.patch
# make mitogen strategy symlink
ln -sf $MDIR/plugins/strategy $PROJ/plugins/strategy/mitogen
- name: make symlink for custom modules
if: ${{ matrix.scenario == 'plugins' }}
run: |
ln -sf ~/.cache/molecule/ivantory-test/$SCENARIO/roles ./roles-galaxy
- name: fix molecule-docker for mitogen
# mitogen speeds up main plays greatly, but create/destroy plays from
# molecule-docker use async wait which get stuck with mitogen, so patch
# https://github.com/mitogen-hq/mitogen/issues/835#issuecomment-978127345
run: |
SRC=$(pwd)
PKG=$(python3 -c "import molecule_docker as m; print(m.__path__[0])")
sudo patch -d $PKG -p1 -i $SRC/.github/workflows/docker-mitogen.patch
- name: investigate idempotence failures
run: |
touch log/idempotence.log
SRC=$(pwd)
PKG=$(python3 -c "import molecule as m; print(m.__path__[0])")
sudo patch -d $PKG -p3 -i $SRC/.github/workflows/idempotence.patch
- name: install required collections
run: |
rm -f collections/ansible_collections
Expand All @@ -107,11 +97,4 @@ jobs:
- name: run test
run: |
molecule test -s $SCENARIO
- name: upload idempotence log
if: always()
uses: actions/upload-artifact@v1
with:
name: idempotence.${{ matrix.name }}.log
path: log/idempotence.log
...
2 changes: 1 addition & 1 deletion molecule/default/molecule.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ provisioner:
ANSIBLE_STRATEGY_PLUGINS: $MOLECULE_PROJECT_DIRECTORY/plugins/strategy/mitogen
config_options:
defaults:
strategy: mitogen_linear
strategy: ${ANSIBLE_STRATEGY:-mitogen_linear}
stdout_callback: unixy2
verbosity: 1
lint:
Expand Down

0 comments on commit d604402

Please sign in to comment.