Skip to content
This repository has been archived by the owner on Feb 13, 2023. It is now read-only.

Commit

Permalink
Merge pull request #663 from danbohea/662
Browse files Browse the repository at this point in the history
Setting configure_local_drush_aliases to false now behaves as expected.
  • Loading branch information
geerlingguy committed Jun 4, 2016
2 parents f76446f + d33cb4d commit bb742e3
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 7 deletions.
2 changes: 1 addition & 1 deletion default.config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ drupalvm_cron_jobs: []

# Drupal VM automatically creates a drush alias file in your ~/.drush folder if
# this variable is 'true'.
configure_local_drush_aliases: true
configure_drush_aliases: true

# Apache VirtualHosts. Add one for each site you are running inside the VM. For
# multisite deployments, you can point multiple servernames at one documentroot.
Expand Down
2 changes: 1 addition & 1 deletion docs/extras/drush.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ $ drush @drupalvm.dev status

Drupal VM automatically generates a drush alias file in `~/.drush/drupalvm.aliases.drushrc.php` with an alias for every site you have defined in the `apache_vhosts` variable.

You can disable Drupal VM's automatic Drush alias file management if you want to manage drush aliases on your own. Just set the `configure_local_drush_aliases` variable in `config.yml` to `false`.
You can disable Drupal VM's automatic Drush alias file management if you want to manage drush aliases on your own. Just set the `configure_drush_aliases` variable in `config.yml` to `false`.

## Using sql-sync

Expand Down
14 changes: 11 additions & 3 deletions provisioning/tasks/drush-aliases.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,25 @@
---
# TODO: Deprecate legacy variable & remove shim in next major release.
- name: Shim for legacy configure_local_drush_aliases variable.
set_fact:
configure_drush_aliases: "{{ configure_local_drush_aliases }}"
when: configure_local_drush_aliases is defined and configure_drush_aliases is undefined

- name: Check if local Drush configuration folder exists.
stat:
path: ~/.drush
register: local_drush_config_folder
delegate_to: 127.0.0.1
become: no
when: configure_local_drush_aliases
when: configure_drush_aliases

- name: Create Drush configuration folder if it doesn't exist.
file:
path: ~/.drush
state: directory
delegate_to: 127.0.0.1
become: no
when: configure_local_drush_aliases and (local_drush_config_folder.stat.exists == false)
when: configure_drush_aliases and (local_drush_config_folder.stat.exists == false)

# Note that this doesn't work for Windows, since Ansible's running in the VM.
- name: Configure host machine drush aliases.
Expand All @@ -22,7 +28,7 @@
dest: "~/.drush/{{ vagrant_machine_name }}.aliases.drushrc.php"
delegate_to: 127.0.0.1
become: no
when: configure_local_drush_aliases
when: configure_drush_aliases

- name: Ensure drush directory exists for vagrant user inside VM.
file: 'path="~/.drush" state=directory'
Expand All @@ -33,6 +39,7 @@
src: ../templates/drupalvm-local.aliases.drushrc.php.j2
dest: "~/.drush/{{ vagrant_machine_name }}.aliases.drushrc.php"
become: no
when: configure_drush_aliases

- name: Ensure drush directory exists for root user inside VM.
file: 'path="~/.drush" state=directory'
Expand All @@ -41,3 +48,4 @@
template:
src: ../templates/drupalvm-local.aliases.drushrc.php.j2
dest: "~/.drush/{{ vagrant_machine_name }}.aliases.drushrc.php"
when: configure_drush_aliases
4 changes: 2 additions & 2 deletions provisioning/templates/dashboard.html.j2
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
<tr>
<td><a href="http://{{ servername }}">{{ servername }}</a></td>
<td><code>{{ docroot }}</code></td>
{% if configure_local_drush_aliases %}
{% if configure_drush_aliases %}
<td><code>drush @{{ vagrant_machine_name }}.{{ servername }}</code></td>
{% endif %}
</tr>
Expand Down Expand Up @@ -90,7 +90,7 @@
<tr>
<th>Hostname</th>
<th>Document Root</th>
{% if configure_local_drush_aliases -%}
{% if configure_drush_aliases -%}
<th>Drush alias*</th>
{%- endif %}
</thead>
Expand Down

0 comments on commit bb742e3

Please sign in to comment.