我正在尝试使用下面的dsc_authenticationinfo => {"Anonymous"=>false, "Basic"=>false, "Digest"=>false, "Windows"=>true},
获取could not evaluate
错误。此属性位于dsc_xwebsite {}。
dsc_xwebsite{$app_dns_name:
dsc_ensure => 'Present',
dsc_name => $app_dns_name,
dsc_state => 'Started',
dsc_physicalpath => $app_webroot_path,
dsc_applicationpool => $app_pool_name,
dsc_bindinginfo => [{
protocol => 'HTTP',
port => 80,
hostname => $app_dns_name,
}],
dsc_authenticationinfo => {"Anonymous"=>true, "Basic"=>true, "Digest"=>true, "Windows"=>true},
}
我的Windows 2012 R2主机上出现以下错误。
Error: /Stage[main]/Profiles::Iis_tools/Dsc_xwebsite[tools-dev.domain.com]: Could not evaluate: Convert property 'authenticationinfo' value from type 'INSTANCE[]' to type 'INSTANCE' failed
At line:31, char:2
Buffer:
ls-dev.domain.com";
};^
insta
答案 0 :(得分:0)
我不熟悉Puppet语法,但是将你的puppet代码与下面的一些工作DSC进行比较,看起来你的身份验证代码的格式应该更像你的绑定代码,所以
dsc_authenticationinfo =>
{"Anonymous"=>true, "Basic"=>true, "Digest"=>true, "Windows"=>true},
应该是:
dsc_authenticationinfo =>
{dsc_anonymous => true, dsc_basic => true, dsc_digest => true, dsc_windows => true},
但是,您的错误消息:
“将'INSTANCE []'类型的属性'authenticationinfo'值转换为 键入'INSTANCE'失败“
表示您在预期使用单个authenticationinfo时传递数组?您的dsc_authenticationinfo值不在方括号中,这对我来说是正确的;我希望您发布的代码和错误消息不同步,上面的代码更改将解决您的问题。
作为参考,这是有效的DSC代码。请注意,BindingInfo是一个数组,而AuthenticationInfo是单个实例:
xWebSite DefaultWebSite_Site
{
Name = "Default Web Site"
Ensure = "Present"
State = "Started"
ApplicationPool = "DefaultAppPool"
PhysicalPath = "%SystemDrive%\inetpub\wwwroot" # must already exist
LogPath = "D:\IISLogs"
DependsOn = "[xWebAppPool]DefaultAppPool_Pool"
BindingInfo =
@(
MSFT_xWebBindingInformation
{
Protocol = "http"
Port = "80"
IPAddress = "*"
}
)
AuthenticationInfo =
MSFT_xWebAuthenticationInformation
{
Anonymous = $true
Basic = $false
Digest = $false
Windows = $false
}
}
答案 1 :(得分:0)
这是1)微软DSC代码文档的问题。 2)puppetlabs \ dsc模块中的不正确实现。 MS文档已修复,DSC模块自版本1.2.0起修复。