From: fredrik Date: Wed, 22 Nov 2006 15:21:27 +0000 (+0000) Subject: Connect to $DCSERVER if none given in cnl. X-Git-Tag: 0.3~175 X-Git-Url: http://git.dolda2000.com/gitweb/?a=commitdiff_plain;h=c5de778c48b3e88bf710e58bf575ab719ab2b21b;p=doldaconnect.git Connect to $DCSERVER if none given in cnl. git-svn-id: svn+ssh://svn.dolda2000.com/srv/svn/repos/src/doldaconnect@748 959494ce-11ee-0310-bf91-de5d638817bd --- diff --git a/lib/python/dolcon/__init__.py b/lib/python/dolcon/__init__.py index e7adb29..b969028 100644 --- a/lib/python/dolcon/__init__.py +++ b/lib/python/dolcon/__init__.py @@ -1,4 +1,5 @@ from dolmod import * +import os def login(useauthless = True, **kw): result = [None] @@ -19,7 +20,11 @@ def mustconnect(host, port = -1): if resp.getcode() != 200: raise RuntimeError, resp.intresp()[0][0] -def cnl(host, port = -1, useauthless = True, **kw): +def cnl(host = None, port = -1, useauthless = True, **kw): + if host is None: + host = os.getenv("DCSERVER") + if host is None: + raise ValueError, "No DC host to connect to" mustconnect(host, port) err, reason = login(useauthless, **kw) if err != "success":