()
| 193 | } |
| 194 | |
| 195 | func (b *NodeUpScript) Build() (fi.Resource, error) { |
| 196 | if b.ProxyEnv == nil { |
| 197 | b.ProxyEnv = funcEmptyString |
| 198 | } |
| 199 | if b.EnvironmentVariables == nil { |
| 200 | b.EnvironmentVariables = funcEmptyString |
| 201 | } |
| 202 | |
| 203 | functions := template.FuncMap{ |
| 204 | "NodeUpSourceAmd64": func() string { |
| 205 | if b.NodeUpAssets[architectures.ArchitectureAmd64] != nil { |
| 206 | return strings.Join(b.NodeUpAssets[architectures.ArchitectureAmd64].Locations, ",") |
| 207 | } |
| 208 | return "" |
| 209 | }, |
| 210 | "NodeUpSourceHashAmd64": func() string { |
| 211 | if b.NodeUpAssets[architectures.ArchitectureAmd64] != nil { |
| 212 | return b.NodeUpAssets[architectures.ArchitectureAmd64].Hash.Hex() |
| 213 | } |
| 214 | return "" |
| 215 | }, |
| 216 | "NodeUpSourceArm64": func() string { |
| 217 | if b.NodeUpAssets[architectures.ArchitectureArm64] != nil { |
| 218 | return strings.Join(b.NodeUpAssets[architectures.ArchitectureArm64].Locations, ",") |
| 219 | } |
| 220 | return "" |
| 221 | }, |
| 222 | "NodeUpSourceHashArm64": func() string { |
| 223 | if b.NodeUpAssets[architectures.ArchitectureArm64] != nil { |
| 224 | return b.NodeUpAssets[architectures.ArchitectureArm64].Hash.Hex() |
| 225 | } |
| 226 | return "" |
| 227 | }, |
| 228 | |
| 229 | "KubeEnv": func() (string, error) { |
| 230 | bootConfigData, err := utils.YamlMarshal(b.BootConfig) |
| 231 | if err != nil { |
| 232 | return "", fmt.Errorf("error converting boot config to yaml: %w", err) |
| 233 | } |
| 234 | |
| 235 | return string(bootConfigData), nil |
| 236 | }, |
| 237 | |
| 238 | "GzipBase64": func(data string) (string, error) { |
| 239 | return gzipBase64(data) |
| 240 | }, |
| 241 | |
| 242 | "CompressUserData": func() bool { |
| 243 | return b.CompressUserData |
| 244 | }, |
| 245 | |
| 246 | "GetCloudProvider": func() string { |
| 247 | return b.CloudProvider |
| 248 | }, |
| 249 | |
| 250 | "SetSysctls": func() string { |
| 251 | return b.SetSysctls |
| 252 | }, |
no test coverage detected