Deploy to production failed (project_subtree_path)

After a reinstallation of all my system (OS, Node, Vagrant… all) I get this error when deploy to production:

TASK [deploy : Fail if project_subtree_path is set incorrectly] ****************
fatal: [185.14.185.42]: FAILED! => {"changed": false, "failed": true, "msg": "subtree is set to 'False' but that path does not exist in the repo. Edit `subtree_path` for 'esterpartegas.com' in `wordpress_sites.yml`."}

My directory structure is the same as it was:

-trellis
    -ansible
    -esterpartegas

And my group_vars/production/wordpress_sites.yml sites are set up without subtree path line:

esterpartegas.com:
    site_hosts:
      - esterpartegas.com
    local_path: ../esterpartegas # path targeting local Bedrock site directory (relative to Ansible root)
    repo: git@bitbucket.org:aitormendez/esterpartegas.git
    branch: master
    #subtree_path: # relative path to your Bedrock/WP directory in your repo (above) if it is not the root (like the roots-example-project structure)
    multisite:
      enabled: false
      subdomains: false
    ssl:
      enabled: false
    cache:
      enabled: false
      duration: 30s
    system_cron: true

What is wrong?
Thank you very much.

(Some months ago I had this issue with subtree paths, it was fixed with above config, commenting subtree path line)

I haven’t explored enough to be certain of what is causing this issue, but here’s something that seems likely. You may have updated to Ansible 2.x since running your last deploy with this project. The Ansible CHANGELOG mentions:

Template code now retains types for bools and numbers instead of turning them into strings

Trellis conditionals related to subtree formerly relied on Ansible converting bools to strings but @swalkinshaw updated this here (roots/trellis#463 Jan 14, 2016). There was also another (prior) update to the subtree handling that doesn’t appear in your project (roots/trellis#451 Dec 28, 2015).

My guess is that the easiest resolution to the issue you’ve posted would be to update your Trellis.

So, if your repo has that same structure (i.e., repo corresponds to trellis dir) then you’ll need repo_subtree_path: esterpartegas. If your repo contains only the esterpartegas directory, then you can comment out the repo_subtree_path variable.

2 Likes

If I undestand, there is a incompatibility between new version of Trellis and old configurations. So, I should install new version of trellis and to set up the project from scratch.

Ok, I’m doing it and I have some new issues. In order to keep clean this post I will open a separate issue to face it. I will come back here when finish.

Thanks a lot.

To rephrase it, I’d say, “There may be a compatibility issue after having updated Ansible but not Trellis. You probably need to bring in the Trellis compatibility fixes for Ansible 2.x”

Although you could “set up the project from scratch,” I don’t think you need to. If your project is still a git repo, you could be sure you have the official roots/trellis repo as a remote, e.g., named upstream, then…

This would merge Trellis updates into your existing project.

If you originally cloned the roots/roots-example-project.com repo instead, you could pull in the relevant updates from there.

If neither of the above (e.g., if you manually followed the steps in the example project’s README), you could git cherry-pick the Trellis updates you need from roots/trellis.

In a pinch, if you don’t have time to update, you may be able to make one edit to get past the original error you reported. Just force the string version of 'False' by adding quotes to the default here (and capitalize the letter F).

- project_subtree_path: "{{ project.subtree_path | default(false) }}"
+ project_subtree_path: "{{ project.subtree_path | default('False') }}"
1 Like