Skip to content

Commit

Permalink
fixed the packer template machine
Browse files Browse the repository at this point in the history
  • Loading branch information
cjlapao committed Nov 8, 2023
1 parent 71354ed commit 0b60fae
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
9 changes: 5 additions & 4 deletions src/controllers/machines.go
Original file line number Diff line number Diff line change
Expand Up @@ -555,10 +555,11 @@ func CreateMachine() restapi.Controller {

template.Name = request.Name
template.Owner = request.Owner
template.Specs["memory"] = request.PackerTemplate.Memory
if err != nil {
ReturnApiError(ctx, w, models.NewFromError(err))
return
if request.PackerTemplate.Cpu != "" {
template.Specs["cpu"] = request.PackerTemplate.Cpu
}
if request.PackerTemplate.Memory != "" {
template.Specs["memory"] = request.PackerTemplate.Memory
}

parallelsDesktopService := provider.ParallelsDesktopService
Expand Down
4 changes: 3 additions & 1 deletion src/serviceprovider/parallelsdesktop/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -748,7 +748,9 @@ func (s *ParallelsService) CreatePackerTemplateVm(ctx basecontext.ApiContext, te
ctx.LogInfo("Creating Packer Virtual Machine %s", template.Name)
existVm, err := s.findVm(ctx, template.Name)
if existVm != nil || err != nil {
return nil, errors.Newf("Machine %v with ID %v already exists and is %s", template.Name, existVm.ID, existVm.State)
if errors.GetSystemErrorCode(err) != 404 {
return nil, errors.Newf("Machine %v with ID %v already exists and is %s", template.Name, existVm.ID, existVm.State)
}
}

git := git.Get()
Expand Down

0 comments on commit 0b60fae

Please sign in to comment.