Skip to content
This repository has been archived by the owner on Dec 28, 2024. It is now read-only.

Does not work with ansible 2.x #49

Open
jakobwesthoff opened this issue Feb 6, 2016 · 9 comments
Open

Does not work with ansible 2.x #49

jakobwesthoff opened this issue Feb 6, 2016 · 9 comments

Comments

@jakobwesthoff
Copy link

The currently installed dependency using pip is ansible 2.0.0.2. Unfortunately this does not work with battleschool.

It seems the templates package moved from utils.templates to .templates

Current workaround: manually install ansible 1.x (>= 1.9.1) before installing battleschool

@qbunt
Copy link

qbunt commented Jul 19, 2016

@jakobwesthoff Have you had any luck with newer versions of Ansible?

@ksylvan
Copy link

ksylvan commented Jul 29, 2016

@jakobwesthoff 👍 So is the only change to battle school the move of the templates package?

@spencergibb
Copy link
Owner

Anyone up for a PR?

@ksylvan
Copy link

ksylvan commented Jul 29, 2016

I don't think it's as simple as editing a few import statements:

diff --git a/lib/battleschool/main.py b/lib/battleschool/main.py
index a3b943b..2a8abd7 100644
--- a/lib/battleschool/main.py
+++ b/lib/battleschool/main.py
@@ -5,8 +5,8 @@ import battleschool.constants as C
 AC.DEFAULT_CALLBACK_PLUGIN_PATH = C.DEFAULT_CALLBACK_PLUGIN_PATH

 import ansible.playbook
-import ansible.utils.template
-from ansible import callbacks
+import ansible.template
+from ansible.plugins import callback
 from ansible import errors
 from ansible import utils

And now getting errors like this:

$ battle
Traceback (most recent call last):
  File "/usr/local/bin/battle", line 4, in <module>
    from battleschool.main import main
  File "/Library/Python/2.7/site-packages/battleschool/main.py", line 14, in <module>
    from battleschool.printing import *
  File "/Library/Python/2.7/site-packages/battleschool/printing.py", line 1, in <module>
    from ansible.callbacks import call_callback_module
ImportError: No module named callbacks

Looks like the internal Ansible APIS have changed for 2.X.

@ksylvan
Copy link

ksylvan commented Jul 31, 2016

@spencergibb this seems like what is needed: https://docs.ansible.com/ansible/porting_guide_2.0.html

I gave it a shot but am running into issues with code that uses DefaultRunnerCallbacks

@ksylvan
Copy link

ksylvan commented Jul 31, 2016

@qbunt The above is all with the latest version of ansible: 2.1.1.0

@qbunt
Copy link

qbunt commented Aug 1, 2016

I'm seeing the same thing @ksylvan, haven't performed a full OS X system provision mostly because El Capitan made the reinstall a pain. My intention was to test this with a virtualized copy of OS X but simply haven't had the time to dive in. A bunch of my playbooks written pre-2.0 are having some issues or deprecation warnings.

Hoping that once things cool down post 2.0 I can issue a couple of PRs for this.

@ksylvan
Copy link

ksylvan commented Aug 1, 2016

@qbunt I bet you could reproduce it with a VirtualBox Ubuntu image too.

@mbigras
Copy link

mbigras commented Sep 4, 2016

@qbunt I was able to follow this tutorial and get El Capitan up and running with only a few snags:

  1. On Step 5 I think there is something wrong with the syntax to remove the broken link, I ended up just opening it in finder and trashed it.
  2. There's a bit of a typo on Step 7, some of the html got stuck in the expression

Besides that it all seems to be working so far :)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants