File tree 6 files changed +391
-356
lines changed 6 files changed +391
-356
lines changed Original file line number Diff line number Diff line change 3
3
This collection allows to use [ Mitogen] ( https://github.com/mitogen-hq/mitogen )
4
4
strategy without the need to specify absolute path to the strategy file.
5
5
6
- It also performs live patching for Mitogen restrictions in Ansible
7
- versions, making it possible to use Mitogen with the current Ansible version.
6
+ It also performs live patching for oler versions of Mitogen (3.4), removing
7
+ Ansible version restrictions, making it possible to use Mitogen
8
+ on unsupported versions.
8
9
9
10
Tested versions of ansible-core:
10
11
11
12
* 2.14
12
13
* 2.15
13
14
* 2.16
15
+ * 2.17
14
16
15
- It patches ` ansible_mitogen ` code and unpatches it
17
+ When needed, it patches ` ansible_mitogen ` code and unpatches it
16
18
back right after module import, so the original
17
19
files are kept intact.
18
20
21
+ If no patching needed, it just passes mitogen content as it is.
22
+
19
23
## Install
20
24
To use this collection, you need to install Mitogen:
21
25
Original file line number Diff line number Diff line change 31
31
# You should have received a copy of the GNU General Public License
32
32
# along with this program. If not, see <https://www.gnu.org/licenses/>.
33
33
34
+ import importlib .metadata
34
35
35
- from . import patching
36
+ try :
37
+ mitogen_version = importlib .metadata .version ("mitogen" )
38
+ except importlib .metadata .PackageNotFoundError :
39
+ raise ImportError ("Unable to load mitogen module." )
36
40
37
- with patching .patch_version ():
41
+ if mitogen_version == "0.3.4" :
42
+ from . import patching
43
+
44
+ with patching .patch_version ():
45
+ from ansible_mitogen .plugins .strategy .mitogen_free import *
46
+ else :
38
47
from ansible_mitogen .plugins .strategy .mitogen_free import *
Original file line number Diff line number Diff line change 15
15
short_description: Mitogen patching strategy
16
16
"""
17
17
18
- from . import patching
18
+ import importlib . metadata
19
19
20
- with patching .patch_version ():
20
+ try :
21
+ mitogen_version = importlib .metadata .version ("mitogen" )
22
+ except importlib .metadata .PackageNotFoundError :
23
+ raise ImportError ("Unable to load mitogen module." )
24
+
25
+ if mitogen_version == "0.3.4" :
26
+ from . import patching
27
+
28
+ with patching .patch_version ():
29
+ from ansible_mitogen .plugins .strategy .mitogen_host_pinned import *
30
+ else :
21
31
from ansible_mitogen .plugins .strategy .mitogen_host_pinned import *
Original file line number Diff line number Diff line change 15
15
short_description: Mitogen patching strategy
16
16
"""
17
17
18
- from . import patching
18
+ import importlib . metadata
19
19
20
- with patching .patch_version ():
20
+ try :
21
+ mitogen_version = importlib .metadata .version ("mitogen" )
22
+ except importlib .metadata .PackageNotFoundError :
23
+ raise ImportError ("Unable to load mitogen module." )
24
+
25
+ if mitogen_version == "0.3.4" :
26
+ from . import patching
27
+
28
+ with patching .patch_version ():
29
+ from ansible_mitogen .plugins .strategy .mitogen_linear import *
30
+ else :
21
31
from ansible_mitogen .plugins .strategy .mitogen_linear import *
You can’t perform that action at this time.
0 commit comments