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

Install WP-CLI packages #837

Merged
merged 4 commits into from
Jun 18, 2017
Merged

Install WP-CLI packages #837

merged 4 commits into from
Jun 18, 2017

Conversation

QWp6t
Copy link
Member

@QWp6t QWp6t commented Jun 9, 2017

No description provided.

@fullyint
Copy link
Contributor

fullyint commented Jun 9, 2017

Looks good to me!

@@ -23,3 +23,10 @@
warn: false
register: wp_cli_completion
changed_when: wp_cli_completion.stdout == 'wp-completion-' + wp_cli_version + '.bash'

- name: Install WP-CLI packages
command: "wp package install {{ item }}"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nitpick: double quotes are only necessary if the {{ jinja }} begins the variable value, so this could just be

- command: "wp package install {{ item }}"
+ command: wp package install {{ item }}

I realize Trellis is not always consistent on this, but the general goal has been to use quotes only when absolutely needed.

command: "wp package install {{ item }}"
become_user: "{{ web_user }}"
register: wp_cli_packages_installed
changed_when: "'Nothing to install or update' not in wp_cli_packages_installed.stdout"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While testing, I noticed that in some cases stdout for already-installed packages did not include 'Nothing to install or update' but instead included 'Package operations: 0 installs, 0 updates, 0 removals'. This meant that sometimes Ansible inaccurately reported changed for packages that were already installed.

How does this modification look to you?

- changed_when: "'Nothing to install or update' not in wp_cli_packages_installed.stdout"
+ changed_when:
+   - "'Nothing to install or update' not in wp_cli_packages_installed.stdout"
+   - "'Package operations: 0 installs, 0 updates, 0 removals' not in wp_cli_packages_installed.stdout"

I would have preferred to be more concise by checking for a string that is unique to when packages are freshly installed but I didn't observe any such string.

@fullyint
Copy link
Contributor

thank you!

@fullyint fullyint deleted the wp-cli-packages branch June 18, 2017 16:17
primozcigler added a commit to primozcigler/trellis that referenced this pull request Jun 26, 2017
* master: (120 commits)
  Reload Nginx with updates to manual cert or key (roots#843)
  Add self signed certificates subdomains (roots#812)
  Add support for SMTP without authentication
  Remove output about running WP-CLI and Composer
  Option to install WP-CLI packages (roots#837)
  Update WP theme paths only when template_root in releases_path (roots#840)
  Update wp-cli to 1.2.1 (roots#838)
  skip plugins with WP-CLI, to avoid crappy plugins breaking deploys
  Add options for sources and version
  Add re-run vagrant up message
  Remove plugins from README
  Auto-install Vagrant plugins
  Fixes
  Add Vagrant config support
  Use python slice on password salt instead of Jinja2 truncate()
  Avoid single var containing jinja delimiters in when parameter
  Remove jinja delimiters from tasks' when parameter
  Update connection test for new dense.py callback in Ansible 2.3
  Deploys: Make wp core update-db optional (roots#827)
  Use a block
  ...

# Conflicts:
#	Vagrantfile
#	ansible.cfg
skemantix pushed a commit to skemantix/trellis that referenced this pull request Sep 4, 2017
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

Successfully merging this pull request may close these issues.

2 participants