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

Lint: Fix [301] Commands should not change things if nothing needs doing #1139

Merged
merged 4 commits into from
Feb 22, 2020

Conversation

tangrufus
Copy link
Member

No description provided.

@@ -2,6 +2,7 @@
- name: reload nginx
command: nginx -t
notify: "{{ (role_path | basename == 'common') | ternary('perform nginx reload', omit) }}"
changed_when: false
Copy link
Member

Choose a reason for hiding this comment

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

🤔 I think this is breaking things. Both in production and with Vagrant Nginx isn't reloading and you just get the default Nginx page. I'll test without it.

Copy link
Member

Choose a reason for hiding this comment

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

Yep this prevents nginx from actually reloading

Copy link
Member Author

Choose a reason for hiding this comment

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

Looks like we need changed_when: true to trigger notify. See: https://serverfault.com/a/799282

Copy link
Member

Choose a reason for hiding this comment

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

We still need this as changed_when: true true? Which I'm guessing fails the lint... any idea what the solution is?

Copy link
Member Author

Choose a reason for hiding this comment

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

changed_when: true passes ansible-lint and triggers nginx reload. Tested use cases:

  1. vargant up the first time
  2. change site domains and then vagrant provision

https://stackoverflow.com/a/35604895

Copy link
Member Author

Choose a reason for hiding this comment

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

It leads to the question that should we changed_when: true on other tasks:

  • Get list position of current symlinked release: No because it doesn't change anything
  • Collect list of releases: No because it doesn't change anything
  • Get name of current symlinked release: No because it doesn't change anything
  • Create or close Xdebug SSH tunnel: Yes because it changes the tunnel. See: 78ebc81

Copy link
Member

Choose a reason for hiding this comment

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

Agreed with those 👍

@tangrufus tangrufus force-pushed the lint-301 branch 2 times, most recently from 3add785 to fec1a48 Compare February 16, 2020 17:31
@tangrufus tangrufus changed the title Lint: Fix [301] Commands should not change things if nothing needs doing [WIP] Lint: Fix [301] Commands should not change things if nothing needs doing Feb 16, 2020
@tangrufus tangrufus changed the title [WIP] Lint: Fix [301] Commands should not change things if nothing needs doing Lint: Fix [301] Commands should not change things if nothing needs doing Feb 22, 2020
@tangrufus tangrufus merged commit 6633370 into roots:master Feb 22, 2020
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