Skip to content

Commit 3ca4505

Browse files
authored
docs: fix wrong example operation using forbidden argument 'name'
1 parent 8edc0af commit 3ca4505

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

docs/api/operations.md

+6-6
Original file line numberDiff line numberDiff line change
@@ -55,25 +55,25 @@ from pyinfra.api import operation
5555
from pyinfra.facts.files import File
5656

5757
@operation()
58-
def file(name, present=True):
58+
def file(path, present=True):
5959
'''
6060
Manage the state of files.
6161
62-
+ name: name/path of the remote file
62+
+ path: name/path of the remote file
6363
+ present: whether the file should exist
6464
'''
6565

66-
info = host.get_fact(File, path=name)
66+
info = host.get_fact(File, path=path)
6767

6868
# Not a file?!
6969
if info is False:
70-
raise OperationError("{0} exists and is not a file".format(name))
70+
raise OperationError("{0} exists and is not a file".format(path))
7171

7272
# Doesn't exist & we want it
7373
if info is None and present:
74-
yield "touch {0}".format(name)
74+
yield "touch {0}".format(path)
7575

7676
# It exists and we don't want it
7777
elif info and not present:
78-
yield "rm -f {0}".format(name)
78+
yield "rm -f {0}".format(path)
7979
```

0 commit comments

Comments
 (0)