summaryrefslogtreecommitdiffstats
path: root/src/lib/Bcfg2/Server/Plugins/SSHbase.py
diff options
context:
space:
mode:
authorChris St. Pierre <chris.a.st.pierre@gmail.com>2013-01-08 13:16:35 -0500
committerChris St. Pierre <chris.a.st.pierre@gmail.com>2013-01-08 13:16:35 -0500
commit923e48916f19bedfe5b239b1baca18dc38c39491 (patch)
tree2d1db7141c14925e59262aae5f38eca3ddef9a2b /src/lib/Bcfg2/Server/Plugins/SSHbase.py
parent40bfc1dc57dd6a05a01f72d6332af7d586a15768 (diff)
downloadbcfg2-923e48916f19bedfe5b239b1baca18dc38c39491.tar.gz
bcfg2-923e48916f19bedfe5b239b1baca18dc38c39491.tar.bz2
bcfg2-923e48916f19bedfe5b239b1baca18dc38c39491.zip
replace unintuitive reduce() calls with slightly less unintuitive chain() calls
Diffstat (limited to 'src/lib/Bcfg2/Server/Plugins/SSHbase.py')
-rw-r--r--src/lib/Bcfg2/Server/Plugins/SSHbase.py15
1 files changed, 7 insertions, 8 deletions
diff --git a/src/lib/Bcfg2/Server/Plugins/SSHbase.py b/src/lib/Bcfg2/Server/Plugins/SSHbase.py
index feb76aa57..c7db67301 100644
--- a/src/lib/Bcfg2/Server/Plugins/SSHbase.py
+++ b/src/lib/Bcfg2/Server/Plugins/SSHbase.py
@@ -7,10 +7,11 @@ import socket
import shutil
import logging
import tempfile
+from itertools import chain
from subprocess import Popen, PIPE
import Bcfg2.Server.Plugin
from Bcfg2.Server.Plugin import PluginExecutionError
-from Bcfg2.Compat import any, u_str, reduce, b64encode # pylint: disable=W0622
+from Bcfg2.Compat import any, u_str, b64encode # pylint: disable=W0622
LOGGER = logging.getLogger(__name__)
@@ -200,15 +201,13 @@ class SSHbase(Bcfg2.Server.Plugin.Plugin,
if specific.hostname and specific.hostname in names:
hostnames = names[specific.hostname]
elif specific.group:
- hostnames = \
- reduce(lambda x, y: x + y,
- [names[cmeta.hostname]
- for cmeta in \
- mquery.by_groups([specific.group])], [])
+ hostnames = list(chain(
+ *[names[cmeta.hostname]
+ for cmeta in \
+ mquery.by_groups([specific.group])]))
elif specific.all:
# a generic key for all hosts? really?
- hostnames = reduce(lambda x, y: x + y,
- list(names.values()), [])
+ hostnames = list(chain(*list(names.values())))
if not hostnames:
if specific.hostname:
key = specific.hostname