Unable to deploy to production

I am encountering possibly a bug in Ansible. I’m using a previous version of trellis and following this guide on how to deploy:

When I ran deploy step (server was already provisioned before and I deploy using the command: ./deploy.sh production <my_domain>), it has this weird issue:

ERROR! Unexpected Exception: must be string, not None

Here is the full log using -vvv:

Using /Users/conceptualcode/Workspace/onestarhouseparty.com/trellis/ansible.cfg as config file
statically included: /Users/conceptualcode/Workspace/onestarhouseparty.com/trellis/roles/deploy/tasks/initialize.yml
statically included: /Users/conceptualcode/Workspace/onestarhouseparty.com/trellis/roles/deploy/tasks/update.yml
statically included: /Users/conceptualcode/Workspace/onestarhouseparty.com/trellis/roles/deploy/tasks/prepare.yml
statically included: /Users/conceptualcode/Workspace/onestarhouseparty.com/trellis/roles/deploy/tasks/build.yml
statically included: /Users/conceptualcode/Workspace/onestarhouseparty.com/trellis/roles/deploy/tasks/share.yml
statically included: /Users/conceptualcode/Workspace/onestarhouseparty.com/trellis/roles/deploy/tasks/finalize.yml
ERROR! Unexpected Exception: must be string, not None
the full traceback was:

Traceback (most recent call last):
  File "/usr/local/bin/ansible-playbook", line 103, in <module>
    exit_code = cli.run()
  File "/Library/Python/2.7/site-packages/ansible/cli/playbook.py", line 157, in run
    results = pbex.run()
  File "/Library/Python/2.7/site-packages/ansible/executor/playbook_executor.py", line 89, in run
    self._tqm.load_callbacks()
  File "/Library/Python/2.7/site-packages/ansible/executor/task_queue_manager.py", line 184, in load_callbacks
    for callback_plugin in callback_loader.all(class_only=True):
  File "/Library/Python/2.7/site-packages/ansible/plugins/__init__.py", line 394, in all
    self._module_cache[path] = self._load_module_source(name, path)
  File "/Library/Python/2.7/site-packages/ansible/plugins/__init__.py", line 324, in _load_module_source
    module = imp.load_source(name, path, module_file)
  File "/Library/Python/2.7/site-packages/ansible/plugins/callback/foreman.py", line 30, in <module>
    import requests
  File "/Library/Python/2.7/site-packages/requests/__init__.py", line 52, in <module>
    from .packages.urllib3.contrib import pyopenssl
  File "/Library/Python/2.7/site-packages/requests/packages/urllib3/contrib/pyopenssl.py", line 47, in <module>
    from cryptography import x509
  File "/Library/Python/2.7/site-packages/cryptography/x509/__init__.py", line 7, in <module>
    from cryptography.x509.base import (
  File "/Library/Python/2.7/site-packages/cryptography/x509/base.py", line 15, in <module>
    from cryptography.hazmat.primitives.asymmetric import dsa, ec, rsa
  File "/Library/Python/2.7/site-packages/cryptography/hazmat/primitives/asymmetric/rsa.py", line 14, in <module>
    from cryptography.hazmat.backends.interfaces import RSABackend
  File "/Library/Python/2.7/site-packages/cryptography/hazmat/backends/__init__.py", line 7, in <module>
    import pkg_resources
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 2784, in <module>
    _declare_state('object', working_set = WorkingSet())
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 434, in __init__
    self.add_entry(entry)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 448, in add_entry
    for dist in find_distributions(entry, True):
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 1806, in find_distributions
    importer = get_importer(path_item)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/pkgutil.py", line 384, in get_importer
    importer = path_hook(path_item)
TypeError: must be string, not None

I don’t really know what to do to debug this, I deployed the website using the same command 2 days ago and it was fine.

I would greatly appreciate if somebody could help me.

Have you changed Ansible versions before trying to do this deploy?

1 Like

@Jon I’m happy to see you here :smiley: I didn’t touched Ansible :confused: I don’t know if it’s relevant or not but I did create a new user account on my machine and then install Python with Anaconda packages because I need that stuff for my school data mining projects. I’ll try downgrading to Ansible 2.2.0 right now (it’s 2.3.0 in my machine now)

@Jon After downgrading to Ansible 2.2.0 it still has the same issue :confused: I swear that 2 days before it was all fine, I deployed multiple times to the remote server. Do you have any idea on how I can further debug this?

@Jon Somehow there was a problem with python’s package folder. I ran:
brew link --overwrite python then everything works fine

1 Like