Skip to content

Commit

Permalink
Hotfix for extra logs (#62)
Browse files Browse the repository at this point in the history
- Added extra logs to check for an error with intel hosts
  • Loading branch information
cjlapao authored Nov 14, 2024
1 parent 253c148 commit bdbcf46
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 5 deletions.
14 changes: 11 additions & 3 deletions internal/deploy/devops_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,14 +90,22 @@ func (c *DevOpsServiceClient) InstallDependencies(listToInstall []string) ([]str

if !ok {
for _, dep := range listToInstall {
switch dep {
switch strings.ToLower(dep) {
case "brew":
brewPresent := c.findPath("brew")
if brewPresent == "" {
if err := c.InstallBrew(); err != nil {
return installed_dependencies, err
}
installed_dependencies = append(installed_dependencies, "brew")
isAlreadyInInstalledDependencies := false
for _, installedDep := range installed_dependencies {
if installedDep == "brew" {
isAlreadyInInstalledDependencies = true
}
}
if !isAlreadyInInstalledDependencies {
installed_dependencies = append(installed_dependencies, "brew")
}
}
case "git":
gitPresent := c.findPath("git")
Expand Down Expand Up @@ -127,7 +135,7 @@ func (c *DevOpsServiceClient) InstallDependencies(listToInstall []string) ([]str
installed_dependencies = append(installed_dependencies, "vagrant")
}
default:
return installed_dependencies, errors.New("Unsupported dependency")
return installed_dependencies, errors.New("Unsupported dependency " + dep + " to install")
}
}
} else {
Expand Down
5 changes: 5 additions & 0 deletions internal/deploy/models/resource_models_v2.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package models

import (
"strings"

"terraform-provider-parallels-desktop/internal/apiclient"
"terraform-provider-parallels-desktop/internal/models"
"terraform-provider-parallels-desktop/internal/schemas/authenticator"
Expand Down Expand Up @@ -115,6 +116,10 @@ func (p *ParallelsDesktopDevopsConfigV2) MapObject() basetypes.ObjectValue {
}

func (o *DeployResourceModelV2) GenerateApiHostConfig(provider *models.ParallelsProviderModel) apiclient.HostConfig {
if o.Api.IsNull() || o.Api.IsUnknown() {
return apiclient.HostConfig{}
}

hostConfig := apiclient.HostConfig{
IsOrchestrator: false,
Host: strings.ReplaceAll(o.SshConnection.Host.String(), "\"", ""),
Expand Down
4 changes: 2 additions & 2 deletions internal/schemas/reverseproxy/operations.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ func Read() diag.Diagnostics {

func Create(ctx context.Context, config apiclient.HostConfig, request []ReverseProxyHost) ([]ReverseProxyHost, diag.Diagnostics) {
diagnostic := diag.Diagnostics{}
for _, host := range request {
for i, host := range request {
if h, diag := createHost(ctx, config, host); diag.HasError() {
diagnostic = append(diagnostic, diag...)
} else {
host.ID = h.ID
request[i].ID = h.ID
}
}

Expand Down

0 comments on commit bdbcf46

Please sign in to comment.