Skip to content

Commit

Permalink
[Synapse] - fix workspace package null check issue (Azure#15847)
Browse files Browse the repository at this point in the history
* [Synapse] - fix workspace package null check issue

* Fix null check for library requirements

* update changelog

Co-authored-by: Dongwei Wang <dongwwa@microsoft.com>
  • Loading branch information
idear1203 and Dongwei Wang authored Sep 10, 2021
1 parent 9c050cd commit a387ffb
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 3 deletions.
1 change: 1 addition & 0 deletions src/Synapse/Synapse/ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
- Additional information about change #1
-->
## Upcoming Release
* Fixed the issue when `Update-AzSynapseSparkPool` is used with workspace package

## Version 0.15.0
* Added support for Synapse Managed Private Endpoint
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ public override void ExecuteCmdlet()
{
if (this.PackageAction == SynapseConstants.PackageActionType.Add)
{
if (existingSparkPool == null)
if (existingSparkPool.CustomLibraries == null)
{
existingSparkPool.CustomLibraries = new List<LibraryInfo>();
}
Expand Down Expand Up @@ -251,6 +251,11 @@ public override void ExecuteCmdlet()

private LibraryRequirements CreateLibraryRequirements()
{
if (string.IsNullOrEmpty(LibraryRequirementsFilePath))
{
return null;
}

var powerShellDestinationPath = SessionState.Path.GetUnresolvedProviderPathFromPSPath(LibraryRequirementsFilePath);

return new LibraryRequirements
Expand Down
12 changes: 10 additions & 2 deletions src/Synapse/Synapse/help/Update-AzSynapseSparkPool.md
Original file line number Diff line number Diff line change
Expand Up @@ -122,15 +122,23 @@ PS C:\> $packages = Get-AzSynapseWorkspacePackage -WorkspaceName ContosoWorkspac
PS C:\> Update-AzSynapseSparkPool -WorkspaceName ContosoWorkspace -Name ContosoSparkPool -PackageAction Add -Package $packages
```

The first command retrieves workspace packages. The second command links these workspaces packages to an Apache Spark pool in Azure Synapse Analytics.
The first command retrieves workspace packages. The second command links these workspace packages to an Apache Spark pool in Azure Synapse Analytics.

### Example 10
```powershell
PS C:\> $package = Get-AzSynapseWorkspacePackage -WorkspaceName ContosoWorkspace -Name ContosoPackage
PS C:\> Update-AzSynapseSparkPool -WorkspaceName ContosoWorkspace -Name ContosoSparkPool -PackageAction Remove -Package $package
```

The first command retrieves workspace packages named ContosoPackage. The second command removes the workspaces package from an Apache Spark pool in Azure Synapse Analytics.
The first command retrieves workspace packages named ContosoPackage. The second command removes the workspace package from an Apache Spark pool in Azure Synapse Analytics.

### Example 11
```powershell
PS C:\> $pool = Get-AzSynapseSparkPool -ResourceGroupName ContosoResourceGroup -WorkspaceName ContosoWorkspace -Name ContosoSparkPool
PS C:\> $pool | Update-AzSynapseSparkPool -PackageAction Remove -Package $pool.WorkspacePackages
```

The first command retrieves an Apache Spark pool in Azure Synapse Analytics. The second command removes all workspace packages that are linked to that Apache Spark pool.

## PARAMETERS

Expand Down

0 comments on commit a387ffb

Please sign in to comment.