Skip to content

Commit

Permalink
Merge pull request #39 from itsouvalas/params_hostname
Browse files Browse the repository at this point in the history
Update FQDN and provide params.hostname
  • Loading branch information
itsouvalas authored Dec 8, 2022
2 parents fa279da + 4d25830 commit eb4f443
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
9 changes: 8 additions & 1 deletion manifest.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ func UploadReleasesFromManifest(raw string, bosh *gogobosh.Client, l *Log) error
func GetCreds(id string, plan Plan, bosh *gogobosh.Client, l *Log) (interface{}, error) {
var jobs []*Job
jobsYAML := make(map[string][]*Job)
var dnsname string

deployment := plan.ID + "-" + id

Expand Down Expand Up @@ -160,11 +161,16 @@ func GetCreds(id string, plan Plan, bosh *gogobosh.Client, l *Log) (interface{},
vm.ID,
plan.ID,
plan.Name,
vm.ID + "." + plan.ID + "." + network + "." + deployment + ".bosh",
vm.ID + "." + plan.Type + "." + network + "." + deployment + ".bosh",
vm.IPs,
vm.DNS,
}
l.Debug("found job {name: %s, deployment: %s, id: %s, plan_id: %s, plan_name: %s, fqdn: %s, ips: [%s], dns: [%s]", job.Name, job.Deployment, job.ID, job.PlanID, job.PlanName, job.FQDN, strings.Join(vm.IPs, ", "), strings.Join(vm.DNS, ", "))
dnsname = job.FQDN
if job.PlanName != "single-node" {
dnsname = strings.Replace(dnsname, ".standalone.", ".node.", 1)
}

jobs = append(jobs, &job)

if typ, ok := byType[vm.JobName]; ok {
Expand Down Expand Up @@ -218,6 +224,7 @@ func GetCreds(id string, plan Plan, bosh *gogobosh.Client, l *Log) (interface{},

params := make(map[interface{}]interface{})
params["instance_id"] = id
params["hostname"] = dnsname

manifest, err := GenManifest(plan, jobsIfc, plan.Credentials, defaults, wrap("params", params))
if err != nil {
Expand Down
3 changes: 3 additions & 0 deletions services.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ type Plan struct {
Name string `yaml:"name" json:"name"`
Description string `yaml:"description" json:"description"`
Limit int `yaml:"limit" json:"limit"`
Type string `yaml:"type" json:"type"`

Manifest map[interface{}]interface{} `json:"-"`
Credentials map[interface{}]interface{} `json:"-"`
Expand All @@ -25,6 +26,7 @@ type Plan struct {
type Service struct {
ID string `yaml:"id" json:"id"`
Name string `yaml:"name" json:"name"`
Type string `yaml:"type" json:"type"`
Description string `yaml:"description" json:"description"`
Bindable bool `yaml:"bindable" json:"bindable"`
Tags []string `yaml:"tags" json:"tags"`
Expand Down Expand Up @@ -150,6 +152,7 @@ func ReadPlans(dir string, service Service) ([]Plan, error) {
return pp, err
}
p.ID = service.ID + "-" + p.ID
p.Type = service.Type
p.Service = &service
pp = append(pp, p)
}
Expand Down

0 comments on commit eb4f443

Please sign in to comment.