(PUP-748) Fix the zypper package provider support for install_options.#2441
(PUP-748) Fix the zypper package provider support for install_options.#2441peterhuene merged 2 commits intopuppetlabs:masterfrom
Conversation
When install_options is a hash, the options are rendered with a space. This is causing zypper to interpret the option incorrectly when using Kernel.exec. For example, this fails with "unknown option '--from 1'": Kernel.exec 'zypper', 'install', '--from 1', 'vim' While this succeeds: Kernel.exec 'zypper', 'install', '--from=1', 'vim' The fix is to use the supported option syntax that uses an equal sign instead of a space. Also flattening the options instead of joining them so that multiple options in a hash are not interpreted as a single option.
Remove expected nil when calling execute without install_options. Add specs for install_options as a hash, array, or string.
There was a problem hiding this comment.
Note to reviewers: we don't need to quote the value here because this is already handled for us in package_options.rb.
|
CLA signed by all contributors. |
|
👍 |
There was a problem hiding this comment.
Tiny nitpick - why += here instead of <<?
There was a problem hiding this comment.
I think I had it that way before I refactored the options code a little. I can change it for consistency's sake.
There was a problem hiding this comment.
Oh right, it's that way because install_options returns an array and I wanted the two arrays joined, not the options array appended. i.e. a = [1, 2, 3]; a += [4] => [1, 2, 3, 4] instead of [1, 2, 3] << [4] => [1, 2, 3, [4]]
There was a problem hiding this comment.
GAAAH. That catches me every time. 👍
(PUP-748) Fix the zypper package provider support for install_options.
When install_options is a hash, the options are rendered with a space.
This is causing zypper to interpret the option incorrectly when
using Kernel.exec.
For example, this fails with "unknown option '--from 1'":
Kernel.exec 'zypper', 'install', '--from 1', 'vim'
While this succeeds:
Kernel.exec 'zypper', 'install', '--from=1', 'vim'
The fix is to use the supported option syntax that uses
an equal sign instead of a space.
Also flattening the options instead of joining them so that
multiple options in a hash are not interpreted as a single option.