Merge branch 'master' into storage_refactor

This commit is contained in:
Jonathan Leibiusky @xetorthio
2017-06-16 10:02:20 -03:00
6 changed files with 7 additions and 2 deletions

View File

@@ -17,6 +17,7 @@ func Home(w http.ResponseWriter, r *http.Request) {
return return
} }
if s.Stack != "" { if s.Stack != "" {
s.Host = r.Host
go core.SessionDeployStack(s) go core.SessionDeployStack(s)
} }

View File

@@ -26,6 +26,7 @@ func SessionSetup(rw http.ResponseWriter, req *http.Request) {
return return
} }
s.Host = req.Host
err := core.SessionSetup(s, body) err := core.SessionSetup(s, body)
if err != nil { if err != nil {
log.Println(err) log.Println(err)

View File

@@ -236,6 +236,7 @@ func (p *pwd) InstanceAllowedImages() []string {
return []string{ return []string{
config.GetDindImageName(), config.GetDindImageName(),
"franela/dind:overlay2-dev", "franela/dind:overlay2-dev",
"franela/ucp:2.4.1",
} }
} }

View File

@@ -235,7 +235,7 @@ func TestInstanceAllowedImages(t *testing.T) {
p := NewPWD(dock, tasks, broadcast, storage) p := NewPWD(dock, tasks, broadcast, storage)
expectedImages := []string{config.GetDindImageName(), "franela/dind:overlay2-dev"} expectedImages := []string{config.GetDindImageName(), "franela/dind:overlay2-dev", "franela/ucp:2.4.1"}
assert.Equal(t, expectedImages, p.InstanceAllowedImages()) assert.Equal(t, expectedImages, p.InstanceAllowedImages())
} }

View File

@@ -147,7 +147,7 @@ func (p *pwd) SessionDeployStack(s *types.Session) error {
s.Ready = false s.Ready = false
p.broadcast.BroadcastTo(s.Id, "session ready", false) p.broadcast.BroadcastTo(s.Id, "session ready", false)
i, err := p.InstanceNew(s, InstanceConfig{ImageName: s.ImageName}) i, err := p.InstanceNew(s, InstanceConfig{ImageName: s.ImageName, Host: 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
@@ -201,6 +201,7 @@ func (p *pwd) SessionSetup(session *types.Session, conf SessionSetupConf) error
instanceConf := InstanceConfig{ instanceConf := InstanceConfig{
ImageName: conf.Image, ImageName: conf.Image,
Hostname: conf.Hostname, Hostname: conf.Hostname,
Host: session.Host,
} }
i, err := p.InstanceNew(session, instanceConf) i, err := p.InstanceNew(session, instanceConf)
if err != nil { if err != nil {

View File

@@ -15,6 +15,7 @@ type Session struct {
Stack string `json:"stack"` Stack string `json:"stack"`
StackName string `json:"stack_name"` StackName string `json:"stack_name"`
ImageName string `json:"image_name"` ImageName string `json:"image_name"`
Host string `json:"host"`
Clients []*Client `json:"-"` Clients []*Client `json:"-"`
closingTimer *time.Timer `json:"-"` closingTimer *time.Timer `json:"-"`
scheduled bool `json:"-"` scheduled bool `json:"-"`