[yarn] Set name_version when version is not specified (#62348)

* Set name_version when version is not specified, fix #55097

This will default to installing the latest version available

* Add changelog fragment

* update changelog
This commit is contained in:
Rohit Gohri 2019-11-23 13:56:35 +05:30 committed by Felix Fontein
parent eb3da65886
commit 136dc27572
2 changed files with 5 additions and 0 deletions

View file

@ -0,0 +1,3 @@
---
bugfixes:
- yarn - handle no version when installing module by name (https://github.com/ansible/ansible/issues/55097)

View file

@ -183,6 +183,8 @@ class Yarn(object):
if kwargs['version'] and self.name is not None: if kwargs['version'] and self.name is not None:
self.name_version = self.name + '@' + str(self.version) self.name_version = self.name + '@' + str(self.version)
elif self.name is not None:
self.name_version = self.name
def _exec(self, args, run_in_check_mode=False, check_rc=True): def _exec(self, args, run_in_check_mode=False, check_rc=True):
if not self.module.check_mode or (self.module.check_mode and run_in_check_mode): if not self.module.check_mode or (self.module.check_mode and run_in_check_mode):