Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def connect(self):
# for catbells
if (checkValue('password',self.settings)):
if (checkValue('hostname',self.settings) and checkValue('port',self.settings)):
# remote with password
self.log.debug("REMOTE WITH PASSWORD")
self.conn = psycopg2.connect(database=self.settings['databasename'],
user=self.settings['user'], host=self.settings['hostname'],
port=self.settings['port'], password=self.settings['password'])
else:
# local with password
self.log.debug("LOCAL WITH PASSWORD")
self.conn = psycopg2.connect(database=self.settings['databasename'],
user=self.settings['user'], password=self.settings['password'])
else:
if (checkValue('hostname',self.settings) and checkValue('port',self.settings)):
# remote without password
self.log.debug("REMOTE WITHOUT PASSWORD")
self.conn = psycopg2.connect(database=self.settings['databasename'],user=self.settings['user'], host=self.settings['hostname'],port=self.settings['port'])
else:
if not retval :
command = "sbuild -n --apt-update -d %s %s/%s_%s.dsc" % (chroot_name, srcdir,
buildreq.get_package(), buildreq.get_version())
ret = pybitclient.run_cmd (command, self.settings["dry_run"], logfile)
if (ret == 3 or ret == 768):
retval = "build-dep-wait"
elif (ret):
retval = "build_binary"
if not retval :
changes = "%s/%s_%s_%s.changes" % (self.settings["buildroot"],
buildreq.get_package(), buildreq.get_version(),
buildreq.get_arch())
if not self.settings["dry_run"] and not os.path.isfile (changes) :
logging.warn ("E: build_slave: Failed to find %s file." % (changes))
retval = "build_changes"
if not retval and checkValue ('debsignkey', self.settings) :
command = "debsign -k%s %s" % (self.settings['debsignkey'], changes)
if pybitclient.run_cmd (command, self.settings["dry_run"], logfile):
retval = "build_sign"
else:
retval = "Can't find build dir."
#If we have a message set we send back the message and failure
return self._overall_success(retval, conn_data)
def connect(self):
# for catbells
if (checkValue('password',self.settings)):
if (checkValue('hostname',self.settings) and checkValue('port',self.settings)):
# remote with password
self.log.debug("REMOTE WITH PASSWORD")
self.conn = psycopg2.connect(database=self.settings['databasename'],
user=self.settings['user'], host=self.settings['hostname'],
port=self.settings['port'], password=self.settings['password'])
else:
# local with password
self.log.debug("LOCAL WITH PASSWORD")
self.conn = psycopg2.connect(database=self.settings['databasename'],
user=self.settings['user'], password=self.settings['password'])
else:
if (checkValue('hostname',self.settings) and checkValue('port',self.settings)):
# remote without password
self.log.debug("REMOTE WITHOUT PASSWORD")
self.conn = psycopg2.connect(database=self.settings['databasename'],user=self.settings['user'], host=self.settings['hostname'],port=self.settings['port'])
retval = "build_dsc"
if not retval :
command = "sbuild -A -n -s -d %s %s/%s_%s.dsc" % (chroot_name,
srcdir, buildreq.get_package(), buildreq.get_version())
ret = pybitclient.run_cmd (command, self.settings["dry_run"], logfile)
if (ret == 3 or ret == 1):
retval = "build-dep-wait"
elif (ret):
retval = "build_binary"
if not retval :
changes = "%s/%s_%s_%s.changes" % (self.settings["buildroot"], buildreq.get_package(),
buildreq.get_version(), buildreq.get_arch())
if not self.settings["dry_run"] and not os.path.isfile (changes) :
logging.warn("E: build_master: Failed to find %s file." % (changes))
retval = "build_changes"
if not retval and checkValue ('debsignkey', self.settings) :
command = "debsign -k%s %s" % (self.settings['debsignkey'], changes)
if pybitclient.run_cmd (command, self.settings["dry_run"], logfile):
retval = "build_sign"
return self._overall_success(retval, conn_data)
def connect(self):
# for catbells
if (checkValue('password',self.settings)):
if (checkValue('hostname',self.settings) and checkValue('port',self.settings)):
# remote with password
self.log.debug("REMOTE WITH PASSWORD")
self.conn = psycopg2.connect(database=self.settings['databasename'],
user=self.settings['user'], host=self.settings['hostname'],
port=self.settings['port'], password=self.settings['password'])
else:
# local with password
self.log.debug("LOCAL WITH PASSWORD")
self.conn = psycopg2.connect(database=self.settings['databasename'],
user=self.settings['user'], password=self.settings['password'])
else:
if (checkValue('hostname',self.settings) and checkValue('port',self.settings)):
# remote without password
self.log.debug("REMOTE WITHOUT PASSWORD")
self.conn = psycopg2.connect(database=self.settings['databasename'],user=self.settings['user'], host=self.settings['hostname'],port=self.settings['port'])
else:
# local without password
self.log.debug("LOCAL WITHOUT PASSWORD")
self.conn = psycopg2.connect(database=self.settings['databasename'],
user=self.settings['user'])