fix: go template and does not short circuit causing nil ptr (#2217)

This commit is contained in:
David Justice 2019-10-24 14:22:16 -07:00 коммит произвёл GitHub
Родитель 8d885abef4
Коммит 26de099e87
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
4 изменённых файлов: 19 добавлений и 9 удалений

Просмотреть файл

@ -267,14 +267,14 @@ write_files:
{{CloudInitData "generateProxyCertsScript"}}
{{end}}
{{if and HasLinuxProfile HasCustomSearchDomain}}
{{if HasLinuxProfile }}{{if HasCustomSearchDomain}}
- path: /opt/azure/containers/setup-custom-search-domains.sh
permissions: "0744"
encoding: gzip
owner: root
content: !!binary |
{{CloudInitData "customSearchDomainsScript"}}
{{end}}
{{end}}{{end}}
- path: /var/lib/kubelet/kubeconfig
permissions: "0644"

Просмотреть файл

@ -268,14 +268,14 @@ write_files:
content: |
{{WrapAsParameter "clientCertificate"}}
{{if and HasLinuxProfile HasCustomSearchDomain}}
{{if HasLinuxProfile }}{{if HasCustomSearchDomain}}
- path: /opt/azure/containers/setup-custom-search-domains.sh
permissions: "0744"
encoding: gzip
owner: root
content: !!binary |
{{CloudInitData "customSearchDomainsScript"}}
{{end}}
{{end}}{{end}}
- path: /var/lib/kubelet/kubeconfig
permissions: "0644"

Просмотреть файл

@ -661,8 +661,17 @@ func TestTemplateGenerator_GetKubernetesLinuxNodeCustomDataJSONObject(t *testing
AvailabilityProfile: api.VirtualMachineScaleSets,
VnetCidrs: []string{"10.0.0.0/8"},
},
}
return *cs
},
},
{
Name: "VMSSWithNoLinuxProfile",
CSFactory: func() api.ContainerService {
cs := api.CreateMockContainerService("VMSSWithNoLinuxProfile", "1.10.13", 3, 0, false)
cs.Properties.AgentPoolProfiles = []*api.AgentPoolProfile{
{
Name: "pool2",
Name: "pool1",
Count: 1,
OSType: api.Linux,
VMSize: "Standard_D2_v2",
@ -670,6 +679,7 @@ func TestTemplateGenerator_GetKubernetesLinuxNodeCustomDataJSONObject(t *testing
VnetCidrs: []string{"10.0.0.0/8"},
},
}
cs.Properties.LinuxProfile = nil
return *cs
},
},

Просмотреть файл

@ -17293,14 +17293,14 @@ write_files:
{{CloudInitData "generateProxyCertsScript"}}
{{end}}
{{if and HasLinuxProfile HasCustomSearchDomain}}
{{if HasLinuxProfile }}{{if HasCustomSearchDomain}}
- path: /opt/azure/containers/setup-custom-search-domains.sh
permissions: "0744"
encoding: gzip
owner: root
content: !!binary |
{{CloudInitData "customSearchDomainsScript"}}
{{end}}
{{end}}{{end}}
- path: /var/lib/kubelet/kubeconfig
permissions: "0644"
@ -17935,14 +17935,14 @@ write_files:
content: |
{{WrapAsParameter "clientCertificate"}}
{{if and HasLinuxProfile HasCustomSearchDomain}}
{{if HasLinuxProfile }}{{if HasCustomSearchDomain}}
- path: /opt/azure/containers/setup-custom-search-domains.sh
permissions: "0744"
encoding: gzip
owner: root
content: !!binary |
{{CloudInitData "customSearchDomainsScript"}}
{{end}}
{{end}}{{end}}
- path: /var/lib/kubelet/kubeconfig
permissions: "0644"