@@ -17,10 +17,7 @@ import (
17
17
"golang.org/x/xerrors"
18
18
)
19
19
20
- const (
21
- defaultOrg = "default"
22
- defaultImgTag = "latest"
23
- )
20
+ const defaultImgTag = "latest"
24
21
25
22
func envsCommand () * cobra.Command {
26
23
var user string
@@ -170,7 +167,7 @@ coder envs create --cpu 4 --disk 100 --memory 8 --image 5f443b16-30652892427b955
170
167
return xerrors .New ("image unset" )
171
168
}
172
169
173
- multiOrgMember , err := isMultiOrgMember (* user )
170
+ multiOrgMember , err := isMultiOrgMember (cmd . Context (), * user )
174
171
if err != nil {
175
172
return err
176
173
}
@@ -214,7 +211,7 @@ coder envs create --cpu 4 --disk 100 --memory 8 --image 5f443b16-30652892427b955
214
211
createReq .DiskGB = importedImg .DefaultDiskGB
215
212
}
216
213
217
- env , err := client .CreateEnvironment (cmd .Context (), org , * createReq )
214
+ env , err := client .CreateEnvironment (cmd .Context (), importedImg . OrganizationID , * createReq )
218
215
if err != nil {
219
216
return xerrors .Errorf ("create environment: %w" , err )
220
217
}
@@ -234,7 +231,7 @@ coder envs create --cpu 4 --disk 100 --memory 8 --image 5f443b16-30652892427b955
234
231
return nil
235
232
},
236
233
}
237
- cmd .Flags ().StringVarP (& org , "org" , "o" , defaultOrg , "ID of the organization the environment should be created under." )
234
+ cmd .Flags ().StringVarP (& org , "org" , "o" , "" , "ID of the organization the environment should be created under." )
238
235
cmd .Flags ().StringVarP (& tag , "tag" , "t" , defaultImgTag , "tag of the image the environment will be based off of." )
239
236
cmd .Flags ().Float32P ("cpu" , "c" , 0 , "number of cpu cores the environment should be provisioned with." )
240
237
cmd .Flags ().Float32P ("memory" , "m" , 0 , "GB of RAM an environment should be provisioned with." )
@@ -280,7 +277,7 @@ coder envs edit back-end-env --disk 20`,
280
277
return err
281
278
}
282
279
283
- multiOrgMember , err := isMultiOrgMember (* user )
280
+ multiOrgMember , err := isMultiOrgMember (cmd . Context (), * user )
284
281
if err != nil {
285
282
return err
286
283
}
@@ -332,7 +329,7 @@ coder envs edit back-end-env --disk 20`,
332
329
return nil
333
330
},
334
331
}
335
- cmd .Flags ().StringVarP (& org , "org" , "o" , defaultOrg , "name of the organization the environment should be created under." )
332
+ cmd .Flags ().StringVarP (& org , "org" , "o" , "" , "name of the organization the environment should be created under." )
336
333
cmd .Flags ().StringVarP (& img , "image" , "i" , "" , "name of the image you wan't the environment to be based off of." )
337
334
cmd .Flags ().StringVarP (& tag , "tag" , "t" , "latest" , "image tag of the image you wan't to base the environment off of." )
338
335
cmd .Flags ().Float32P ("cpu" , "c" , cpuCores , "The number of cpu cores the environment should be provisioned with." )
@@ -484,6 +481,9 @@ func buildUpdateReq(ctx context.Context, conf updateConf) (*coder.UpdateEnvironm
484
481
// if the user accidentally requests it or if the default diskGB value for a
485
482
// newly requested image is smaller than the current amount the environment is using.
486
483
if * updateReq .DiskGB < conf .environment .DiskGB {
484
+ clog .LogWarn ("disk can not be shrunk" ,
485
+ fmt .Sprintf ("keeping environment disk at %d GB" , conf .environment .DiskGB ),
486
+ )
487
487
updateReq .DiskGB = & conf .environment .DiskGB
488
488
}
489
489
0 commit comments