Skip to content

Commit

Permalink
Merge branch '0.9.4' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
thatch45 committed Nov 26, 2011
2 parents 501c88f + 1da9fb0 commit 6c1e931
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions salt/modules/apt.py
Expand Up @@ -23,7 +23,7 @@ def available_version(name):
salt '*' pkg.available_version <package name>
'''
version = ''
cmd = 'apt-cache show ' + name + ' | grep Version'
cmd = 'apt-cache show {0} | grep Version'.format(name)

out = subprocess.Popen(cmd,
shell=True,
Expand Down Expand Up @@ -64,7 +64,7 @@ def refresh_db():
salt '*' pkg.refresh_db
'''
cmd = 'aptitude update'
cmd = 'apt-get update'
out = subprocess.Popen(cmd,
shell=True,
stdout=subprocess.PIPE).communicate()[0].split('\n')
Expand Down Expand Up @@ -101,7 +101,7 @@ def install(pkg, refresh=False):

ret_pkgs = {}
old_pkgs = list_pkgs()
cmd = 'aptitude -y install ' + pkg
cmd = 'apt-get -y install {0}'.format(pkg)
subprocess.call(cmd, shell=True)
new_pkgs = list_pkgs()

Expand Down Expand Up @@ -132,7 +132,7 @@ def remove(pkg):
ret_pkgs = []
old_pkgs = list_pkgs()

cmd = 'aptitude -y remove ' + pkg
cmd = 'apt-get -y remove {0}'.format(pkg)
subprocess.call(cmd, shell=True)
new_pkgs = list_pkgs()
for pkg in old_pkgs:
Expand All @@ -157,7 +157,7 @@ def purge(pkg):
old_pkgs = list_pkgs()

# Remove inital package
purge_cmd = 'aptitude -y purge ' + pkg
purge_cmd = 'apt-get -y purge {0}'.format(pkg)
subprocess.call(purge_cmd, shell=True)

new_pkgs = list_pkgs()
Expand All @@ -169,7 +169,6 @@ def purge(pkg):
return ret_pkgs


# FIXME: Unused argument 'refresh'? Undefined variable 'update_repos'?
def upgrade(refresh=True):
'''
Upgrades all packages via aptitude full-upgrade
Expand All @@ -189,12 +188,12 @@ def upgrade(refresh=True):
salt '*' pkg.upgrade
'''

if(update_repos):
if refresh:
refresh_db()

ret_pkgs = {}
old_pkgs = list_pkgs()
cmd = 'aptitude -y full-upgrade'
cmd = 'apt-get -y dist-upgrade'
subprocess.call(cmd, shell=True)
new_pkgs = list_pkgs()

Expand Down Expand Up @@ -223,7 +222,7 @@ def list_pkgs(regex_string=""):
salt '*' pkg.list_pkgs
'''
ret = {}
cmd = 'dpkg --list ' + regex_string
cmd = 'dpkg --list {0}'.format(regex_string)

out = subprocess.Popen(cmd,
shell=True,
Expand Down

0 comments on commit 6c1e931

Please sign in to comment.