Skip to content

Commit

Permalink
final log updates
Browse files Browse the repository at this point in the history
  • Loading branch information
kenrward committed Nov 21, 2024
1 parent f451e02 commit efa42d2
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions Segment/Cloud Connector (Agent)/install-CloudConnectorAPI.ps1
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#update3.1
#update3.2
[CmdletBinding()]
param(
# API Token to get download URL
[Parameter(Mandatory = $False)]
[String]$APIToken = "<INSERT_API_TOKEN>",
[String]$APIToken = " ",

# Install/Uninstall
[Parameter(Mandatory = $True)]
Expand All @@ -12,12 +12,12 @@ param(

# Token to use to install the Cloud Connector
[Parameter(Mandatory = $False)]
[String]$CloudConnectorToken = "<INSERT_CC_TOKEN>",
[String]$CloudConnectorToken = " ",

# Cloud Connector Source
[ValidateSet("AD", "WORKGROUP", "AZURE", "AZURE_AD", "AWS", "GCP", "IBM", "ORACLE", "VMWARE", "ALIBABA", "OVH", "LUMEN")]
[Parameter(Mandatory = $False)]
[String]$CloudConnectorSource
[String]$CloudConnectorSource = "WORKGROUP"
)

# Logging function
Expand All @@ -33,15 +33,11 @@ function Write-Log {
Write-Log -Message "Script execution started."

# Validate API Token
if ($APIToken -eq "<INSERT_API_TOKEN>") {
if ($APIToken -eq "") {
Write-Log -Message "API Token is required but not provided." -Level "ERROR"
exit
}

# Normalize function and source case
$CloudConnectorFunction = $CloudConnectorFunction.ToLower()
$CloudConnectorSource = $CloudConnectorSource.ToUpper()

# Define installer arguments
switch ($CloudConnectorFunction) {
"install" {
Expand Down Expand Up @@ -114,6 +110,13 @@ try {
exit
}

#Tail setup log
$setupLogPath = "$env:LOCALAPPDATA\ZeroNetworks\logs\setup.log"
if (Test-Path -Path $setupLogPath) {
$setupText = Get-Content $setupLogPath -Tail 1
Write-Log -Message $setupText
}

# Clean up temporary files
try {
Remove-Item -Path $zipPath -Force -ErrorAction SilentlyContinue
Expand Down Expand Up @@ -144,4 +147,4 @@ if ($CloudConnectorFunction -eq "uninstall") {
}
}

Write-Log -Message "Script execution completed successfully."
Write-Log -Message "Script execution completed successfully."

0 comments on commit efa42d2

Please sign in to comment.