Skip to content

Commit

Permalink
Error handling
Browse files Browse the repository at this point in the history
Fix #39 and #40
  • Loading branch information
Akaizoku committed Dec 12, 2024
1 parent a356ee2 commit b75cb1e
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 18 deletions.
17 changes: 13 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,25 @@ All notable changes to the [`alteryx-deploy`](https://github.com/Akaizoku/altery
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [2.0.2](https://github.com/Akaizoku/alteryx-deploy/releases/2.0.2) - 2024-12-12

Error handling

### Fixed

- Invoke-DownloadAlteryx: Fixed an issue with expired license API refresh token causing the script to error ([#39](https://github.com/Akaizoku/alteryx-deploy/issues/39))
- Invoke-SetupScript: Fixed an issue with invalid or corrupted encrypted key or license files causing the script to error ([#40](https://github.com/Akaizoku/alteryx-deploy/issues/40))

## [2.0.1](https://github.com/Akaizoku/alteryx-deploy/releases/2.0.1) - 2024-10-20

Fix key encryption and decryption issues.

### Fixed

- Fixed an issue with license API token and keys encryption during setup [[#36](https://github.com/Akaizoku/alteryx-deploy/issues/36)]
- Fixed an issue with license API token and keys decryption during download [[#36](https://github.com/Akaizoku/alteryx-deploy/issues/36)]
- Fixed an issue when license keys decryption during activation [[#36](https://github.com/Akaizoku/alteryx-deploy/issues/36)]
- Fixed an issue when license keys decryption during deactivation [[#36](https://github.com/Akaizoku/alteryx-deploy/issues/36)]
- Fixed an issue with license API token and keys encryption during setup ([#36](https://github.com/Akaizoku/alteryx-deploy/issues/36))
- Fixed an issue with license API token and keys decryption during download ([#36](https://github.com/Akaizoku/alteryx-deploy/issues/36))
- Fixed an issue when license keys decryption during activation ([#36](https://github.com/Akaizoku/alteryx-deploy/issues/36))
- Fixed an issue when license keys decryption during deactivation ([#36](https://github.com/Akaizoku/alteryx-deploy/issues/36))
- Fixed an issue when attempting to redownload an existing major version without any patch available

## [2.0.0](https://github.com/Akaizoku/alteryx-deploy/releases/2.0.0) - 2024-10-08
Expand Down
22 changes: 12 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -562,23 +562,23 @@ Below is an example of a successful installation log:
This module depends on the usage of functions provided by two PowerShell modules:

1. PowerShell Tool Kit ([PSTK]) module (version 1.2.6);
2. Alteryx PowerShell ([PSAYX]) module (version 1.1.1).
2. Alteryx PowerShell ([PSAYX]) module (version 1.1.1).
2. Alteryx PowerShell ([PSAYX]) module (version 1.1.2).

## Compatibility

Below are listed the compatible versions for each of the release.

Only the first version supported is listed. Later releases should also be compatible as long as no breaking change has been introduced. Please refer to the [Alteryx release notes](https://help.alteryx.com/release-notes) for more information.

| `alteryx-deploy` | Alteryx | PowerShell | [PSTK] | [PSAYX] |
| ---------------- | -------- | ---------- | ------ | ------- |
| [1.0.0] | [2021.3] | 5.0 | 1.2.4 | 1.0.0 |
| [1.1.0] | [2021.3] | 5.0 | 1.2.5 | 1.0.1 |
| [1.1.1] | [2021.3] | 5.0 | 1.2.5 | 1.0.1 |
| [1.1.2] | [2021.3] | 5.0 | 1.2.5 | 1.0.1 |
| [2.0.0] | [2024.1] | 5.1 | 1.2.6 | 1.1.1 |
| [2.0.1] | [2024.2] | 5.1 | 1.2.6 | 1.1.1 |
| `alteryx-deploy` | Alteryx | PowerShell | [PSTK] | [PSAYX] |
| ---------------: | -------: | ---------: | -----: | ------: |
| [1.0.0] | [2021.3] | 5.0 | 1.2.4 | 1.0.0 |
| [1.1.0] | [2021.3] | 5.0 | 1.2.5 | 1.0.1 |
| [1.1.1] | [2021.3] | 5.0 | 1.2.5 | 1.0.1 |
| [1.1.2] | [2021.3] | 5.0 | 1.2.5 | 1.0.1 |
| [2.0.0] | [2024.1] | 5.1 | 1.2.6 | 1.1.1 |
| [2.0.1] | [2024.2] | 5.1 | 1.2.6 | 1.1.1 |
| [2.0.2] | [2024.2] | 5.1 | 1.2.6 | 1.1.2 |

## Known issues

Expand Down Expand Up @@ -611,6 +611,8 @@ If this occurs, simply run the command [`Stop-Transcript`](https://learn.microso
[1.1.1]:https://github.com/Akaizoku/alteryx-deploy/releases/1.1.1
[1.1.2]:https://github.com/Akaizoku/alteryx-deploy/releases/1.1.2
[2.0.0]:https://github.com/Akaizoku/alteryx-deploy/releases/2.0.0
[2.0.1]:https://github.com/Akaizoku/alteryx-deploy/releases/2.0.1
[2.0.2]:https://github.com/Akaizoku/alteryx-deploy/releases/2.0.2
[2021.3]:https://help.alteryx.com/release-notes/server/server-20213-release-notes
[2024.1]:https://help.alteryx.com/release-notes/en/release-notes/server-release-notes/server-2024-1-release-notes.html
[2024.2]:https://help.alteryx.com/release-notes/en/release-notes/server-release-notes/server-2024-2-release-notes.html
Expand Down
16 changes: 14 additions & 2 deletions powershell/Invoke-DownloadAlteryx.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ function Invoke-DownloadAlteryx {
File name: Invoke-DownloadAlteryx.ps1
Author: Florian Carrier
Creation date: 2024-09-04
Last modified: 2024-11-20
Last modified: 2024-12-10
#>
[CmdletBinding (
SupportsShouldProcess = $true
Expand Down Expand Up @@ -55,7 +55,6 @@ function Invoke-DownloadAlteryx {
$RegistryKey = "HKLM:HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\SRC\Alteryx"
# License API refresh token
$LicenseAPIPath = Join-Path -Path $Properties.ResDirectory -ChildPath $Properties.LicenseAPIFile
$RefreshToken = ([System.Runtime.InteropServices.Marshal]::PtrToStringAuto([System.Runtime.InteropServices.Marshal]::SecureStringToBSTR((ConvertTo-SecureString -String (Get-Content -Path $LicenseAPIPath))))) -replace "`r|`n", ""
# Placeholder
$Skip = $false
}
Expand All @@ -65,6 +64,18 @@ function Invoke-DownloadAlteryx {
# ------------------------------------------------------------------------------
# * Checks
# ------------------------------------------------------------------------------
# Retrieve license API refresh token
try {
$RefreshToken = ([System.Runtime.InteropServices.Marshal]::PtrToStringAuto([System.Runtime.InteropServices.Marshal]::SecureStringToBSTR((ConvertTo-SecureString -String (Get-Content -Path $LicenseAPIPath))))) -replace "`r|`n", ""
}
catch {
Write-Log -Type "ERROR" -Message (Get-PowerShellError)
Write-Log -Type "ERROR" -Message "Cannot read license API refresh token"
Write-Log -Type "WARN" -Message "Run setup to reconfigure"
$DownloadProcess = Update-ProcessObject -ProcessObject $DownloadProcess -Status "Failed" -ErrorCount 1 -ExitCode 1
return $DownloadProcess
}
# Check refresh token
if ($null -eq $RefreshToken) {
Write-Log -Type "ERROR" -Message "The Alteryx license portal API refresh token has not been configured"
if (-Not $Unattended) {
Expand All @@ -75,6 +86,7 @@ function Invoke-DownloadAlteryx {
return $DownloadProcess
}
}
# Check license account ID
if ($null -eq $Properties.LicenseAccountID) {
Write-Log -Type "ERROR" -Message "The AccountID parameter has not been configured"
if (-Not $Unattended) {
Expand Down
14 changes: 12 additions & 2 deletions powershell/Invoke-SetupScript.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ function Invoke-SetupScript {
File name: Invoke-SetupScript.ps1
Author: Florian Carrier
Creation date: 2022-05-03
Last modified: 2024-11-20
Last modified: 2024-12-10
#>
[CmdletBinding (
SupportsShouldProcess = $true
Expand Down Expand Up @@ -237,7 +237,17 @@ function Invoke-SetupScript {
$LicenseFilePath = Join-Path -Path "$PSScriptRoot/.." -ChildPath "$($Properties.ResDirectory)/$($Properties.LicenseFile)"
$ConfigureLicenseFile = $true
if (Test-Path -Path $LicenseFilePath) {
$LicenseKeys = ConvertFrom-SecureString -SecureString (ConvertTo-SecureString -String (Get-Content -Path $LicenseFilePath))
# Load license keys
try {
$LicenseKeys = ConvertFrom-SecureString -SecureString (ConvertTo-SecureString -String (Get-Content -Path $LicenseFilePath))
}
catch {
Write-Log -Type "ERROR" -Message (Get-PowerShellError)
Write-Log -Type "ERROR" -Message "License keys could not be read"
$SetupProcess = Update-ProcessObject -ProcessObject $SetupProcess -ErrorCount 1
$LicenseKeys = $null
}
# Check license keys
if ($LicenseKeys -notin ($null, "")) {
Write-Log -Type "WARN" -Message "License keys have already been configured"
$ConfigureLicenseFile = Confirm-Prompt -Prompt "Do you want to overwrite the existing license keys?"
Expand Down

0 comments on commit b75cb1e

Please sign in to comment.