Skip to content

Commit fd37aff

Browse files
authored
Merge pull request #18 from EncoreTechnologies/hotfix/find-module-source-optional
Fix optional source parameter for package resource
2 parents 060fdb5 + d33f0a7 commit fd37aff

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
## Development
22

3+
* Fixed bug in `package` where the `source` parameter was always inserted when checking for the
4+
latest version of a module. (Bugfix) #13
5+
36
## 2.1.1 (2020-10-27)
47

58
* Fixed bug where CDNs requiring TLSv1.2 caused an idempotency issue in `psrepository` on

lib/puppet/provider/package/powershellcore.rb

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,12 @@ def uninstall
3636
end
3737

3838
def latest
39-
result = self.class.invoke_ps_command latest_command
39+
result = self.class.invoke_ps_command(latest_command)
4040
result[0].strip
4141
end
4242

4343
def update
44-
self.class.invoke_ps_command update_command
44+
self.class.invoke_ps_command(update_command)
4545
end
4646

4747
# Turns a array of install_options into flags to be passed to a command.
@@ -101,7 +101,10 @@ def uninstall_command
101101

102102
# Command to fetch latest version of powershell modules
103103
def latest_command
104-
"$mod = Find-Module #{@resource[:name]} -Repository #{@resource[:source]}; $mod.Version.ToString()"
104+
command = "$mod = Find-Module #{@resource[:name]}"
105+
command << " -Repository #{@resource[:source]}" if @resource[:source]
106+
command << '; $mod.Version.ToString()'
107+
command
105108
end
106109

107110
# Command to update powershell modules

0 commit comments

Comments
 (0)