@@ -39,7 +39,7 @@ type DevcontainerPaths struct {
39
39
TargetConfigFilePath string
40
40
}
41
41
42
- func (d * DockerClient ) createProjectFromDevcontainer (opts * CreateProjectOptions , prebuild bool , sshClient * ssh. Client ) (RemoteUser , error ) {
42
+ func (d * DockerClient ) createProjectFromDevcontainer (opts * CreateProjectOptions , prebuild bool ) (RemoteUser , error ) {
43
43
socketForwardId , err := d .ensureDockerSockForward (opts .LogWriter )
44
44
if err != nil {
45
45
return "" , err
@@ -49,8 +49,8 @@ func (d *DockerClient) createProjectFromDevcontainer(opts *CreateProjectOptions,
49
49
50
50
paths := d .getDevcontainerPaths (opts )
51
51
52
- if sshClient != nil {
53
- err = sshClient .Exec (fmt .Sprintf ("mkdir -p %s" , paths .OverridesDir ), opts .LogWriter )
52
+ if opts . SshClient != nil {
53
+ err = opts . SshClient .Exec (fmt .Sprintf ("mkdir -p %s" , paths .OverridesDir ), opts .LogWriter )
54
54
if err != nil {
55
55
return "" , err
56
56
}
@@ -61,7 +61,7 @@ func (d *DockerClient) createProjectFromDevcontainer(opts *CreateProjectOptions,
61
61
}
62
62
}
63
63
64
- rawConfig , config , err := d .readDevcontainerConfig (opts , paths , socketForwardId , sshClient )
64
+ rawConfig , config , err := d .readDevcontainerConfig (opts , paths , socketForwardId )
65
65
if err != nil {
66
66
return "" , err
67
67
}
@@ -114,7 +114,7 @@ func (d *DockerClient) createProjectFromDevcontainer(opts *CreateProjectOptions,
114
114
if _ , ok := devcontainerConfig ["dockerComposeFile" ]; ok {
115
115
composeFilePath := devcontainerConfig ["dockerComposeFile" ].(string )
116
116
117
- if opts .SshSessionConfig != nil {
117
+ if opts .SshClient != nil {
118
118
composeFilePath = path .Join (opts .ProjectDir , filepath .Dir (opts .Project .Build .Devcontainer .DevContainerFilePath ), composeFilePath )
119
119
120
120
composeFileContent , err := d .getRemoteComposeContent (opts , paths , socketForwardId , composeFilePath )
@@ -156,13 +156,13 @@ func (d *DockerClient) createProjectFromDevcontainer(opts *CreateProjectOptions,
156
156
return "" , err
157
157
}
158
158
159
- if sshClient != nil {
159
+ if opts . SshClient != nil {
160
160
err = os .RemoveAll (composeFilePath )
161
161
if err != nil {
162
162
opts .LogWriter .Write ([]byte (fmt .Sprintf ("Error removing override compose file: %v\n " , err )))
163
163
return "" , err
164
164
}
165
- res , err := sshClient .WriteFile (string (overrideComposeContent ), filepath .Join (paths .OverridesDir , "daytona-compose-override.yml" ))
165
+ res , err := opts . SshClient .WriteFile (string (overrideComposeContent ), filepath .Join (paths .OverridesDir , "daytona-compose-override.yml" ))
166
166
if err != nil {
167
167
opts .LogWriter .Write ([]byte (fmt .Sprintf ("Error writing override compose file: %s\n " , string (res ))))
168
168
return "" , err
@@ -186,8 +186,8 @@ func (d *DockerClient) createProjectFromDevcontainer(opts *CreateProjectOptions,
186
186
return "" , err
187
187
}
188
188
189
- if sshClient != nil {
190
- res , err := sshClient .WriteFile (string (configString ), path .Join (paths .OverridesDir , "devcontainer.json" ))
189
+ if opts . SshClient != nil {
190
+ res , err := opts . SshClient .WriteFile (string (configString ), path .Join (paths .OverridesDir , "devcontainer.json" ))
191
191
if err != nil {
192
192
opts .LogWriter .Write ([]byte (fmt .Sprintf ("Error writing override compose file: %s\n " , string (res ))))
193
193
return "" , err
@@ -216,7 +216,7 @@ func (d *DockerClient) createProjectFromDevcontainer(opts *CreateProjectOptions,
216
216
217
217
cmd := []string {"-c" , strings .Join (devcontainerCmd , " " )}
218
218
219
- err = d .runInitializeCommand (config .MergedConfiguration .InitializeCommand , opts .LogWriter , sshClient )
219
+ err = d .runInitializeCommand (config .MergedConfiguration .InitializeCommand , opts .LogWriter , opts . SshClient )
220
220
if err != nil {
221
221
return "" , err
222
222
}
@@ -338,13 +338,13 @@ func (d *DockerClient) ensureDockerSockForward(logWriter io.Writer) (string, err
338
338
return c .ID , d .apiClient .ContainerStart (ctx , dockerSockForwardContainer , container.StartOptions {})
339
339
}
340
340
341
- func (d * DockerClient ) readDevcontainerConfig (opts * CreateProjectOptions , paths DevcontainerPaths , socketForwardId string , sshClient * ssh. Client ) (string , * devcontainer.Root , error ) {
341
+ func (d * DockerClient ) readDevcontainerConfig (opts * CreateProjectOptions , paths DevcontainerPaths , socketForwardId string ) (string , * devcontainer.Root , error ) {
342
342
opts .LogWriter .Write ([]byte ("Reading devcontainer configuration...\n " ))
343
343
344
344
env := os .Environ ()
345
- if sshClient != nil {
345
+ if opts . SshClient != nil {
346
346
var err error
347
- env , err = sshClient .GetEnv (nil )
347
+ env , err = opts . SshClient .GetEnv (nil )
348
348
if err != nil {
349
349
return "" , nil , err
350
350
}
@@ -544,7 +544,7 @@ func (d *DockerClient) execInContainer(cmd string, opts *CreateProjectOptions, p
544
544
}
545
545
546
546
func (d * DockerClient ) getRemoteComposeContent (opts * CreateProjectOptions , paths DevcontainerPaths , socketForwardId , composePath string ) (string , error ) {
547
- if opts .SshSessionConfig == nil {
547
+ if opts .SshClient == nil {
548
548
return "" , nil
549
549
}
550
550
0 commit comments