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