/
usr
/
lib
/
python3
/
dist-packages
/
landscape
/
lib
/
/usr/lib/python3/dist-packages/landscape/lib
mkdir
upload
Name
Size
Mode
Actions
apt/
-
0755
rm
__pycache__/
-
0755
rm
amp.py
21745
0644
edit
dl
rm
backoff.py
1683
0644
edit
dl
rm
base64.py
196
0644
edit
dl
rm
bootstrap.py
1416
0644
edit
dl
rm
bpickle.py
6471
0644
edit
dl
rm
cli.py
440
0644
edit
dl
rm
cloud.py
1715
0644
edit
dl
rm
compat.py
616
0644
edit
dl
rm
config.py
12484
0644
edit
dl
rm
disk.py
5027
0644
edit
dl
rm
encoding.py
545
0644
edit
dl
rm
fd.py
751
0644
edit
dl
rm
fetch.py
6647
0644
edit
dl
rm
format.py
959
0644
edit
dl
rm
fs.py
3889
0644
edit
dl
rm
gpg.py
1796
0644
edit
dl
rm
hashlib.py
264
0644
edit
dl
rm
jiffies.py
1621
0644
edit
dl
rm
juju.py
860
0644
edit
dl
rm
lock.py
705
0644
edit
dl
rm
log.py
484
0644
edit
dl
rm
logging.py
2528
0644
edit
dl
rm
message.py
2638
0644
edit
dl
rm
monitor.py
6281
0644
edit
dl
rm
network.py
9821
0644
edit
dl
rm
os_release.py
1324
0644
edit
dl
rm
persist.py
20995
0644
edit
dl
rm
plugin.py
1787
0644
edit
dl
rm
process.py
6603
0644
edit
dl
rm
reactor.py
8812
0644
edit
dl
rm
schema.py
6457
0644
edit
dl
rm
scriptcontent.py
522
0644
edit
dl
rm
sequenceranges.py
5724
0644
edit
dl
rm
store.py
1408
0644
edit
dl
rm
sysstats.py
7920
0644
edit
dl
rm
tag.py
506
0644
edit
dl
rm
testing.py
24662
0644
edit
dl
rm
timestamp.py
233
0644
edit
dl
rm
twisted_util.py
4476
0644
edit
dl
rm
user.py
1476
0644
edit
dl
rm
versioning.py
1265
0644
edit
dl
rm
vm_info.py
3172
0644
edit
dl
rm
warning.py
394
0644
edit
dl
rm
__init__.py
198
0644
edit
dl
rm
Edit:
/usr/lib/python3/dist-packages/landscape/lib/store.py
(1408B)
"""Functions used by all sqlite-backed stores.""" try: import sqlite3 except ImportError: from pysqlite2 import dbapi2 as sqlite3 def with_cursor(method): """Decorator that encloses the method in a database transaction. Even though SQLite is supposed to be useful in autocommit mode, we've found cases where the database continued to be locked for writing until the cursor was closed. With this in mind, instead of using the autocommit mode, we explicitly terminate transactions and enforce cursor closing with this decorator. """ def inner(self, *args, **kwargs): if not self._db: # Create the database connection only when we start to actually # use it. This is essentially just a workaroud of a sqlite bug # happening when 2 concurrent processes try to create the tables # around the same time, the one which fails having an incorrect # cache and not seeing the tables self._db = sqlite3.connect(self._filename) self._ensure_schema() try: cursor = self._db.cursor() try: result = method(self, cursor, *args, **kwargs) finally: cursor.close() self._db.commit() except BaseException: self._db.rollback() raise return result return inner
Save
cmd:
run