summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSol Jerome <solj@ices.utexas.edu>2010-03-13 21:18:53 +0000
committerSol Jerome <solj@ices.utexas.edu>2010-03-13 15:21:49 -0600
commit64659200c00ab083f0cbbe92ea7fb8d212772da7 (patch)
tree0103f80316e30e551602807616e7ce7c5b2eed69
parentfe026abed813e810c3980cc90904287fb5d48620 (diff)
downloadbcfg2-64659200c00ab083f0cbbe92ea7fb8d212772da7.tar.gz
bcfg2-64659200c00ab083f0cbbe92ea7fb8d212772da7.tar.bz2
bcfg2-64659200c00ab083f0cbbe92ea7fb8d212772da7.zip
APT: Add support for using non-standard tool paths (Resolves Ticket #773
Signed-off-by: Sol Jerome <solj@ices.utexas.edu> git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@5766 ce84e21b-d406-0410-9b95-82705330c041
-rw-r--r--doc/client/tools/apt.txt16
-rw-r--r--doc/client/tools/index.txt3
-rw-r--r--src/lib/Client/Tools/APT.py34
-rw-r--r--src/lib/Options.py10
4 files changed, 53 insertions, 10 deletions
diff --git a/doc/client/tools/apt.txt b/doc/client/tools/apt.txt
new file mode 100644
index 000000000..dba359e4a
--- /dev/null
+++ b/doc/client/tools/apt.txt
@@ -0,0 +1,16 @@
+.. -*- mode: rst -*-
+
+.. _client-tools-apt:
+
+=====================
+Bcfg2 APT Client Tool
+=====================
+
+The APT tool allows you to configure custom options in ``bcfg2.conf``
+for systems where the tools reside in non-standard locations. The
+available options (and their corresponding default values) are::
+
+ [APT]
+ install_path = '/usr'
+ var_path = '/var'
+ etc_path = '/etc'
diff --git a/doc/client/tools/index.txt b/doc/client/tools/index.txt
index 6ae903c50..37fcdae5c 100644
--- a/doc/client/tools/index.txt
+++ b/doc/client/tools/index.txt
@@ -38,7 +38,8 @@ APT
---
Debian Packages. This tool driver is used to handle packages on dpkg
-based systems and employs the "apt" executable.
+based systems and employs the "apt" executable. Extra information can be
+found at :ref:`client-tools-apt`.
Blast
-----
diff --git a/src/lib/Client/Tools/APT.py b/src/lib/Client/Tools/APT.py
index ed686e400..395b87e77 100644
--- a/src/lib/Client/Tools/APT.py
+++ b/src/lib/Client/Tools/APT.py
@@ -9,21 +9,37 @@ warnings.filterwarnings("ignore", "Accessed deprecated property Package.installe
warnings.filterwarnings("ignore", "Accessed deprecated property Package.candidateVersion, please see the Version class for alternatives.", DeprecationWarning)
import apt.cache
import os
+
import Bcfg2.Client.Tools
+import Bcfg2.Options
+
+# Options for tool locations
+opts = {'install_path': Bcfg2.Options.CLIENT_APT_TOOLS_INSTALL_PATH,
+ 'var_path': Bcfg2.Options.CLIENT_APT_TOOLS_VAR_PATH,
+ 'etc_path': Bcfg2.Options.CLIENT_SYSTEM_ETC_PATH}
+setup = Bcfg2.Options.OptionParser(opts)
+setup.parse([])
+install_path = setup['install_path']
+var_path = setup['var_path']
+etc_path = setup['etc_path']
+DEBSUMS = '%s/bin/debsums' % install_path
+APTGET = '%s/bin/apt-get' % install_path
+DPKG = '%s/bin/dpkg' % install_path
class APT(Bcfg2.Client.Tools.Tool):
'''The Debian toolset implements package and service operations and inherits
the rest from Toolset.Toolset'''
name = 'APT'
- __execs__ = ['/usr/bin/debsums', '/usr/bin/apt-get', '/usr/bin/dpkg']
- __important__ = ["/etc/apt/sources.list",
- "/var/cache/debconf/config.dat",
- "/var/cache/debconf/templates.dat",
+ __execs__ = [DEBSUMS, APTGET, DPKG]
+ __important__ = ["%s/apt/sources.list" % etc_path,
+ "%s/cache/debconf/config.dat" % var_path,
+ "%s/cache/debconf/templates.dat" % var_path,
'/etc/passwd', '/etc/group',
- '/etc/apt/apt.conf', '/etc/dpkg/dpkg.cfg']
+ '%s/apt/apt.conf' % etc_path,
+ '%s/dpkg/dpkg.cfg' % etc_path]
__handles__ = [('Package', 'deb')]
__req__ = {'Package': ['name', 'version']}
- pkgcmd = 'apt-get ' + \
+ pkgcmd = '%s ' % APTGET + \
'-o DPkg::Options::=--force-overwrite ' + \
'-o DPkg::Options::=--force-confold ' + \
'--reinstall ' + \
@@ -37,8 +53,8 @@ class APT(Bcfg2.Client.Tools.Tool):
os.environ["DEBIAN_FRONTEND"] = 'noninteractive'
self.actions = {}
if self.setup['kevlar'] and not self.setup['dryrun']:
- self.cmd.run("dpkg --force-confold --configure --pending")
- self.cmd.run("apt-get clean")
+ self.cmd.run("%s --force-confold --configure --pending" % DPKG)
+ self.cmd.run("%s clean" % APTGET)
self.pkg_cache = apt.cache.Cache()
self.pkg_cache.update()
self.pkg_cache = apt.cache.Cache()
@@ -53,7 +69,7 @@ class APT(Bcfg2.Client.Tools.Tool):
for (name, version) in extras]
def VerifyDebsums(self, entry, modlist):
- output = self.cmd.run("/usr/bin/debsums -as %s" % entry.get('name'))[1]
+ output = self.cmd.run("%s -as %s" % (DEBSUMS, entry.get('name')))[1]
if len(output) == 1 and "no md5sums for" in output[0]:
self.logger.info("Package %s has no md5sums. Cannot verify" % \
entry.get('name'))
diff --git a/src/lib/Options.py b/src/lib/Options.py
index c2e265b87..879bc3bab 100644
--- a/src/lib/Options.py
+++ b/src/lib/Options.py
@@ -247,6 +247,16 @@ SERVER_PROTOCOL = Option('Server Protocol', cf=('communication', 'procotol'),
SENDMAIL_PATH = Option('Path to sendmail', cf=('reports', 'sendmailpath'),
default='/usr/lib/sendmail')
+# APT client tool options
+CLIENT_APT_TOOLS_INSTALL_PATH = Option('Apt tools install path',
+ cf=('APT', 'install_path'),
+ default='/usr')
+CLIENT_APT_TOOLS_VAR_PATH = Option('Apt tools var path',
+ cf=('APT', 'var_path'), default='/var')
+CLIENT_SYSTEM_ETC_PATH = Option('System etc path', cf=('APT', 'etc_path'),
+ default='/etc')
+
+
CLIENT_PROFILE = Option('assert the given profile for the host',
default=False, cmd='-p', odesc="<profile>")
CLIENT_RETRIES = Option('the number of times to retry network communication',