Rename `windows_files` operations & deprecate old ones.
+ `windows_files.windows_file` -> `windows_files.file`
+ `windows_files.windows_directory` -> `windows_files.directory`
@@ -8,13 +8,14 @@ import ntpath
import six
+from pyinfra import logger
from pyinfra.api import operation, OperationError, OperationTypeError
@operation(pipeline_facts={
'windows_file': 'name',
})
-def windows_file(
+def file(
state, host, name,
present=True, assume_present=False,
user=None, group=None, mode=None, touch=False,
@@ -92,11 +93,21 @@ def windows_file(
# yield chown(name, user, group)
+def windows_file(*args, **kwargs):
+ # COMPAT
+ # TODO: remove this
+ logger.warning((
+ 'Use of `windows_files.windows_file` is deprecated, '
+ 'please use `windows_files.file` instead.'
+ ))
+ return file(*args, **kwargs)
+
+
def _create_remote_dir(state, host, remote_filename, user, group):
# Always use POSIX style path as local might be Windows, remote always *nix
remote_dirname = ntpath.dirname(remote_filename)
if remote_dirname:
- yield windows_directory(
+ yield directory(
state, host, remote_dirname,
user=user, group=group,
)
@@ -105,7 +116,7 @@ def _create_remote_dir(state, host, remote_filename, user, group):
@operation(pipeline_facts={
'windows_directory': 'name',
})
-def windows_directory(
+def directory(
state, host, name,
present=True, assume_present=False,
user=None, group=None, mode=None, recursive=False,
@@ -185,3 +196,13 @@ def windows_directory(
# or (group and info['group'] != group)
# ):
# yield chown(name, user, group, recursive=recursive)
+
+
+def windows_directory(*args, **kwargs):
+ # COMPAT
+ # TODO: remove this
+ logger.warning((
+ 'Use of `windows_files.windows_directory` is deprecated, '
+ 'please use `windows_files.directory` instead.'
+ ))
+ return directory(*args, **kwargs)
