|
5 | 5 | "encoding/base64" |
6 | 6 | "encoding/json" |
7 | 7 | "fmt" |
| 8 | + "math/big" |
8 | 9 | "path/filepath" |
9 | 10 | "strings" |
10 | 11 |
|
@@ -509,7 +510,7 @@ func (c *DevOpsServiceClient) CompareLicenses(ctx context.Context, license strin |
509 | 510 | return false, nil |
510 | 511 | } |
511 | 512 |
|
512 | | -func (c *DevOpsServiceClient) InstallDevOpsService(ctx context.Context, license string, config models.ParallelsDesktopDevopsConfigV2) (string, error) { |
| 513 | +func (c *DevOpsServiceClient) InstallDevOpsService(ctx context.Context, license string, config models.ParallelsDesktopDevopsConfigV3) (string, error) { |
513 | 514 | // Installing DevOps Service |
514 | 515 |
|
515 | 516 | devopsPath := c.findPath(ctx, "prldevops") |
@@ -552,6 +553,37 @@ func (c *DevOpsServiceClient) InstallDevOpsService(ctx context.Context, license |
552 | 553 | if config.EnablePortForwarding.ValueBool() { |
553 | 554 | configFile.EnvironmentVariables["ENABLE_REVERSE_PROXY"] = "true" |
554 | 555 | } |
| 556 | + // Setting the caching options for the service |
| 557 | + if config.CatalogCacheKeepFreeDiskSpace.ValueBigFloat() != nil { |
| 558 | + configValue := config.CatalogCacheKeepFreeDiskSpace.ValueBigFloat() |
| 559 | + zeroValue := big.NewFloat(0) |
| 560 | + if configValue.Cmp(zeroValue) == 1 { |
| 561 | + configFile.EnvironmentVariables["CATALOG_CACHE_KEEP_FREE_DISK_SPACE"] = config.CatalogCacheKeepFreeDiskSpace.ValueBigFloat().String() |
| 562 | + } |
| 563 | + } |
| 564 | + if config.CatalogCacheMaxSize.ValueBigFloat() != nil { |
| 565 | + configValue := config.CatalogCacheMaxSize.ValueBigFloat() |
| 566 | + zeroValue := big.NewFloat(0) |
| 567 | + if configValue.Cmp(zeroValue) == 1 { |
| 568 | + configFile.EnvironmentVariables["CATALOG_CACHE_MAX_SIZE"] = config.CatalogCacheMaxSize.ValueBigFloat().String() |
| 569 | + } |
| 570 | + } |
| 571 | + if config.CatalogCacheAllowCacheAboveKeepFreeDiskSpace.ValueBool() { |
| 572 | + configFile.EnvironmentVariables["CATALOG_CACHE_ALLOW_CACHE_ABOVE_KEEP_FREE_DISK_SPACE"] = "true" |
| 573 | + } |
| 574 | + if config.DisableCatalogCachingStream.ValueBool() { |
| 575 | + configFile.EnvironmentVariables["DISABLE_CATALOG_PROVIDER_STREAMING"] = "true" |
| 576 | + } |
| 577 | + |
| 578 | + // Setting the logging options for the service |
| 579 | + if config.EnableLogging.ValueBool() { |
| 580 | + configFile.EnvironmentVariables["PRL_DEVOPS_LOG_TO_FILE"] = "true" |
| 581 | + } |
| 582 | + if config.LogPath.ValueString() != "" { |
| 583 | + configFile.EnvironmentVariables["PRL_DEVOPS_LOG_FILE_PATH"] = config.LogPath.ValueString() |
| 584 | + } else { |
| 585 | + configFile.EnvironmentVariables["PRL_DEVOPS_LOG_FILE_PATH"] = "." |
| 586 | + } |
555 | 587 |
|
556 | 588 | yamlConfig, err := yaml.Marshal(configFile) |
557 | 589 | if err != nil { |
@@ -704,7 +736,7 @@ func (c *DevOpsServiceClient) GenerateDefaultRootPassword(ctx context.Context) ( |
704 | 736 | return encoded, nil |
705 | 737 | } |
706 | 738 |
|
707 | | -func (c *DevOpsServiceClient) generateConfigFile(config models.ParallelsDesktopDevopsConfigV2) (string, error) { |
| 739 | +func (c *DevOpsServiceClient) generateConfigFile(config models.ParallelsDesktopDevopsConfigV3) (string, error) { |
708 | 740 | configPath := "/tmp/service_config.json" |
709 | 741 | configMap := make(map[string]interface{}) |
710 | 742 | if config.Port.ValueString() != "" { |
@@ -758,9 +790,6 @@ func (c *DevOpsServiceClient) generateConfigFile(config models.ParallelsDesktopD |
758 | 790 | if config.SystemReservedDisk.ValueString() != "" { |
759 | 791 | configMap["system_reserved_disk"] = config.SystemReservedDisk.ValueString() |
760 | 792 | } |
761 | | - if config.EnableLogging.ValueBool() { |
762 | | - configMap["log_output"] = true |
763 | | - } |
764 | 793 |
|
765 | 794 | jsonConfig, err := json.Marshal(configMap) |
766 | 795 | if err != nil { |
|
0 commit comments