-
Notifications
You must be signed in to change notification settings - Fork 904
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
Get-PackageParameters: force built-in method to be preferred over chocolatey-core.extension method #1476
Comments
Refer to issue in Core-Extension, which they don't want to fix either: chocolatey-community/chocolatey-packages#950 |
The syntax is different depending on whether the Extensions are install or not, which is bad, as you cannot assume the Extensions are installed if a package DOES NOT require them. So with the extension installed, the following syntax works:
But without the extension, the same syntax fails:
|
@deckjockey The problem here is you are not passing the parameters correctly. If you use PowerShell.exe and you run We have a published way of passing options, please see https://chocolatey.org/docs/commands-reference#how-to-pass-options-switches |
Hi Rob, My packages work fine with parameters that have spaces.. it is only when the Core-Extensions is installed that the syntax changes and then breaks my packages. The following syntax works ok with just Choco installed: But once the Core-Extensions are installed, the SEINSTALL parameter becomes D:\ccviews\Program |
It does appear that choco tends to handle it correctly, but it is still not what is prescribed in our documentation, so it's technically a bug for core.extension. |
Hi @deckjockey - we should have something in 0.10.9 that will override the core extension. |
Moved the compatibility bits to #1490 |
Ensure that Chocolatey loads its version of Get-PackageParameters with an alias.
This issue is now to ensure that the built-in Get-PackageParameters wins when there is both the built-in and the core extension. |
When renaming the function to force it's precedence over Get-PackageParameters in the core extension, that causes the documents to generate the name based on the renamed version. That needs to use the original name. Change it back in generate docs just after importing the module but prior to generating documentation.
Expected Behavior
Get-PackageParameters function supports parameters with spaces:
For example `-Parameters "/ITEM1:value /ITEM2:value with spaces"
https://chocolatey.org/docs/helpers-get-package-parameters
Current Behavior
Get-PackageParameters function supports parameters with spaces:
For example `-Parameters "/ITEM1:value /ITEM2:value with spaces"
https://chocolatey.org/docs/helpers-get-package-parameters
Possible Solution
Should Get-PackageParameters.ps1 be removed from the chocolatey-core.extension package? since it is already a function in chocolatey base package
Steps to Reproduce (for bugs)
===========================================
Install package without Extensions package:
chocolatey 0.10.8
example:
choco install nabtrade-securities-wiki --params="'/SEINSTALL:D:\ccviews\Program Files\securitease_test1'" -y
Parameters with spaces work as expected:
2018-01-18 14:15:53,850 12728 [INFO ] - Chocolatey v0.10.8
2018-01-18 14:15:53,859 12728 [DEBUG] - Chocolatey is running on Windows v 6.1.7601.65536
2018-01-18 14:15:53,862 12728 [DEBUG] - Attempting to delete file "C:/ProgramData/chocolatey/choco.exe.old".
2018-01-18 14:15:53,864 12728 [DEBUG] - Attempting to delete file "C:\ProgramData\chocolatey\choco.exe.old".
2018-01-18 14:15:53,874 12728 [DEBUG] - Command line: "C:\ProgramData\chocolatey\choco.exe" install nabtrade-securities-wiki --params="'/SEINSTALL:D:\ccviews\Program Files\securitease_test1'" -y
2018-01-18 14:15:53,875 12728 [DEBUG] - Received arguments: install nabtrade-securities-wiki --params='/SEINSTALL:D:\ccviews\Program Files\securitease_test1' -y
...
PackageParameters='/SEINSTALL:D:\ccviews\Program Files\securitease_test1'|
...
2018-01-18 14:16:35,474 12728 [DEBUG] - Calling built-in PowerShell host with ['[System.Threading.Thread]::CurrentThread.CurrentCulture = '';[System.Threading.Thread]::CurrentThread.CurrentUICulture = ''; & import-module -name 'C:\ProgramData\chocolatey_test1\helpers\chocolateyInstaller.psm1'; & 'C:\ProgramData\chocolatey_test1\helpers\chocolateyScriptRunner.ps1' -packageScript 'C:\ProgramData\chocolatey_test1\lib\nabtrade-securities-wiki\tools\chocolateyInstall.ps1' -installArguments '' -packageParameters '/SEINSTALL:D:\ccviews\Program Files\securitease_test1'']
...
2018-01-18 14:16:38,082 12728 [DEBUG] - Running 'ChocolateyScriptRunner' for nabtrade-securities-wiki v05.26.00.00 with packageScript 'C:\ProgramData\chocolatey_test1\lib\nabtrade-securities-wiki\tools\chocolateyInstall.ps1', packageFolder:'C:\ProgramData\chocolatey_test1\lib\nabtrade-securities-wiki', installArguments: '', packageParameters: '/SEINSTALL:D:\ccviews\Program Files\securitease_test1',
...
2018-01-18 14:16:38,116 12728 [INFO ] - ================================================================================
2018-01-18 14:16:38,123 12728 [INFO ] - * Getting parameters...
2018-01-18 14:16:38,152 12728 [DEBUG] - Running Get-PackageParameters
2018-01-18 14:16:38,165 12728 [DEBUG] - Parsing $env:ChocolateyPackageParameters and $env:ChocolateyPackageParametersSensitive for parameters
2018-01-18 14:16:38,180 12728 [DEBUG] - Adding package param 'SEINSTALL'='D:\ccviews\Program Files\securitease_test1'
2018-01-18 14:16:38,215 12728 [INFO ] - -> SEINSTALL parameter = D:\ccviews\Program Files\securitease_test1
2018-01-18 14:16:38,221 12728 [INFO ] - ================================================================================
========================================
Install package with Extensions package:
chocolatey 0.10.8
chocolatey-core.extension 1.3.3
example:
choco install nabtrade-securities-wiki --params="'/SEINSTALL:D:\ccviews\Program Files\securitease_test1'" -y
Parameters with spaces no longer work:
2018-01-18 14:23:06,289 13400 [INFO ] - Chocolatey v0.10.8
2018-01-18 14:23:06,298 13400 [DEBUG] - Chocolatey is running on Windows v 6.1.7601.65536
2018-01-18 14:23:06,301 13400 [DEBUG] - Attempting to delete file "C:/ProgramData/chocolatey/choco.exe.old".
2018-01-18 14:23:06,302 13400 [DEBUG] - Attempting to delete file "C:\ProgramData\chocolatey\choco.exe.old".
2018-01-18 14:23:06,310 13400 [DEBUG] - Command line: "C:\ProgramData\chocolatey\choco.exe" install nabtrade-securities-wiki --params="'/SEINSTALL:D:\ccviews\Program Files\securitease_test1'" -y
2018-01-18 14:23:06,312 13400 [DEBUG] - Received arguments: install nabtrade-securities-wiki --params='/SEINSTALL:D:\ccviews\Program Files\securitease_test1' -y
...
PackageParameters='/SEINSTALL:D:\ccviews\Program Files\securitease_test1'|
...
2018-01-18 14:23:45,378 13400 [DEBUG] - Calling built-in PowerShell host with ['[System.Threading.Thread]::CurrentThread.CurrentCulture = '';[System.Threading.Thread]::CurrentThread.CurrentUICulture = ''; & import-module -name 'C:\ProgramData\chocolatey_test1\helpers\chocolateyInstaller.psm1'; & 'C:\ProgramData\chocolatey_test1\helpers\chocolateyScriptRunner.ps1' -packageScript 'C:\ProgramData\chocolatey_test1\lib\nabtrade-securities-wiki\tools\chocolateyInstall.ps1' -installArguments '' -packageParameters '/SEINSTALL:D:\ccviews\Program Files\securitease_test1'']
...
2018-01-18 14:23:48,253 13400 [DEBUG] - Running 'ChocolateyScriptRunner' for nabtrade-securities-wiki v05.26.00.00 with packageScript 'C:\ProgramData\chocolatey_test1\lib\nabtrade-securities-wiki\tools\chocolateyInstall.ps1', packageFolder:'C:\ProgramData\chocolatey_test1\lib\nabtrade-securities-wiki', installArguments: '', packageParameters: '/SEINSTALL:D:\ccviews\Program Files\securitease_test1',
...
2018-01-18 14:23:48,280 13400 [INFO ] - ================================================================================
2018-01-18 14:23:48,288 13400 [INFO ] - * Getting parameters...
2018-01-18 14:23:48,428 13400 [INFO ] - -> SEINSTALL parameter = D:\ccviews\Program
2018-01-18 14:23:48,442 13400 [INFO ] - ================================================================================
after.choco.summary.log
after.chocolatey.log
before.choco.summary.log
before.chocolatey.log
chocolateyInstall.zip
Context
Unable to use parameters with spaces after chocolatey-core.extension is installed, so is a show stopper
Your Environment
The text was updated successfully, but these errors were encountered: