summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Sulfrian <asulfrian@zedat.fu-berlin.de>2021-06-18 17:07:40 +0200
committerAlexander Sulfrian <asulfrian@zedat.fu-berlin.de>2022-01-30 05:03:22 +0100
commit161953cb28f356e1aa38f5cf67234f28a19ceb26 (patch)
treee9fa337b45bea85529387e36017761d2797cff71
parent6ab8aaff8adefe8fe4b588fac16d3f1c1e0b0715 (diff)
downloadbcfg2-161953cb28f356e1aa38f5cf67234f28a19ceb26.tar.gz
bcfg2-161953cb28f356e1aa38f5cf67234f28a19ceb26.tar.bz2
bcfg2-161953cb28f356e1aa38f5cf67234f28a19ceb26.zip
debconf: Find extra entries
Extra debconf entries, are entries that were seen but that are not specified in the configuration.
-rw-r--r--schemas/types.xsd3
-rw-r--r--src/lib/Bcfg2/Client/Tools/Debconf.py33
2 files changed, 23 insertions, 13 deletions
diff --git a/schemas/types.xsd b/schemas/types.xsd
index fbd55547d..fc2e7bdc4 100644
--- a/schemas/types.xsd
+++ b/schemas/types.xsd
@@ -559,8 +559,7 @@
<xsd:attribute type="xsd:string" name="value">
<xsd:annotation>
<xsd:documentation>
- The value of the configuration setting. If this is not specified,
- the setting will be reset to it's default value.
+ The value of the configuration setting.
</xsd:documentation>
</xsd:annotation>
</xsd:attribute>
diff --git a/src/lib/Bcfg2/Client/Tools/Debconf.py b/src/lib/Bcfg2/Client/Tools/Debconf.py
index 147d58b4b..4e8797b1c 100644
--- a/src/lib/Bcfg2/Client/Tools/Debconf.py
+++ b/src/lib/Bcfg2/Client/Tools/Debconf.py
@@ -8,7 +8,7 @@ import Bcfg2.Client.Tools
class Debconf(Bcfg2.Client.Tools.Tool):
"""Debconf Support for Bcfg2."""
name = 'Debconf'
- __execs__ = ['/usr/bin/debconf-communicate']
+ __execs__ = ['/usr/bin/debconf-communicate', '/usr/bin/debconf-show']
__handles__ = [('Conf', 'debconf')]
__req__ = {'Conf': ['name']}
@@ -65,20 +65,13 @@ class Debconf(Bcfg2.Client.Tools.Tool):
def VerifyConf(self, entry, _modlist):
""" Verify the given Debconf entry. """
- (seen, value) = self.debconf_get(entry.get('name'))
- if 'value' not in entry.attrib:
- if seen == 'true':
- return False
- else:
- if value != entry.get('value'):
- return False
+ (_, value) = self.debconf_get(entry.get('name'))
+ if value != entry.get('value'):
+ return False
return True
def InstallConf(self, entry):
""" Install the given Debconf entry. """
- if 'value' not in entry.attrib:
- return self.debconf_reset(entry.get('name'))
-
return self.debconf_set(entry.get('name'), entry.get('value'))
def Inventory(self, structures=None):
@@ -100,3 +93,21 @@ class Debconf(Bcfg2.Client.Tools.Tool):
return result
Install.__doc__ = Bcfg2.Client.Tools.Tool.Install.__doc__
+
+ def FindExtra(self):
+ specified = [entry.get('name')
+ for entry in self.getSupportedEntries()]
+ extra = set()
+ listowners = self.cmd.run(['/usr/bin/debconf-show', '--listowners'])
+ if listowners.success:
+ owners = listowners.stdout.splitlines()
+
+ values = self.cmd.run(['/usr/bin/debconf-show'] + owners)
+ for line in values.stdout.splitlines():
+ if len(line) > 2 and line[0] == '*':
+ (name, value) = line[2:].split(':', 2)
+ if name not in specified:
+ extra.add(name)
+ return [Bcfg2.Client.XML.Element('Conf', name=name, type='debconf')
+ for name in list(extra)]
+ FindExtra.__doc__ = Bcfg2.Client.Tools.Tool.FindExtra.__doc__