Skip to content

Add demote support to Update-PfbFileSystem (-DiscardNonSnapshottedData, -RequestedPromotionState) - #1

Merged
dmann000 merged 1 commit into
dmann000:mainfrom
juemerson-at-purestorage:feature/update-pfbfilesystem-demote-v2
Jul 2, 2026
Merged

Add demote support to Update-PfbFileSystem (-DiscardNonSnapshottedData, -RequestedPromotionState)#1
dmann000 merged 1 commit into
dmann000:mainfrom
juemerson-at-purestorage:feature/update-pfbfilesystem-demote-v2

Conversation

@juemerson-at-purestorage

Copy link
Copy Markdown
Collaborator

Summary

A file-system demote (set a promoted/read-write FS to a read-only replication target) previously required dropping to raw REST. This adds two parameters to Update-PfbFileSystem:

  • -DiscardNonSnapshottedData (switch): sends the discard_non_snapshotted_data=true query param, required by the API when demoting.
  • -RequestedPromotionState (promoted|demoted): sets requested_promotion_state in the request body. Mutually exclusive with -Attributes (throws if both are supplied — no silent precedence).

Resulting request:

PATCH /file-systems?names=fs1&discard_non_snapshotted_data=true
Body: { "requested_promotion_state": "demoted" }

Promote was already supported via -Attributes @{ requested_promotion_state = 'promoted' } and is unchanged. Omitting the new switch produces the identical request as before this change — no regression to existing callers.

Field names verified against FB-2.26-openapi.json: discard_non_snapshotted_data is a query boolean, requested_promotion_state is a writable PATCH body field with values promoted/demoted.

Changes

  • Public/FileSystem/Update-PfbFileSystem.ps1 — new params, body/query wiring, mutual-exclusion guard, comment-based help (+2 demote examples).
  • PureStorageFlashBladePowerShell.psd1ModuleVersion 2.0.4 -> 2.0.5 + new v2.0.5 ReleaseNotes entry.
  • Tests/Update-PfbFileSystem.Demote.Tests.ps1 — new Pester 5 suite (6 tests): switch present/absent, typed-param body, end-to-end demote shape, ValidateSet rejection, both-supplied guard.

Test plan

  • Invoke-Pester Tests/Update-PfbFileSystem.Demote.Tests.ps1 — 6/6 pass
  • Parser check on both modified files — clean
  • Full module build succeeds (520 public functions) — verified via a local workaround; note: build.ps1 at repo root currently fails as committed on main because it resolves $repoRoot as if the script lived in <repo>/scripts/ (introduced in the same fc6d8de1 / v2.0.4 commit), but the file is still at repo root. Unrelated to this PR — happy to open a separate fix if useful.

- -DiscardNonSnapshottedData switch -> discard_non_snapshotted_data=true query param
- typed -RequestedPromotionState (promoted|demoted), mutually exclusive with -Attributes
- Pester coverage (6 tests) + v2.0.5 release notes

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@dmann000
dmann000 merged commit 449d7cd into dmann000:main Jul 2, 2026
juemerson-at-purestorage added a commit that referenced this pull request Jul 6, 2026
Fix #1 (-HttpTimeout is a no-op), Fix #2 (TLS 1.2 wrongly coupled to
-IgnoreCertificateError), Fix #4 (Connect-PfbArray not reusing
ConvertTo-PfbApiError) -- three issues found while auditing this code
earlier, bundled into this branch since they touch the same file.
Fix #3 (OAuth2 auto-reconnect) already became the sibling
feature/connect-pfbarray-oauth2-token-refresh branch.

Scoped to explicitly avoid the Certificate/OAuth2 branch of
Connect-PfbArray.ps1, which the sibling branch is about to rewrite --
touching it here would create a guaranteed merge conflict.
juemerson-at-purestorage added a commit that referenced this pull request Jul 6, 2026
Fix #1 (-HttpTimeout is a no-op), Fix #2 (TLS 1.2 wrongly coupled to
-IgnoreCertificateError), Fix #4 (Connect-PfbArray not reusing
ConvertTo-PfbApiError) -- three issues found while auditing this code
earlier, bundled into this branch since they touch the same file.
Fix #3 (OAuth2 auto-reconnect) already became the sibling
feature/connect-pfbarray-oauth2-token-refresh branch.

Scoped to explicitly avoid the Certificate/OAuth2 branch of
Connect-PfbArray.ps1, which the sibling branch is about to rewrite --
touching it here would create a guaranteed merge conflict.
juemerson-at-purestorage pushed a commit to juemerson-at-purestorage/fb-powershell that referenced this pull request Jul 22, 2026
…pdate-pfbfilesystem-demote-v2

Add demote support to Update-PfbFileSystem (-DiscardNonSnapshottedData, -RequestedPromotionState)
juemerson-at-purestorage added a commit to juemerson-at-purestorage/fb-powershell that referenced this pull request Jul 22, 2026
Fix dmann000#1 (-HttpTimeout is a no-op), Fix dmann000#2 (TLS 1.2 wrongly coupled to
-IgnoreCertificateError), Fix dmann000#4 (Connect-PfbArray not reusing
ConvertTo-PfbApiError) -- three issues found while auditing this code
earlier, bundled into this branch since they touch the same file.
Fix dmann000#3 (OAuth2 auto-reconnect) already became the sibling
feature/connect-pfbarray-oauth2-token-refresh branch.

Scoped to explicitly avoid the Certificate/OAuth2 branch of
Connect-PfbArray.ps1, which the sibling branch is about to rewrite --
touching it here would create a guaranteed merge conflict.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants