def __init__(self, url, bind_username=None, bind_password=None, max_age=200): assert isinstance(url, basestring) assert bind_username == None or isinstance(bind_username, basestring) assert bind_password == None or isinstance(bind_password, basestring) assert max_age > 0 url_parsed = urlparse.urlparse(url) if url_parsed.scheme != "ldap" or url_parsed.netloc == "": raise ValueError("%s: malformed LDAP URL?" % url) self.url = commonl.url_remove_user_pwd(url_parsed) if bind_username == None: self.bind_username = url_parsed.username else: self.bind_username = bind_username if bind_password == None: self.bind_password = url_parsed.password else: self.bind_password = bind_password self.bind_password = commonl.password_get(self.url, self.bind_username, self.bind_password) # dictionary of [ field_lookup, field_report ] = { # VALUE: ( TIMESTAMP, REPORTED_FIELD ), # } self._cache = collections.defaultdict(dict) self.conn = None #: maximum number of seconds an entry will live in the cache #: before it is considered old and refetched from the servers. self.max_age = max_age
def __init__(self, url, outlet_number, https_verify = True, password = None, **kwargs): assert isinstance(url, str) assert isinstance(outlet_number, int) and outlet_number > 0 assert password == None or isinstance(password, str) ttbl.power.impl_c.__init__(self, **kwargs) self.capture_program = commonl.ttbd_locate_helper( "raritan-power-capture.py", ttbl._install.share_path, log = logging, relsrcpath = ".") ttbl.capture.impl_c.__init__( self, False, "application/json", log = "text/plain") self.url = urllib.parse.urlparse(url) if password: self.password = commonl.password_get( self.url.netloc, self.url.username, password) else: self.password = None # note the indexes for the SW are 0-based, while in the labels # in the HW for humans, they are 1 based. self.outlet_number = outlet_number - 1 self.https_verify = https_verify self._outlet_rpc = None url_no_password = "******" % (self.url.scheme, self.url.hostname) self.upid_set("Raritan PDU %s #%d" % (url_no_password, outlet_number), url = url_no_password, outlet = outlet_number)
def __init__(self, hostname, database, password=None, port=3307, ssl=True, table_name_prefix="", mariadb_extra_opts=None): assert isinstance(hostname, str) assert isinstance(database, str) assert password == None or isinstance(password, str) assert isinstance(port, int) assert isinstance(ssl, bool) assert isinstance(table_name_prefix, str) if mariadb_extra_opts: commonl.assert_dict_key_strings(mariadb_extra_opts, "mariadb_extra_opts") self.mariadb_extra_opts = mariadb_extra_opts else: self.mariadb_extra_opts = {} self.user, self.password, self.host = \ commonl.split_user_pwd_hostname(hostname) if password: self.password = commonl.password_get(self.host, self.user, password) self.port = port self.database = database self.ssl = ssl self.table_name_prefix_raw = table_name_prefix self.table_name_prefix = self._sql_id_esc(table_name_prefix) self.docs = {} tcfl.tc.report_driver_c.__init__(self)
def __init__(self, url, outlet_number, https_verify=True, password=None, **kwargs): assert isinstance(url, basestring) assert isinstance(outlet_number, int) and outlet_number > 0 assert password == None or isinstance(password, basestring) ttbl.power.impl_c.__init__(self, **kwargs) self.url = urlparse.urlparse(url) if password: self.password = commonl.password_get(self.url.netloc, self.url.username, password) else: self.password = None # note the indexes for the SW are 0-based, while in the labels # in the HW for humans, they are 1 based. self.outlet_number = outlet_number - 1 self.https_verify = https_verify self._outlet_rpc = None url_no_password = "******" % (self.url.scheme, self.url.hostname) self.upid_set("Raritan PDU %s #%d" % (url_no_password, outlet_number), url=url_no_password, outlet=outlet_number)
def __init__(self, bmc_url, verify=True, **kwargs): assert isinstance(bmc_url, basestring) assert isinstance(verify, bool) ttbl.power.impl_c.__init__(self, paranoid=True, **kwargs) self.power_on_recovery = False self.paranoid_get_samples = 0 url = urlparse.urlparse(bmc_url) self.username = url.username self.password = commonl.password_get(url.hostname, self.username, url.password) self.url = commonl.url_remove_user_pwd(url) self.verify = verify