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

Unable to run on a fresh install, "Unable to find an inventory file" #37

Closed
OldhamMade opened this issue Jun 20, 2015 · 6 comments
Closed

Comments

@OldhamMade
Copy link
Contributor

Trying to use battleschool on a brand new install, but I'm getting the error below. Steps I followed to get to this point:

  • install Xcode command-line tools
  • curl -Ls https://bootstrap.pypa.io/get-pip.py | sudo python
  • sudo pip install battleschool

Then (using the example file from the docs):

[mac:~ home]$ battle --config-file https://db.tt/aG2uyydU
Traceback (most recent call last):
  File "/usr/local/bin/battle", line 7, in <module>
    sys.exit(main(sys.argv[1:]))
  File "/Library/Python/2.7/site-packages/battleschool/main.py", line 118, in main
    inventory = ansible.inventory.Inventory(options.inventory)
  File "/Library/Python/2.7/site-packages/ansible/inventory/__init__.py", line 139, in __init__
    raise errors.AnsibleError("Unable to find an inventory file, specify one with -i ?")
ansible.errors.AnsibleError: Unable to find an inventory file, specify one with -i ?

Unable to progress past this point.

/usr/share/battleschool/defaults/hosts doesn't exist, actual location is /Library/Python/2.7/site-packages/usr/share/battleschool/defaults/hosts

@spencergibb
Copy link
Owner

@OldhamMade when I install fresh, the file gets put into /usr/share/battleschool/defaults/hosts. What does the output of env look like?

@OldhamMade
Copy link
Contributor Author

env says the user is me, and I've also tried installing from a version of Python & pip installed via homebrew, but I'm still getting the same issues.

I've worked round the problem by symlinking /Library/Python/2.7/site-packages/usr/share/battleschool/defaults/hosts to /usr/share/battleschool/defaults/hosts after installing battleschool.

@fearoffish
Copy link

Fresh El Capitan install. Installed Homebrew, installed python, pip installed battleschool. I get the same as above.

@echohack
Copy link

echohack commented Oct 3, 2015

+1, I think this might be related to the SIP https://en.wikipedia.org/wiki/System_Integrity_Protection

Tried to hack things and got something to work at least.

  1. Turn off SIP:
    Reboot > hold cmd+r > open terminal > csrutil disable
  2. Own and create directory:
    mkdir -p /usr/share/battleschool/defaults
    sudo chown -R $(whoami):admin /usr/share

I hacked together the hosts file in /usr/share/battleschool/defaults/hosts but I don't think mine is correct:

localhost ansible_connection=local

What is the default hosts file that battleschool generates?
Can you point me to the code that generates the host file? I'm curious if it creates it on first install or something like that.

But basically the main problem here is that the hosts file is living under /usr, and with SIP that makes it very difficult for first installs.

Not sure what the long term solution is here... maybe we should include a hosts file in our battleschool config directory? (like ~/.battleschool)

@vladdancer
Copy link
Contributor

@fearoffish I think it's not a big issue. You can fix this on fresh install on El Capitan with installed battle school:

cd ~ && mkdir .battleschool
cat /usr/local/lib/python2.7/site-packages/usr/share/battleschool/defaults/hosts > .battleschool/hosts
battle -i .battleschool/hosts

@spencergibb
Copy link
Owner

fixed via ae22fb6

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