Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix failing Travis tests - dirs are symlinks inside Travis #8

Closed
geerlingguy opened this issue Jan 26, 2016 · 2 comments
Closed

Fix failing Travis tests - dirs are symlinks inside Travis #8

geerlingguy opened this issue Jan 26, 2016 · 2 comments

Comments

@geerlingguy
Copy link
Owner

Travis' Ubuntu 12.04 instance uses symlinks for some of the PHP configuration paths, meaning I get failures like:

TASK: [ansible-role-php-xhprof | Ensure PHP configuration directories exist.] *** 
ok: [localhost] => (item=/etc/php5/apache2/conf.d)
failed: [localhost] => (item=/etc/php5/cli/conf.d) => {"failed": true, "gid": 0, "group": "root", "item": "/etc/php5/cli/conf.d", "mode": "0777", "owner": "root", "path": "/etc/php5/cli/conf.d", "size": 9, "state": "link", "uid": 0}
msg: /etc/php5/cli/conf.d already exists as a link
failed: [localhost] => (item=/etc/php5/fpm/conf.d) => {"failed": true, "gid": 0, "group": "root", "item": "/etc/php5/fpm/conf.d", "mode": "0777", "owner": "root", "path": "/etc/php5/fpm/conf.d", "size": 9, "state": "link", "uid": 0}
msg: /etc/php5/fpm/conf.d already exists as a link

We could switch to using an include file to do the xhprof.ini file copies, one at a time, and loop over the files (http://docs.ansible.com/ansible/playbooks_loops.html#loops-and-includes), and use stat or custom commands to determine if the dirs already exist before creating them.

Or we could also switch to using a Dockerized test environment and bypass this weird Travis CI setup entirely. Or Debian could not be so wacky with having a ton of different configuration directories to configure the same thing by default. I can dream, can't I?

@geerlingguy
Copy link
Owner Author

Maybe something like:

- name: Check status of PHP configuration directories.
  stat:
    path: "{{ item }}"
  register: php_xhprof_config_dirs_stat
  with_items: php_xhprof_config_dirs

- name: Ensure PHP configuration directories exist.
  file:
    path: "{{ item }}"
    state: directory
    mode: 0755
  with_items: php_xhprof_config_dirs_stat
  when: "(item.stat.islnk is defined and item.stat.islnk) or (p.stat.isdir is defined and p.stat.isdir)"

Completely untested, and I always forget the exact way to work with loops and register, so I just need to spend some time testing until it's happy.

@geerlingguy
Copy link
Owner Author

Fixed in #12

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

No branches or pull requests

1 participant