Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix lowpkg.diff documentation and parameter name #51410

Merged
merged 1 commit into from Feb 1, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 4 additions & 4 deletions salt/modules/rpm.py
Expand Up @@ -425,27 +425,27 @@ def owner(*paths):
@salt.utils.decorators.path.which('rpm2cpio')
@salt.utils.decorators.path.which('cpio')
@salt.utils.decorators.path.which('diff')
def diff(package, path):
def diff(package_path, path):
'''
Return a formatted diff between current file and original in a package.
NOTE: this function includes all files (configuration and not), but does
not work on binary content.

:param package: The name of the package
:param package: Full pack of the RPM file
:param path: Full path to the installed file
:return: Difference or empty string. For binary files only a notification.

CLI example:

.. code-block:: bash

salt '*' lowpkg.diff apache2 /etc/apache2/httpd.conf
salt '*' lowpkg.diff /path/to/apache2.rpm /etc/apache2/httpd.conf
'''

cmd = "rpm2cpio {0} " \
"| cpio -i --quiet --to-stdout .{1} " \
"| diff -u --label 'A {1}' --from-file=- --label 'B {1}' {1}"
res = __salt__['cmd.shell'](cmd.format(package, path),
res = __salt__['cmd.shell'](cmd.format(package_path, path),
output_loglevel='trace')
if res and res.startswith('Binary file'):
return 'File \'{0}\' is binary and its content has been ' \
Expand Down