-
-
Notifications
You must be signed in to change notification settings - Fork 75
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
Adding present option for version #148
Conversation
LGTM but i should let @humblearner or @armab approve since they're more familiar with this. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of introducing another keyword present
, I'd like us to use existing state: present
block and improve existing logic. See also the following issues for more context to understand the history:
#142 and #111
Ideally is to have the following syntax working:
st2_version: latest
- as before, always tries to auto-update the package.(see UPDATE in the next message)st2_version: *
- this is exactly what's you're requesting, just make*
working instead ofpresent
naming.st2_version: 2.2.1
- pin st2 version, but use latestst2_revision
.st2_version: 2.2.1
,st2_revision: 5
- pin both package version and revision.
roles/st2/tasks/main.yml
Outdated
- restart st2 | ||
- reload st2 | ||
tags: st2, skip_ansible_lint | ||
|
||
- name: Install pinned st2 package | ||
become: yes | ||
package: | ||
name: st2={{ st2_version }}-{{ st2_revision }} | ||
state: present |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We already have state: present
logic here.
Thinking about how to use that block, instead of introducing another st2_version: present
keyword.
After playing a bit with Le me think a little & dig in further, including how Ansible |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
UPDATE:
So after further research and things like https://github.com/ansible/ansible/blob/6dd8a4cf78d4fe4216a842a461871bade9a9b5a2/lib/ansible/modules/packaging/os/apt.py#L496-L501 and https://github.com/ansible/ansible/blob/6dd8a4cf78d4fe4216a842a461871bade9a9b5a2/lib/ansible/modules/packaging/os/apt.py#L1000, here is an updated alternative syntax which I believe will work better, comparing to introducing new present
keyword:
st2_version: null
= just install st2 package (equivalent:apt/yum install st2
) (no upgrade, NEW default). Exactly what you're requesting.st2_version: latest
= always auto-upgrade to use latest package (OLD default)st2_version: 2.3
= pinned st2 package (equivalent:apt/yum install st2=2.3-*
)
@armab thoughts? If you like the direction I'll make the rest match. |
@bigmstone We've talked about the So with |
roles/st2/tasks/main.yml
Outdated
become: yes | ||
package: | ||
name: st2 | ||
state: latest | ||
when: st2_version == "latest" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm more about leaving latest
block as is for less jinja
hackery.
Looks there is no easy fix for #111 For example this construction will pin the version, but always try to update the package once there is a new revision available in a repo. So no real pinning happens here:
Another idea is that we could check if package is installed for |
5bc1fa8
to
632b6ca
Compare
roles/st2/tasks/main.yml
Outdated
- restart st2 | ||
- reload st2 | ||
tags: st2 | ||
|
||
- name: Install pinned st2 package | ||
become: yes | ||
package: | ||
name: st2={{ st2_version }}-{{ st2_revision }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After check, needs an adjustement as well, since it's apt
format: apt install st2=2.2.1-5
.
yum is different: yum install st2-2.2.1-5
.
It's interesting that revision is not a requirement for yum. It's possible to do: yum install st2-2.2.1
, while it's not possible to specify version without revision in apt: apt install st2=2.2.1
In short: this block never worked in CentOS/EL. Something that we missed in a big v0.6.0
@bigmstone FYI I reverted back to your initial commit with Will see/experiment what I can do in this and next PRs. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alright, merging initial Matt's present
proposal.
Fixed also one apt/yum
-related corner case. But as said before, initially thought abount fixing more here, but moving entire version overhaul into another issue: #150 which will probably be the breaking change.
Name says it all.
Fixes #111