mirror of
				https://github.com/kewlfft/ansible-aur.git
				synced 2025-11-04 10:02:30 +03:00 
			
		
		
		
	Merge pull request #36 from juergenhoetzel/diff
Add diff support in check mode
This commit is contained in:
		@@ -108,11 +108,17 @@ def check_packages(module, packages):
 | 
				
			|||||||
    Inform the user what would change if the module were run
 | 
					    Inform the user what would change if the module were run
 | 
				
			||||||
    """
 | 
					    """
 | 
				
			||||||
    would_be_changed = []
 | 
					    would_be_changed = []
 | 
				
			||||||
 | 
					    diff = {
 | 
				
			||||||
 | 
					        'before': '',
 | 
				
			||||||
 | 
					        'after': '',
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    for package in packages:
 | 
					    for package in packages:
 | 
				
			||||||
        installed = package_installed(module, package)
 | 
					        installed = package_installed(module, package)
 | 
				
			||||||
        if not installed:
 | 
					        if not installed:
 | 
				
			||||||
            would_be_changed.append(package)
 | 
					            would_be_changed.append(package)
 | 
				
			||||||
 | 
					            if module._diff:
 | 
				
			||||||
 | 
					                diff['after'] += package + "\n"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if would_be_changed:
 | 
					    if would_be_changed:
 | 
				
			||||||
        status = True
 | 
					        status = True
 | 
				
			||||||
@@ -126,7 +132,7 @@ def check_packages(module, packages):
 | 
				
			|||||||
            message = 'all packages are already installed'
 | 
					            message = 'all packages are already installed'
 | 
				
			||||||
        else:
 | 
					        else:
 | 
				
			||||||
            message = 'package is already installed'
 | 
					            message = 'package is already installed'
 | 
				
			||||||
    module.exit_json(changed=status, msg=message)
 | 
					    module.exit_json(changed=status, msg=message, diff=diff)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
def install_with_makepkg(module, package):
 | 
					def install_with_makepkg(module, package):
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user