-
Notifications
You must be signed in to change notification settings - Fork 903
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
Choco new silentargs can't pass in args in the param=value format #510
Comments
Interesting. This is in the template? What exactly does it look like? Like this? silentarg="/qn /norestart USE_SETTINGS_FROM_AD=0" |
and how are you calling choco new? |
Ooooh, wait - |
To pass arguments with spaces - https://github.com/chocolatey/choco/wiki/CommandsReference#how-to-pass-options--switches tl;dr: Depending on whether you are running the command from powershell.exe or cmd.exe, this is how you should pass it: |
I think you also brought to light that in the default template this is broken - if you create a template and drop it into a template location as a replacement - add the SilentArgs back in as
|
Running that command with the apostrophes in double quotes doesn't succeed in either cmd or powershell.
In my template, I had added the [[SilentArgs]]: $packageArgs = @{
packageName = $packageName
file = $fileLocation
fileType = '[[InstallerType]]' #only one of these: exe, msi, msu
silentArgs = "[[SilentArgs]]"
validExitCodes= @(0, 3010, 1641)
} Result $packageArgs = @{
packageName = $packageName
file = $fileLocation
fileType = 'EXE_MSI_OR_MSU' #only one of these: exe, msi, msu
silentArgs = ""
validExitCodes= @(0, 3010, 1641)
} This template succeeds if I don't pass the = operator.
$packageArgs = @{
packageName = $packageName
file = $fileLocation
fileType = 'EXE_MSI_OR_MSU' #only one of these: exe, msi, msu
silentArgs = "/qn /norestart USE_SETTINGS_FROM_AD 0"
validExitCodes= @(0, 3010, 1641)
} |
I'm going to try with |
It's a bug. |
The code splits on |
Do you have a workaround for now? |
Yeah, we have a workaround. All I have to do is manually edit the file before packing it. |
Thanks for looking into it! I was sure I was going crazy there for a while. |
Almost fully automated package creation, you will have to tell me about that sometime 👍 |
… the param=value format
I have created Pull Request #513 to fix the issue. if you like the fix, please can you merge. Thanks |
The missing SilentArgs template value has been missing since 0.9.9.7 - 7b468c8 was the commit that introduced the regression. |
The SilentArgs argument can be specified with choco new, however the template value was not in the install template. It was removed in 7b468c8. Add the template value back in.
I've added the fix for allowing silentargs again in the default template. I see @sahebjade has created a PR to fix the |
* stable: (maint) formatting (spec) Ensure MockLogger is setup first in test suite (specs) Allow for nupkgs to finish copying (specs) use deep copy for config (GH-516) Fix: Log.InitializeWith doesn't clear cached loggers (GH-445) Only fail scripts on non-zero exit code (GH-510) allow silentargs in template
Some installers, MSIs in particular, specify silent arguments as PROPERTY=value. Attempting to pass that in with `choco new silentargs="/qn /norestart PROPERTY=value` will cause choco to pass an empty string value in place of the passed arguments. Fix the behavior to do the right thing when splitting the property settings so that `=` can be passed as part of the arguments.
* stable: (GH-510) Fix: args for new fail with param=value
Thanks! I just rebased this to stable and updated the commit message. This will go out in the next beta release in a couple of hours. |
Some applications like Operations Manager use a similar format to choco new to do pass in their arguments, e.g. USE_SETTINGS_FROM_AD={0|1} . (https://technet.microsoft.com/en-us/library/hh230736.aspx)
Creating a new package from template with silentarg="/qn /norestart USE_SETTINGS_FROM_AD=0" will create an emtpy string in the chocolateyInstall.ps1 file. I've tried quoting it several different ways (double quotes, single quotes, double quotes around single quotes, etc).
This is using Chocolatey v0.9.10-beta1
The text was updated successfully, but these errors were encountered: