Skip to content

Commit a387ffb

Browse files
idear1203Dongwei Wang
andauthored
[Synapse] - fix workspace package null check issue (Azure#15847)
* [Synapse] - fix workspace package null check issue * Fix null check for library requirements * update changelog Co-authored-by: Dongwei Wang <dongwwa@microsoft.com>
1 parent 9c050cd commit a387ffb

File tree

3 files changed

+17
-3
lines changed

3 files changed

+17
-3
lines changed

src/Synapse/Synapse/ChangeLog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
- Additional information about change #1
1919
-->
2020
## Upcoming Release
21+
* Fixed the issue when `Update-AzSynapseSparkPool` is used with workspace package
2122

2223
## Version 0.15.0
2324
* Added support for Synapse Managed Private Endpoint

src/Synapse/Synapse/Commands/ManagementCommands/SparkPool/UpdateAzureSynapseSparkPool.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ public override void ExecuteCmdlet()
222222
{
223223
if (this.PackageAction == SynapseConstants.PackageActionType.Add)
224224
{
225-
if (existingSparkPool == null)
225+
if (existingSparkPool.CustomLibraries == null)
226226
{
227227
existingSparkPool.CustomLibraries = new List<LibraryInfo>();
228228
}
@@ -251,6 +251,11 @@ public override void ExecuteCmdlet()
251251

252252
private LibraryRequirements CreateLibraryRequirements()
253253
{
254+
if (string.IsNullOrEmpty(LibraryRequirementsFilePath))
255+
{
256+
return null;
257+
}
258+
254259
var powerShellDestinationPath = SessionState.Path.GetUnresolvedProviderPathFromPSPath(LibraryRequirementsFilePath);
255260

256261
return new LibraryRequirements

src/Synapse/Synapse/help/Update-AzSynapseSparkPool.md

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,15 +122,23 @@ PS C:\> $packages = Get-AzSynapseWorkspacePackage -WorkspaceName ContosoWorkspac
122122
PS C:\> Update-AzSynapseSparkPool -WorkspaceName ContosoWorkspace -Name ContosoSparkPool -PackageAction Add -Package $packages
123123
```
124124

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

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

133-
The first command retrieves workspace packages named ContosoPackage. The second command removes the workspaces package from an Apache Spark pool in Azure Synapse Analytics.
133+
The first command retrieves workspace packages named ContosoPackage. The second command removes the workspace package from an Apache Spark pool in Azure Synapse Analytics.
134+
135+
### Example 11
136+
```powershell
137+
PS C:\> $pool = Get-AzSynapseSparkPool -ResourceGroupName ContosoResourceGroup -WorkspaceName ContosoWorkspace -Name ContosoSparkPool
138+
PS C:\> $pool | Update-AzSynapseSparkPool -PackageAction Remove -Package $pool.WorkspacePackages
139+
```
140+
141+
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.
134142

135143
## PARAMETERS
136144

0 commit comments

Comments
 (0)