summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorNarayan Desai <desai@mcs.anl.gov>2007-07-23 18:27:09 +0000
committerNarayan Desai <desai@mcs.anl.gov>2007-07-23 18:27:09 +0000
commit124fddb21f208d448cd56a56d6b5d56e3421063f (patch)
tree1f91d5d8175ba84e64b4e8bffb6b58f072fc9002 /src
parent8823854ee3b106cb17e8a43626f70f51726f3c15 (diff)
downloadbcfg2-124fddb21f208d448cd56a56d6b5d56e3421063f.tar.gz
bcfg2-124fddb21f208d448cd56a56d6b5d56e3421063f.tar.bz2
bcfg2-124fddb21f208d448cd56a56d6b5d56e3421063f.zip
Implement bcfg2-remote -H -
git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@3546 ce84e21b-d406-0410-9b95-82705330c041
Diffstat (limited to 'src')
-rwxr-xr-xsrc/sbin/bcfg2-remote38
1 files changed, 25 insertions, 13 deletions
diff --git a/src/sbin/bcfg2-remote b/src/sbin/bcfg2-remote
index 4b45965c6..6639fece7 100755
--- a/src/sbin/bcfg2-remote
+++ b/src/sbin/bcfg2-remote
@@ -4,7 +4,7 @@ __revision__ = '$Revision$'
from Bcfg2.tlslite.api import parsePEMKey, X509, X509CertChain
from xmlrpclib import ServerProxy
from Bcfg2.tlslite.integration.XMLRPCTransport import XMLRPCTransport
-import Bcfg2.Options, Bcfg2.Logging, logging, socket
+import Bcfg2.Options, Bcfg2.Logging, logging, socket, sys
if __name__ == '__main__':
opts = {
@@ -39,17 +39,29 @@ if __name__ == '__main__':
transport = XMLRPCTransport(certChain=certChain,
privateKey=privateKey)
- host = setup['host']
port = setup['agent-port']
- server = ServerProxy("https://%s:%s" % (host, port), transport)
+ status = 0
+ if setup['host'] == '-':
+ urls = ["https://%s:%s" % (host, port) for host in \
+ [line.strip() for line in sys.stdin.readlines()]]
+ else:
+ host = setup['host']
+ urls = ["https://%s:%s" % (host, port)]
- try:
- result = server.run()
- except socket.error, serr:
- if serr.args[0] == 111:
- logger.error("Failed to connect to client %s" % host)
- elif serr.args[0] == 32:
- logger.error("Connection to client %s dropped; authentication failure?" % host)
- else:
- logger.error("Got unexpected socket error %d" % serr.args[0])
- raise SystemExit(1)
+ for url in urls:
+ server = ServerProxy(url, transport)
+
+ try:
+ result = server.run()
+ except socket.error, serr:
+ if serr.args[0] == 111:
+ logger.error("Failed to connect to %s" % url)
+ elif serr.args[0] == 32:
+ logger.error("Connection to %s dropped; authentication failure?" % url)
+ elif serr.args[0] == -5:
+ logger.error("Lookup failure for %s" % url)
+ else:
+ logger.error("Got unexpected socket error %d for %s" % \
+ (serr.args[0], url), exc_info=1)
+ status = 1
+ raise SystemExit(status)