无法通过确认:$ false to vmware powercli来自Groovy
我必须在Jenkins管道中使用PowerCli停止VM。 所必需的以下错误
def stopVM(String vmName) {
powershell (returnStdout: true, script: """ Stop-VM \"${vmName}\" -Confirm:$false """)
}
I have to stop the vm using PowerCLI in jenkins pipeline. getting below error while passing -Confirm:$false which is required to handle confirmation dialog
def stopVM(String vmName) {
powershell (returnStdout: true, script: """ Stop-VM \"${vmName}\" -Confirm:$false """)
}
Error in Pipeline: 'org.jenkinsci.plugins.workflow.cps.CpsCompilationErrorsException: startup failed:
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我今天在同样的问题上挣扎。逃避导致
$
符号消失,因此它不是解决方案。也使用Tripple单引号,因为我必须传递param(作为问题的所有者-VM名称),因此只有可能是连接不同类型的书面字符串。它应该是类似的:
我对该解决方案不满意,但它正在起作用(而且我找不到其他解决方案)
I was struggling with same problem today. Escaping caused
$
sign to disappear so it is not a solution. Using tripple single quotes also since I have to pass param (as owner of question - vm name) so only possibility is to join different types of written string.It should be something like:
I'm not glad of that solution but it is working (and I didn't find any other solution)