Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
ansible
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenEdx
ansible
Commits
ffb94f2e
Commit
ffb94f2e
authored
Jun 19, 2013
by
Michael DeHaan
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'purge' into devel
parents
6a7dac61
50fa88f2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
8 deletions
+13
-8
library/packaging/apt
+13
-8
No files found.
library/packaging/apt
View file @
ffb94f2e
...
...
@@ -150,25 +150,30 @@ def package_status(m, pkgname, version, cache, state):
if state == '
install
':
m.fail_json(msg="No package matching '
%
s
' is available" % pkgname)
else:
return False, False
return False, False, False
try:
has_files = len(pkg.installed_files) > 0
except AttributeError:
has_files = False # older python-apt cannot be used to determine non-purged
if version:
try :
return pkg.is_installed and fnmatch.fnmatch(pkg.installed.version, version), False
return pkg.is_installed and fnmatch.fnmatch(pkg.installed.version, version), False
, has_files
except AttributeError:
#assume older version of python-apt is installed
return pkg.isInstalled and fnmatch.fnmatch(pkg.installedVersion, version), False
return pkg.isInstalled and fnmatch.fnmatch(pkg.installedVersion, version), False
, has_files
else:
try :
return pkg.is_installed, pkg.is_upgradable
return pkg.is_installed, pkg.is_upgradable
, has_files
except AttributeError:
#assume older version of python-apt is installed
return pkg.isInstalled, pkg.isUpgradable
return pkg.isInstalled, pkg.isUpgradable
, has_files
def install(m, pkgspec, cache, upgrade=False, default_release=None, install_recommends=True, force=False):
packages = ""
for package in pkgspec:
name, version = package_split(package)
installed, upgradable = package_status(m, name, version, cache, state='
install
')
installed, upgradable
, has_files
= package_status(m, name, version, cache, state='
install
')
if not installed or (upgrade and upgradable):
packages += "'
%
s
' " % package
...
...
@@ -202,8 +207,8 @@ def remove(m, pkgspec, cache, purge=False):
packages = ""
for package in pkgspec:
name, version = package_split(package)
installed, upgradable = package_status(m, name, version, cache, state='
remove
')
if installed:
installed, upgradable
, has_files
= package_status(m, name, version, cache, state='
remove
')
if installed
or (has_files and purge)
:
packages += "'
%
s
' " % package
if len(packages) == 0:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment