403Webshell
Server IP : 61.19.30.66  /  Your IP : 216.73.216.15
Web Server : Apache/2.2.22 (Ubuntu)
System : Linux klw 3.11.0-15-generic #25~precise1-Ubuntu SMP Thu Jan 30 17:39:31 UTC 2014 x86_64
User : www-data ( 33)
PHP Version : 5.3.10-1ubuntu3.48
Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,
MySQL : ON  |  cURL : OFF  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : OFF
Directory :  /usr/lib/python2.7/dist-packages/landscape/package/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /usr/lib/python2.7/dist-packages/landscape/package/store.pyc
ó
}9Rc@sdZddlZyddlZWn!ek
rEddlmZnXddlmZddlm	Z	de
fd„ƒYZde
fd	„ƒYZd
e
fd„ƒYZdefd
„ƒYZdefd„ƒYZde
fd„ƒYZde
fd„ƒYZd„Zd„Zd„ZdS(sEProvide access to the persistent data used by L{PackageTaskHandler}s.iÿÿÿÿN(tdbapi2(tbpickle(twith_cursortUnknownHashIDRequestcBseZdZRS(s$Raised for unknown hash id requests.(t__name__t
__module__t__doc__(((s;/usr/lib/python2.7/dist-packages/landscape/package/store.pyR
stInvalidHashIdDbcBseZdZRS(sARaised when trying to add an invalid hash=>id lookaside database.(RRR(((s;/usr/lib/python2.7/dist-packages/landscape/package/store.pyRstHashIdStorecBs€eZdZd	Zd„Zd„Zed„ƒZed„ƒZ	ed„ƒZ
ed„ƒZed„ƒZed„ƒZ
RS(
sC{HashIdStore} stores package hash=>id mappings in a file.

    The file is a SQLite database that contains a single table called "hash".
    The table schema is defined in L{ensure_hash_id_schema}.

    @param filename: The file where the mappings are persisted to.
    cCs
||_dS(N(t	_filename(tselftfilename((s;/usr/lib/python2.7/dist-packages/landscape/package/store.pyt__init__scCst|jƒdS(N(tensure_hash_id_schemat_db(R
((s;/usr/lib/python2.7/dist-packages/landscape/package/store.pyt_ensure_schema"scCs=x6|jƒD](\}}|jd|t|ƒfƒq
WdS(sbSet the ids of a set of hashes.

        @param hash_ids: a C{dict} of hash=>id mappings.
        sREPLACE INTO hash VALUES (?, ?)N(t	iteritemstexecutetbuffer(R
tcursorthash_idsthashtid((s;/usr/lib/python2.7/dist-packages/landscape/package/store.pytset_hash_ids%s	cCs7|jdt|ƒfƒ|jƒ}|r3|dSdS(sAReturn the id associated to C{hash}, or C{None} if not available.s SELECT id FROM hash WHERE hash=?iN(RRtfetchonetNone(R
RRtvalue((s;/usr/lib/python2.7/dist-packages/landscape/package/store.pytget_hash_id/s
cCsD|jdƒtg|jƒD] }t|dƒ|df^qƒS(s=Return a C{dict} holding all the available hash=>id mappings.sSELECT hash, id FROM hashii(Rtdicttfetchalltstr(R
Rtrow((s;/usr/lib/python2.7/dist-packages/landscape/package/store.pytget_hash_ids8s
cCsRt|ttfƒst‚|jd|fƒ|jƒ}|rNt|dƒSdS(sAReturn the hash associated to C{id}, or C{None} if not available.s SELECT hash FROM hash WHERE id=?iN(t
isinstancetinttlongtAssertionErrorRRRR(R
RRR((s;/usr/lib/python2.7/dist-packages/landscape/package/store.pytget_id_hash>scCs|jdƒdS(sDelete all hash=>id mappings.sDELETE FROM hashN(R(R
R((s;/usr/lib/python2.7/dist-packages/landscape/package/store.pytclear_hash_idsHscCs>y|jddƒWn#tjk
r9t|jƒ‚nXdS(sáCheck database integrity.

        @raise: L{InvalidHashIdDb} if the filenme passed to the constructor is
            not a SQLite database or does not have a table called "hash" with
            a compatible schema.
        s SELECT id FROM hash WHERE hash=?tN(R'(Rtsqlite3t
DatabaseErrorRR	(R
R((s;/usr/lib/python2.7/dist-packages/landscape/package/store.pytcheck_sanityMsN(RRRRRRRRRRR R%R&R*(((s;/usr/lib/python2.7/dist-packages/landscape/package/store.pyRs		
	
tPackageStorecBs eZdZd„Zd„Zd„Zd„Zd„Zd„Ze	d„ƒZ
e	d„ƒZe	d	„ƒZe	d
„ƒZ
e	d„ƒZe	d„ƒZe	d
„ƒZe	d„ƒZe	d„ƒZe	d„ƒZe	d„ƒZe	d„ƒZe	d„ƒZe	d„ƒZe	d„ƒZe	d„ƒZe	d„ƒZe	d„ƒZe	d„ƒZe	d„ƒZe	d„ƒZe	d„ƒZe	dd„ƒZ RS(s³Persist data about system packages and L{PackageTaskHandler}'s tasks.

    This class extends L{HashIdStore} by adding tables to the SQLite database
    backend for storing information about the status of the system packages and
    about the tasks to be performed by L{PackageTaskHandler}s.

    The additional tables and schemas are defined in L{ensure_package_schema}.

    @param filename: The file where data is persisted to.
    cCs#tt|ƒj|ƒg|_dS(N(tsuperR+Rt_hash_id_stores(R
R((s;/usr/lib/python2.7/dist-packages/landscape/package/store.pyRgscCs$tt|ƒjƒt|jƒdS(N(R,R+Rtensure_package_schemaR(R
((s;/usr/lib/python2.7/dist-packages/landscape/package/store.pyRkscCsJt|ƒ}y|jƒWntk
r5}|‚nX|jj|ƒdS(s 
        Attach an additional "lookaside" hash=>id database.

        This method can be called more than once to attach several
        hash=>id databases, which will be queried *before* the main
        database, in the same the order they were added.

        If C{filename} is not a SQLite database or does not have a
        table called "hash" with a compatible schema, L{InvalidHashIdDb}
        is raised.

        @param filename: a secondary SQLite databases to look for pre-canned
                         hash=>id mappings.
        N(RR*RR-tappend(R
Rt
hash_id_storete((s;/usr/lib/python2.7/dist-packages/landscape/package/store.pytadd_hash_id_dbos
cCst|jƒdkS(s?Return C{True} if one or more lookaside databases are attached.i(tlenR-(R
((s;/usr/lib/python2.7/dist-packages/landscape/package/store.pythas_hash_id_dbˆscCsRt|tƒst‚x*|jD]}|j|ƒ}|r|SqWtj||ƒS(s	Return the id associated to C{hash}, or C{None} if not available.

        This method composes the L{HashIdStore.get_hash_id} methods of all
        the attached lookaside databases, falling back to the main one, as
        described in L{add_hash_id_db}.
        (R!t
basestringR$R-RR(R
RtstoreR((s;/usr/lib/python2.7/dist-packages/landscape/package/store.pyRŒscCsCx0|jD]%}|j|ƒ}|dk	r
|Sq
Wtj||ƒS(s'Return the hash associated to C{id}, or C{None} if not available.

        This method composes the L{HashIdStore.get_id_hash} methods of all
        the attached lookaside databases, falling back to the main one in
        case the hash associated to C{id} is not found in any of them.
        N(R-R%RR(R
RR6R((s;/usr/lib/python2.7/dist-packages/landscape/package/store.pyR%žs
cCs(x!|D]}|jd|fƒqWdS(Ns!REPLACE INTO available VALUES (?)(R(R
RtidsR((s;/usr/lib/python2.7/dist-packages/landscape/package/store.pyt
add_available«s
cCs.djd„|Dƒƒ}|jd|ƒdS(Nt,css!|]}tt|ƒƒVqdS(N(RR"(t.0R((s;/usr/lib/python2.7/dist-packages/landscape/package/store.pys	<genexpr>²ss&DELETE FROM available WHERE id IN (%s)(tjoinR(R
RR7tid_list((s;/usr/lib/python2.7/dist-packages/landscape/package/store.pytremove_available°scCs|jdƒdS(NsDELETE FROM available(R(R
R((s;/usr/lib/python2.7/dist-packages/landscape/package/store.pytclear_availableµscCs.|jdƒg|jƒD]}|d^qS(NsSELECT id FROM availablei(RR(R
RR((s;/usr/lib/python2.7/dist-packages/landscape/package/store.pyt
get_available¹s
cCs(x!|D]}|jd|fƒqWdS(Ns)REPLACE INTO available_upgrade VALUES (?)(R(R
RR7R((s;/usr/lib/python2.7/dist-packages/landscape/package/store.pytadd_available_upgrades¾s
cCs.djd„|Dƒƒ}|jd|ƒdS(NR9css!|]}tt|ƒƒVqdS(N(RR"(R:R((s;/usr/lib/python2.7/dist-packages/landscape/package/store.pys	<genexpr>Åss.DELETE FROM available_upgrade WHERE id IN (%s)(R;R(R
RR7R<((s;/usr/lib/python2.7/dist-packages/landscape/package/store.pytremove_available_upgradesÃs	cCs|jdƒdS(NsDELETE FROM available_upgrade(R(R
R((s;/usr/lib/python2.7/dist-packages/landscape/package/store.pytclear_available_upgradesÉscCs.|jdƒg|jƒD]}|d^qS(Ns SELECT id FROM available_upgradei(RR(R
RR((s;/usr/lib/python2.7/dist-packages/landscape/package/store.pytget_available_upgradesÍs
cCs(x!|D]}|jd|fƒqWdS(Ns!REPLACE INTO installed VALUES (?)(R(R
RR7R((s;/usr/lib/python2.7/dist-packages/landscape/package/store.pyt
add_installedÒs
cCs.djd„|Dƒƒ}|jd|ƒdS(NR9css!|]}tt|ƒƒVqdS(N(RR"(R:R((s;/usr/lib/python2.7/dist-packages/landscape/package/store.pys	<genexpr>Ùss&DELETE FROM installed WHERE id IN (%s)(R;R(R
RR7R<((s;/usr/lib/python2.7/dist-packages/landscape/package/store.pytremove_installed×scCs|jdƒdS(NsDELETE FROM installed(R(R
R((s;/usr/lib/python2.7/dist-packages/landscape/package/store.pytclear_installedÜscCs.|jdƒg|jƒD]}|d^qS(NsSELECT id FROM installedi(RR(R
RR((s;/usr/lib/python2.7/dist-packages/landscape/package/store.pyt
get_installedàs
cCs.|jdƒg|jƒD]}|d^qS(s+Get the package ids of all locked packages.sSELECT id FROM lockedi(RR(R
RR((s;/usr/lib/python2.7/dist-packages/landscape/package/store.pyt
get_lockedås
cCs(x!|D]}|jd|fƒqWdS(s9Add the given package ids to the list of locked packages.sREPLACE INTO locked VALUES (?)N(R(R
RR7R((s;/usr/lib/python2.7/dist-packages/landscape/package/store.pyt
add_lockedës
cCs.djd„|Dƒƒ}|jd|ƒdS(NR9css!|]}tt|ƒƒVqdS(N(RR"(R:R((s;/usr/lib/python2.7/dist-packages/landscape/package/store.pys	<genexpr>óss#DELETE FROM locked WHERE id IN (%s)(R;R(R
RR7R<((s;/usr/lib/python2.7/dist-packages/landscape/package/store.pyt
remove_lockedñscCs|jdƒdS(s/Remove all the package ids in the locked table.sDELETE FROM lockedN(R(R
R((s;/usr/lib/python2.7/dist-packages/landscape/package/store.pytclear_lockedöscCsJt|ƒ}|jdttj|ƒƒtjƒfƒt|j|jƒS(Ns<INSERT INTO hash_id_request (hashes, timestamp) VALUES (?,?)(	tlistRRRtdumpsttimet
HashIDRequestRt	lastrowid(R
Rthashes((s;/usr/lib/python2.7/dist-packages/landscape/package/store.pytadd_hash_id_requestûs	"cCs>|jd|fƒ|jƒs.t|ƒ‚nt|j|ƒS(Ns(SELECT 1 FROM hash_id_request WHERE id=?(RRRROR(R
Rt
request_id((s;/usr/lib/python2.7/dist-packages/landscape/package/store.pytget_hash_id_requests
	
cCs:|jdƒg|jƒD]}t|j|dƒ^qS(NsSELECT id FROM hash_id_requesti(RRROR(R
RR((s;/usr/lib/python2.7/dist-packages/landscape/package/store.pytiter_hash_id_requestss
cCs|jdƒdS(NsDELETE FROM hash_id_request(R(R
R((s;/usr/lib/python2.7/dist-packages/landscape/package/store.pytclear_hash_id_requestsscCsGtj|ƒ}|jd|tjƒt|ƒfƒt|j|jƒS(Ns8INSERT INTO task (queue, timestamp, data) VALUES (?,?,?)(RRMRRNRtPackageTaskRRP(R
Rtqueuetdata((s;/usr/lib/python2.7/dist-packages/landscape/package/store.pytadd_tasks	cCs=|jd|fƒ|jƒ}|r9t|j|dƒSdS(Ns4SELECT id FROM task WHERE queue=? ORDER BY timestampi(RRRWRR(R
RRXR((s;/usr/lib/python2.7/dist-packages/landscape/package/store.pyt
get_next_tasks	
cCs:|jddjg|D]}t|jƒ^qƒƒdS(Ns%DELETE FROM task WHERE id NOT IN (%s)R9(RR;RR(R
Rtexcept_tasksttask((s;/usr/lib/python2.7/dist-packages/landscape/package/store.pytclear_tasks$s	((!RRRRRR2R4RR%RR8R=R>R?R@RARBRCRDRERFRGRHRIRJRKRRRTRURVRZR[R^(((s;/usr/lib/python2.7/dist-packages/landscape/package/store.pyR+[s>
						
	tFakePackageStorecBsSeZdZd„Zed„ƒZed„ƒZed„ƒZed„ƒZRS(sT
    A L{PackageStore} with an additional message table to store sent messages.
    cCs$tt|ƒjƒt|jƒdS(N(R,R_Rtensure_fake_package_schemaR(R
((s;/usr/lib/python2.7/dist-packages/landscape/package/store.pyR/scCs&|jdttj|ƒƒfƒdS(Ns%INSERT INTO message (data) VALUES (?)(RRRRM(R
Rtmessage((s;/usr/lib/python2.7/dist-packages/landscape/package/store.pytsave_message3s	cCs*g|jdƒjƒD]}|d^qS(NsSELECT id FROM messagei(RR(R
RR((s;/usr/lib/python2.7/dist-packages/landscape/package/store.pytget_message_ids8scCs*|jdg|D]}|f^qƒdS(Ns#INSERT INTO message (id) VALUES (?)(texecutemany(R
Rtmessage_idst
message_id((s;/usr/lib/python2.7/dist-packages/landscape/package/store.pytsave_message_ids=scCscdjdgt|ƒƒ}|jd|t|ƒƒjƒ}g|D]}|d|df^qES(Ns, t?s9SELECT id, data FROM message WHERE id IN (%s) ORDER BY idii(R;R3RttupleR(R
RRetparamstresultR((s;/usr/lib/python2.7/dist-packages/landscape/package/store.pytget_messages_by_idsCs
(	RRRRRRbRcRgRl(((s;/usr/lib/python2.7/dist-packages/landscape/package/store.pyR_*s	ROcBseZd„Zeed„ƒƒZed„ƒZed„ƒZeeeƒZed„ƒZ	ed„ƒZ
ee	e
ƒZed„ƒZRS(cCs||_||_dS(N(RR(R
tdbR((s;/usr/lib/python2.7/dist-packages/landscape/package/store.pyRNs	cCs3|jd|jfƒtjt|jƒdƒƒS(Ns-SELECT hashes FROM hash_id_request WHERE id=?i(RRRtloadsRR(R
R((s;/usr/lib/python2.7/dist-packages/landscape/package/store.pyRQRs	
cCs$|jd|jfƒ|jƒdS(Ns0SELECT timestamp FROM hash_id_request WHERE id=?i(RRR(R
R((s;/usr/lib/python2.7/dist-packages/landscape/package/store.pyt_get_timestampYs	
cCs|jd||jfƒdS(Ns1UPDATE hash_id_request SET timestamp=? WHERE id=?(RR(R
RR((s;/usr/lib/python2.7/dist-packages/landscape/package/store.pyt_set_timestamp_s	cCs$|jd|jfƒ|jƒdS(Ns1SELECT message_id FROM hash_id_request WHERE id=?i(RRR(R
R((s;/usr/lib/python2.7/dist-packages/landscape/package/store.pyt_get_message_idfs	
cCs|jd||jfƒdS(Ns2UPDATE hash_id_request SET message_id=? WHERE id=?(RR(R
RR((s;/usr/lib/python2.7/dist-packages/landscape/package/store.pyt_set_message_idls	cCs|jd|jfƒdS(Ns&DELETE FROM hash_id_request WHERE id=?(RR(R
R((s;/usr/lib/python2.7/dist-packages/landscape/package/store.pytremovess(
RRRtpropertyRRQRoRpt	timestampRqRrRfRs(((s;/usr/lib/python2.7/dist-packages/landscape/package/store.pyROLs	RWcBs eZd„Zed„ƒZRS(cCs‰||_||_|jƒ}z#|jd|fƒ|jƒ}Wd|jƒX|d|_|d|_tj	t
|dƒƒ|_dS(Ns2SELECT queue, timestamp, data FROM task WHERE id=?iii(RRRRRtcloseRXRuRRnRRY(R
RmRRR((s;/usr/lib/python2.7/dist-packages/landscape/package/store.pyRzs			


cCs|jd|jfƒdS(NsDELETE FROM task WHERE id=?(RR(R
R((s;/usr/lib/python2.7/dist-packages/landscape/package/store.pyRsŠs(RRRRRs(((s;/usr/lib/python2.7/dist-packages/landscape/package/store.pyRWxs	cCsi|jƒ}y|jdƒWn1tjtjfk
rP|jƒ|jƒnX|jƒ|jƒdS(seCreate all tables needed by a L{HashIdStore}.

    @param db: A connection to a SQLite database.
    s<CREATE TABLE hash (id INTEGER PRIMARY KEY, hash BLOB UNIQUE)N(RRR(tOperationalErrorR)Rvtrollbacktcommit(RmR((s;/usr/lib/python2.7/dist-packages/landscape/package/store.pyR
s

cCs¡|jƒ}yR|jdƒ|jdƒ|jdƒ|jdƒ|jdƒ|jdƒWn(tjk
rˆ|jƒ|jƒnX|jƒ|jƒdS(sfCreate all tables needed by a L{PackageStore}.

    @param db: A connection to a SQLite database.
    s,CREATE TABLE locked (id INTEGER PRIMARY KEY)s/CREATE TABLE available (id INTEGER PRIMARY KEY)s7CREATE TABLE available_upgrade (id INTEGER PRIMARY KEY)s/CREATE TABLE installed (id INTEGER PRIMARY KEY)skCREATE TABLE hash_id_request (id INTEGER PRIMARY KEY, timestamp TIMESTAMP, message_id INTEGER, hashes BLOB)sVCREATE TABLE task (id INTEGER PRIMARY KEY, queue TEXT, timestamp TIMESTAMP, data BLOB)N(RRR(RwRvRxRy(RmR((s;/usr/lib/python2.7/dist-packages/landscape/package/store.pyR. s	






cCsi|jƒ}y|jdƒWn1tjtjfk
rP|jƒ|jƒnX|jƒ|jƒdS(Ns8CREATE TABLE message (id INTEGER PRIMARY KEY, data BLOB)(RRR(RwR)RvRxRy(RmR((s;/usr/lib/python2.7/dist-packages/landscape/package/store.pyR`Ás

(RRNR(tImportErrort	pysqlite2Rt
landscape.libRtlandscape.lib.storeRt	ExceptionRRtobjectRR+R_RORWR
R.R`(((s;/usr/lib/python2.7/dist-packages/landscape/package/store.pyt<module>s"
FÏ",		!

Youez - 2016 - github.com/yon3zu
LinuXploit