-
-
Notifications
You must be signed in to change notification settings - Fork 392
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add
force
& force_backup
args to files.[file|directory|link]
op…
…erations. (#631) * Add `force` & `force_backup` args to `files.[file|directory|link]` operations. This makes it possible to have pyinfra move or remove an existing and invalid path before creating the desired one. * Add `force_backup_dir` argument to `files.[file|directory|link]` operations. * Fix rebase error in config defaults.
- Loading branch information
Showing
11 changed files
with
185 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
"args": ["testdir"], | ||
"kwargs": { | ||
"force": true | ||
}, | ||
"facts": { | ||
"files.Directory": { | ||
"path=testdir": false | ||
} | ||
}, | ||
"commands": [ | ||
"mv testdir testdir.a-timestamp", | ||
"mkdir -p testdir" | ||
] | ||
} |
16 changes: 16 additions & 0 deletions
16
tests/operations/files.directory/add_force_backup_dir.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{ | ||
"args": ["testdir"], | ||
"kwargs": { | ||
"force": true, | ||
"force_backup_dir": "/tmp" | ||
}, | ||
"facts": { | ||
"files.Directory": { | ||
"path=testdir": false | ||
} | ||
}, | ||
"commands": [ | ||
"mv testdir /tmp/testdir.a-timestamp", | ||
"mkdir -p testdir" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{ | ||
"args": ["testdir"], | ||
"kwargs": { | ||
"force": true, | ||
"force_backup": false | ||
}, | ||
"facts": { | ||
"files.Directory": { | ||
"path=testdir": false | ||
} | ||
}, | ||
"commands": [ | ||
"rm -rf testdir", | ||
"mkdir -p testdir" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
"args": ["testfile"], | ||
"kwargs": { | ||
"force": true | ||
}, | ||
"facts": { | ||
"files.File": { | ||
"path=testfile": false | ||
} | ||
}, | ||
"commands": [ | ||
"mv testfile testfile.a-timestamp", | ||
"touch testfile" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{ | ||
"args": ["testfile"], | ||
"kwargs": { | ||
"force": true, | ||
"force_backup_dir": "/tmp/somewhere" | ||
}, | ||
"facts": { | ||
"files.File": { | ||
"path=testfile": false | ||
} | ||
}, | ||
"commands": [ | ||
"mv testfile /tmp/somewhere/testfile.a-timestamp", | ||
"touch testfile" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{ | ||
"args": ["testfile"], | ||
"kwargs": { | ||
"force": true, | ||
"force_backup": false | ||
}, | ||
"facts": { | ||
"files.File": { | ||
"path=testfile": false | ||
} | ||
}, | ||
"commands": [ | ||
"rm -rf testfile", | ||
"touch testfile" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{ | ||
"args": ["testlink"], | ||
"kwargs": { | ||
"target": "/etc/init.d/nginx", | ||
"force": true | ||
}, | ||
"facts": { | ||
"files.Link": { | ||
"path=testlink": false | ||
} | ||
}, | ||
"commands": [ | ||
"mv testlink testlink.a-timestamp", | ||
"ln -s /etc/init.d/nginx testlink" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
{ | ||
"args": ["testlink"], | ||
"kwargs": { | ||
"target": "/etc/init.d/nginx", | ||
"force": true, | ||
"force_backup_dir": "/tmp/somewhere" | ||
}, | ||
"facts": { | ||
"files.Link": { | ||
"path=testlink": false | ||
} | ||
}, | ||
"commands": [ | ||
"mv testlink /tmp/somewhere/testlink.a-timestamp", | ||
"ln -s /etc/init.d/nginx testlink" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
{ | ||
"args": ["testlink"], | ||
"kwargs": { | ||
"target": "/etc/init.d/nginx", | ||
"force": true, | ||
"force_backup": false | ||
}, | ||
"facts": { | ||
"files.Link": { | ||
"path=testlink": false | ||
} | ||
}, | ||
"commands": [ | ||
"rm -rf testlink", | ||
"ln -s /etc/init.d/nginx testlink" | ||
] | ||
} |