Rename Host to PlaygroundFQDN
This commit is contained in:
@@ -16,7 +16,7 @@ func NewInstance(rw http.ResponseWriter, req *http.Request) {
|
||||
vars := mux.Vars(req)
|
||||
sessionId := vars["sessionId"]
|
||||
|
||||
body := types.InstanceConfig{Host: req.Host}
|
||||
body := types.InstanceConfig{PlaygroundFQDN: req.Host}
|
||||
|
||||
json.NewDecoder(req.Body).Decode(&body)
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ func SessionSetup(rw http.ResponseWriter, req *http.Request) {
|
||||
vars := mux.Vars(req)
|
||||
sessionId := vars["sessionId"]
|
||||
|
||||
body := pwd.SessionSetupConf{}
|
||||
body := pwd.SessionSetupConf{PlaygroundFQDN: req.Host}
|
||||
|
||||
json.NewDecoder(req.Body).Decode(&body)
|
||||
|
||||
|
||||
@@ -67,7 +67,7 @@ func (d *DinD) InstanceNew(session *types.Session, conf types.InstanceConfig) (*
|
||||
ServerCert: conf.ServerCert,
|
||||
ServerKey: conf.ServerKey,
|
||||
CACert: conf.CACert,
|
||||
HostFQDN: conf.Host,
|
||||
HostFQDN: conf.PlaygroundFQDN,
|
||||
Privileged: true,
|
||||
Networks: []string{session.Id},
|
||||
}
|
||||
|
||||
@@ -97,7 +97,7 @@ func TestInstanceNew(t *testing.T) {
|
||||
_s.On("InstancePut", mock.AnythingOfType("*types.Instance")).Return(nil)
|
||||
_e.M.On("Emit", event.INSTANCE_NEW, "aaaabbbbcccc", []interface{}{"aaaabbbb_node1", "10.0.0.1", "node1", "ip10-0-0-1-aaaabbbbcccc"}).Return()
|
||||
|
||||
instance, err := p.InstanceNew(session, types.InstanceConfig{Host: "something.play-with-docker.com"})
|
||||
instance, err := p.InstanceNew(session, types.InstanceConfig{PlaygroundFQDN: "something.play-with-docker.com"})
|
||||
assert.Nil(t, err)
|
||||
|
||||
assert.Equal(t, expectedInstance, *instance)
|
||||
|
||||
@@ -30,7 +30,8 @@ func (s *sessionBuilderWriter) Write(p []byte) (n int, err error) {
|
||||
}
|
||||
|
||||
type SessionSetupConf struct {
|
||||
Instances []SessionSetupInstanceConf `json:"instances"`
|
||||
Instances []SessionSetupInstanceConf `json:"instances"`
|
||||
PlaygroundFQDN string
|
||||
}
|
||||
|
||||
type SessionSetupInstanceConf struct {
|
||||
@@ -150,7 +151,7 @@ func (p *pwd) SessionDeployStack(s *types.Session) error {
|
||||
|
||||
s.Ready = false
|
||||
p.event.Emit(event.SESSION_READY, s.Id, false)
|
||||
i, err := p.InstanceNew(s, types.InstanceConfig{ImageName: s.ImageName, Host: s.Host})
|
||||
i, err := p.InstanceNew(s, types.InstanceConfig{ImageName: s.ImageName, PlaygroundFQDN: s.Host})
|
||||
if err != nil {
|
||||
log.Printf("Error creating instance for stack [%s]: %s\n", s.Stack, err)
|
||||
return err
|
||||
@@ -203,7 +204,7 @@ func (p *pwd) SessionGet(sessionId string) *types.Session {
|
||||
return s
|
||||
}
|
||||
|
||||
func (p *pwd) SessionSetup(session *types.Session, conf SessionSetupConf) error {
|
||||
func (p *pwd) SessionSetup(session *types.Session, sconf SessionSetupConf) error {
|
||||
defer observeAction("SessionSetup", time.Now())
|
||||
|
||||
c := sync.NewCond(&sync.Mutex{})
|
||||
@@ -222,14 +223,14 @@ func (p *pwd) SessionSetup(session *types.Session, conf SessionSetupConf) error
|
||||
|
||||
g, _ := errgroup.WithContext(context.Background())
|
||||
|
||||
for _, conf := range conf.Instances {
|
||||
for _, conf := range sconf.Instances {
|
||||
conf := conf
|
||||
g.Go(func() error {
|
||||
instanceConf := types.InstanceConfig{
|
||||
ImageName: conf.Image,
|
||||
Hostname: conf.Hostname,
|
||||
Host: session.Host,
|
||||
Type: conf.Type,
|
||||
ImageName: conf.Image,
|
||||
Hostname: conf.Hostname,
|
||||
PlaygroundFQDN: sconf.PlaygroundFQDN,
|
||||
Type: conf.Type,
|
||||
}
|
||||
i, err := p.InstanceNew(session, instanceConf)
|
||||
if err != nil {
|
||||
|
||||
@@ -27,13 +27,13 @@ type WindowsInstance struct {
|
||||
}
|
||||
|
||||
type InstanceConfig struct {
|
||||
ImageName string
|
||||
Hostname string
|
||||
ServerCert []byte
|
||||
ServerKey []byte
|
||||
CACert []byte
|
||||
Cert []byte
|
||||
Key []byte
|
||||
Host string
|
||||
Type string
|
||||
ImageName string
|
||||
Hostname string
|
||||
ServerCert []byte
|
||||
ServerKey []byte
|
||||
CACert []byte
|
||||
Cert []byte
|
||||
Key []byte
|
||||
PlaygroundFQDN string
|
||||
Type string
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user