Skip to content

Commit

Permalink
Fix lint issues. Simplify options building logic.
Browse files Browse the repository at this point in the history
  • Loading branch information
s0undt3ch committed Jan 6, 2014
1 parent 7a09c23 commit 3af5f5d
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions salt/modules/rsync.py
Expand Up @@ -15,31 +15,31 @@

log = logging.getLogger(__name__)


def _check(delete, force, update, passwordfile, exclude, excludefrom):
'''
Generate rsync options
'''
options = '-avz'
options = ['-avz']

if delete:
options = options + ' --delete'
options.append('--delete')
if force:
options = options + ' --force'
options.append('--force')
if update:
options = options +' --update'
options.append('--update')
if passwordfile:
options = options + ' --password-file=' + passwordfile
options.append('--password-file={0}'.format(passwordfile))
if excludefrom:
options = options + ' --exclude-from=' + excludefrom
options.append('--exclude-from={0}'.format(excludefrom))
if exclude:
exclude = None
if exclude:
options = options + ' --exclude=' + exclude
options.append(' --exclude={0}'.format(exclude))

return options



def rsync(src,
dst,
delete=False,
Expand Down Expand Up @@ -78,7 +78,6 @@ def rsync(src,
if not src or not dst:
raise CommandExecutionError('ERROR: src and dst cannot be empty.')


option = _check(delete, force, update, passwordfile, exclude, excludefrom)
cmd = (
r'''rsync {option} {src} {dst}'''
Expand Down Expand Up @@ -146,4 +145,3 @@ def config(confile='/etc/rsyncd.conf'):
raise CommandExecutionError(exc.strerror)

return ret

0 comments on commit 3af5f5d

Please sign in to comment.