Skip to content
Permalink

Comparing changes

This is a direct comparison between two commits made in this repository or its related repositories. View the default comparison for this range or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: Bcfg2/bcfg2
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: d1c2a98894fed370ab7cfa91d7f7c3add6244bd8
Choose a base ref
..
head repository: Bcfg2/bcfg2
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: d4e05b5955ca5a59ee0275823c0e0684c7ea6252
Choose a head ref
Showing with 43 additions and 14 deletions.
  1. +4 −0 man/bcfg2.conf.5
  2. +6 −6 src/lib/Bcfg2/Client/Tools/YUM.py
  3. +11 −5 src/lib/Bcfg2/Client/__init__.py
  4. +1 −0 src/lib/Bcfg2/Server/Plugins/ACL.py
  5. +21 −3 testsuite/Testsrc/Testlib/TestServer/TestEncryption.py
4 changes: 4 additions & 0 deletions man/bcfg2.conf.5
Original file line number Diff line number Diff line change
@@ -554,6 +554,10 @@ The following options are specified in the \fB[packages]\fP section.
.INDENT 3.5
.INDENT 0.0
.TP
.B backends
Comma separated list of backends for the dependency resolution.
Default is "Yum,Apt,Pac,Pkgng".
.TP
.B resolver
Enable dependency resolution. Default is 1 (true).
.TP
12 changes: 6 additions & 6 deletions src/lib/Bcfg2/Client/Tools/YUM.py
Original file line number Diff line number Diff line change
@@ -146,11 +146,11 @@ class YUM(Bcfg2.Client.Tools.PkgTool):
Bcfg2.Options.Option(
cf=('YUM', 'verify_flags'), default=[],
dest="yum_verify_flags", type=Bcfg2.Options.Types.comma_list,
help="YUM verify flags")]
help="YUM verify flags"),
Bcfg2.Options.Option(
cf=('YUM', 'disabled_plugins'), default=[],
type=Bcfg2.Options.Types.comma_list, dest="yum_disabled_plugins",
help="YUM disabled plugins")]
help="YUM disabled plugins"),
Bcfg2.Options.Option(
cf=('YUM', 'enabled_plugins'), default=[],
type=Bcfg2.Options.Types.comma_list, dest="yum_enabled_plugins",
@@ -254,12 +254,12 @@ def _loadYumBase(self):
debuglevel = 0

if len(Bcfg2.Options.setup.yum_disabled_plugins) > 0:
rv.preconf.disabled_plugins=
Bcfg2.Options.setup.yum_disabled_plugins
rv.preconf.disabled_plugins = \
Bcfg2.Options.setup.yum_disabled_plugins

if len(Bcfg2.Options.setup.yum_enabled_plugins) > 0:
rv.preconf.enabled_plugins=
Bcfg2.Options.setup.yum_enabled_plugins
rv.preconf.enabled_plugins = \
Bcfg2.Options.setup.yum_enabled_plugins

# pylint: disable=E1121,W0212
try:
16 changes: 11 additions & 5 deletions src/lib/Bcfg2/Client/__init__.py
Original file line number Diff line number Diff line change
@@ -873,15 +873,21 @@ def Execute(self):

def GenerateStats(self):
"""Generate XML summary of execution statistics."""
states = {}
for (item, val) in list(self.states.items()):
if not Bcfg2.Options.setup.only_important or \
item.get('important', 'false').lower() == 'true':
states[item] = val

feedback = XML.Element("upload-statistics")
stats = XML.SubElement(feedback,
'Statistics', total=str(len(self.states)),
'Statistics', total=str(len(states)),
version='2.0',
revision=self.config.get('revision', '-1'))
good_entries = [key for key, val in list(self.states.items()) if val]
good_entries = [key for key, val in list(states.items()) if val]
good = len(good_entries)
stats.set('good', str(good))
if any(not val for val in list(self.states.values())):
if any(not val for val in list(states.values())):
stats.set('state', 'dirty')
else:
stats.set('state', 'clean')
@@ -890,8 +896,8 @@ def GenerateStats(self):
for (data, ename) in [(self.modified, 'Modified'),
(self.extra, "Extra"),
(good_entries, "Good"),
([entry for entry in self.states
if not self.states[entry]], "Bad")]:
([entry for entry in states
if not states[entry]], "Bad")]:
container = XML.SubElement(stats, ename)
for item in data:
item.set('qtext', '')
1 change: 1 addition & 0 deletions src/lib/Bcfg2/Server/Plugins/ACL.py
Original file line number Diff line number Diff line change
@@ -36,6 +36,7 @@ def rmi_names_equal(first, second):

class IPACLFile(Bcfg2.Server.Plugin.XMLFileBacked):
""" representation of ACL ip.xml, for IP-based ACLs """
__identifier__ = None
actions = dict(Allow=True,
Deny=False,
Defer=None)
24 changes: 21 additions & 3 deletions testsuite/Testsrc/Testlib/TestServer/TestEncryption.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
import os
import sys
from Bcfg2.Compat import b64decode
from Bcfg2.Compat import b64decode, b64encode
from mock import Mock, MagicMock, patch

# add all parent testsuite directories to sys.path to allow (most)
@@ -125,10 +125,28 @@ def test_bruteforce_decrypt(self):
passwd,
"also bogus"]))

# test with no good passphrase given nor in config
# test with no good passphrase given nor in config. we use
# something that isn't a valid ciphertext here since a
# ciphertext encrypted with one key may be technically
# decryptable with a different key, although it will decrypt
# to gibberish. nonetheless, it doesn't raise the requisite
# EVPError, so the test fails.
self.assertRaises(EVPError,
bruteforce_decrypt,
crypted, passphrases=["bogus", "also bogus"])
b64encode("not an actual ciphertext!"),
passphrases=["bogus", "also bogus"])

# test with no good passphrase given nor in config. this
# version of the test uses a valid ciphertext, and looks for
# *either* EVPError or a failed decrypt.
try:
plaintext = bruteforce_decrypt(crypted,
passphrases=["bogus", "also bogus"])
if plaintext == passwd:
self.fail("Successfully decrypted ciphertext with wrong key")
except EVPError:
# success!
pass

# test with good passphrase in config file
Bcfg2.Options.setup.passphrases = dict(bogus="bogus",