Skip to content

Commit 275ce15

Browse files
committed
Don't delete symlinks in test mode
1 parent bec68c0 commit 275ce15

2 files changed

Lines changed: 4 additions & 2 deletions

File tree

changelog/69895.fixed.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fixed `x509_v2.certificate_managed` deleting symlinks in test mode if `follow_symlinks` was explicitly set to `false`

salt/states/x509_v2.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -466,8 +466,9 @@ def certificate_managed(
466466
if file_args.get("follow_symlinks", True):
467467
real_name = os.path.realpath(name)
468468
else:
469-
# workaround https://github.com/saltstack/salt/issues/31802
470-
__salt__["file.remove"](name)
469+
if not __opts__["test"]:
470+
# workaround https://github.com/saltstack/salt/issues/31802
471+
__salt__["file.remove"](name)
471472
replace = True
472473

473474
if __salt__["file.file_exists"](real_name):

0 commit comments

Comments
 (0)