TASK [deploy : Fail if repo_subtree_path is set incorrectly] *******************
System info:
Ansible 2.2.2.0; Linux
Trellis at "Allow for per-project packagist.com authentication"
---------------------------------------------------
The conditional check 'project_subtree_full_path is defined and not
project_subtree_full_path.stat.exists' failed. The error was: error while
evaluating conditional (project_subtree_full_path is defined and not
project_subtree_full_path.stat.exists): 'dict object' has no attribute 'stat'
The error appears to have been in
'/home/my/path/to/trellis/roles/deploy/tasks/prepare.yml': line 16,
column 3, but may
be elsewhere in the file depending on the exact syntax problem.
The offending line appears to be:
- name: Fail if repo_subtree_path is set incorrectly
^ here
Nothing has changed in my wordpress_sites.yml, since previous succesfull deploys. The repo_subtree_path line is still commented out as always. Only thing I can think of that has changed recently is an update of Ansible on my local machine, from 2.2.1.0 to 2.2.2.0.
Updated to the latest Trellis Head and it fails with the same error.
Installing the previous Ansible 2.2.1.0 and it deploys fine, so I guess it’s related to the latest Ansible version.
@richardwilis Thanks for reporting this. I can reproduce on 2.2.2.0. For now, using 2.2.1.0 is a good workaround till we get a fix pushed to Trellis.
I didn’t notice this issue you posted here because so far I had only tested 2.2.2.0 with Trellis defaults, whereas you have a non-default config (repo_subtree_path commented out, which is perfectly acceptable). I want search the codebase for other potential instances of this new issue that could occur with other non-default configs (e.g., running different sets of tasks, etc.)
Whereas 2.2.1.0 left the project_subtree_full_path registered var undefined when its task skipped, 2.2.2.0 now defines the var. Whereas the when: project_subtree_full_path is defined and ... condition made the “Fail if repo_subtree_path is set incorrectly” task skip back on 2.2.1.0,
the condition now evaluates true and lets the task run, leading to the failure. A likely fix for this task is to borrow the parallel condition from the prior task.
- when: project_subtree_full_path is defined and not project_subtree_full_path.stat.exists
+ when: project.repo_subtree_path is defined and not project_subtree_full_path.stat.exists
I’ll check for other similar problems and push 2.2.2.0 compatibility fixes soon.
i downgraded from Ansible 2.2.2.0 to 2.2.1.0 and tried this fix but the next Error appears.
Maybe my trellis is to old. With Ansible 2.0.2.0 it works.
< TASK [deploy : Copy project templates] >
fatal: [46.101.187.105]: FAILED! => {"failed": true, "msg": "the field 'args' has an invalid value, which appears to include a variable that is undefined. The error was: 'ansible.vars.unsafe_proxy.AnsibleUnsafeText object' has no attribute 'dest'\n\nThe error appears to have been in 'projectpath/trellis/roles/deploy/tasks/build.yml': line 5, column 3, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n\n- name: Copy project templates\n ^ here\n"}
@fabian I’d recommend getting your Trellis all up-to-date with the latest, benefitting from all the little fixes for different Ansible releases.
However, for the has no attribute 'dest' portion of the error you posted re: 2.2.1.0, I believe you could resolve that with the updates from a year ago in https://github.com/roots/trellis/pull/523/files
Same error on ansible 2.3 on Ubuntu 16.04, installed ansible 2.1 (couldn’t find 2.2 via apt-get), solved the problem. Hope to not get locked forever with 2.1