func fillSyslog(args *models.InstallerArguments, manifest models.Manifest) { repJob := firstRepJob(manifest) properties := repJob.Properties // TODO: this is broken on ops manager: // 1. there are no global properties section // 2. none of the diego jobs (including rep) has syslog_daemon_config if properties.Syslog == nil && manifest.Properties != nil { properties = manifest.Properties } if properties.Syslog == nil { return } args.SyslogHostIP = properties.Syslog.Address args.SyslogPort = properties.Syslog.Port }
func fillSharedSecret(args *models.InstallerArguments, manifest models.Manifest) { repJob := firstRepJob(manifest) properties := repJob.Properties if properties.MetronEndpoint == nil { properties = manifest.Properties } args.SharedSecret = properties.MetronEndpoint.SharedSecret }
func fillEtcdCluster(args *models.InstallerArguments, manifest models.Manifest) { repJob := firstRepJob(manifest) properties := repJob.Properties if properties.Loggregator == nil { properties = manifest.Properties } args.EtcdCluster = properties.Loggregator.Etcd.Machines[0] }
func fillExternalIp(args *models.InstallerArguments, manifest models.Manifest, externalIp string) { if externalIp == "" { consulIp := strings.Split(args.ConsulIPs, ",")[0] conn, err := net.Dial("udp", consulIp+":65530") FailOnError(err) externalIp = strings.Split(conn.LocalAddr().String(), ":")[0] } args.ExternalIp = externalIp }
func generateInstallScript(outputDir string, args *models.InstallerArguments) { content := strings.Replace(installBatTemplate, "\n", "\r\n", -1) temp := template.Must(template.New("").Parse(content)) args.Zone = "windows" filename := "install.bat" file, err := os.OpenFile(path.Join(outputDir, filename), os.O_TRUNC|os.O_CREATE|os.O_RDWR, 0644) Fatal(err) defer file.Close() err = temp.Execute(file, args) Fatal(err) }
func fillConsul(args *models.InstallerArguments, manifest models.Manifest, outputDir string) { repJob := firstRepJob(manifest) properties := repJob.Properties if properties.Consul == nil { properties = manifest.Properties } // missing requireSSL implies true requireSSL := properties.Consul.RequireSSL if requireSSL == nil || *requireSSL { args.ConsulRequireSSL = true extractConsulKeyAndCert(properties, outputDir) } consuls := properties.Consul.Agent.Servers.Lan if len(consuls) == 0 { fmt.Fprintf(os.Stderr, "Could not find any Consul VMs in your BOSH deployment") os.Exit(1) } args.ConsulIPs = strings.Join(consuls, ",") }
func fillBBS(args *models.InstallerArguments, manifest models.Manifest, outputDir string) { repJob := firstRepJob(manifest) properties := repJob.Properties if properties.Diego.Rep.BBS == nil { properties = manifest.Properties } requireSSL := properties.Diego.Rep.BBS.RequireSSL // missing requireSSL implies true if requireSSL == nil || *requireSSL { args.BbsRequireSsl = true extractBbsKeyAndCert(properties, outputDir) } }
func fillMetronAgent(args *models.InstallerArguments, manifest models.Manifest, outputDir string) { repJob := firstRepJob(manifest) properties := repJob.Properties if properties.MetronAgent == nil || properties.MetronAgent.PreferredProtocol == nil { properties = manifest.Properties } if properties != nil && properties.MetronAgent != nil && properties.MetronAgent.PreferredProtocol != nil { if *properties.MetronAgent.PreferredProtocol == "tls" { args.MetronPreferTLS = true extractMetronKeyAndCert(properties, outputDir) } } }