Changeset View
Changeset View
Standalone View
Standalone View
pykolab/telemetry.py
Show First 20 Lines • Show All 417 Lines • ▼ Show 20 Lines | class TelemetryServer(object): | ||||
sessions = relationship( | sessions = relationship( | ||||
'TelemetrySession', | 'TelemetrySession', | ||||
order_by='telemetry_session.timestamp', | order_by='telemetry_session.timestamp', | ||||
backref='server' | backref='server' | ||||
) | ) | ||||
#files = relationship( | #files = relationship( | ||||
#'TelemetryFiles', | #'TelemetryFiles', | ||||
Lint: PEP8 E116: unexpected indentation (comment) | |||||
#order_by='telemetry_file.filepath', | #order_by='telemetry_file.filepath', | ||||
Lint: PEP8 E116 unexpected indentation (comment) Lint: PEP8 E116: unexpected indentation (comment) | |||||
#backref=server | #backref=server | ||||
Lint: PEP8 E116 unexpected indentation (comment) Lint: PEP8 E116: unexpected indentation (comment) | |||||
#) | #) | ||||
Lint: PEP8 E116 unexpected indentation (comment) Lint: PEP8 E116: unexpected indentation (comment) | |||||
def __init__(self, fqdn): | def __init__(self, fqdn): | ||||
self.fqdn = fqdn | self.fqdn = fqdn | ||||
class TelemetryServerResponse(object): | class TelemetryServerResponse(object): | ||||
def __init__(self, command_issue, response): | def __init__(self, command_issue, response): | ||||
self.command_issue_id = command_issue.id | self.command_issue_id = command_issue.id | ||||
self.response = response | self.response = response | ||||
▲ Show 20 Lines • Show All 199 Lines • ▼ Show 20 Lines | if conf.has_section('kolab_telemetry'): | ||||
db_uri = conf.get('kolab_telemetry', 'uri') | db_uri = conf.get('kolab_telemetry', 'uri') | ||||
if not db_uri == None: | if not db_uri == None: | ||||
echo = conf.debuglevel > 8 | echo = conf.debuglevel > 8 | ||||
engine = create_engine(db_uri, echo=echo) | engine = create_engine(db_uri, echo=echo) | ||||
try: | try: | ||||
metadata.create_all(engine) | metadata.create_all(engine) | ||||
except sqlalchemy.exc.OperationalError, e: | except sqlalchemy.exc.OperationalError as e: | ||||
log.error(_("Operational Error in telemetry database: %s" % (e))) | log.error(_("Operational Error in telemetry database: %s" % (e))) | ||||
Session = sessionmaker(bind=engine) | Session = sessionmaker(bind=engine) | ||||
db = Session() | db = Session() | ||||
if db == None: | if db == None: | ||||
log.error(_("No database available")) | log.error(_("No database available")) | ||||
return db | return db |
unexpected indentation (comment)