| 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/user/ |
Upload File : |
ó
}9Rc @ s* d d l m Z d e f d „ ƒ YZ d S( iÿÿÿÿ( t difft UserChangesc B sV e Z d Z d „ Z d „ Z d „ Z d „ Z d „ Z d „ Z d „ Z d „ Z
RS( s Detect changes made since the last snapshot was taken.
If no snapshot is available all users and groups are reported.
When a snapshot is available, only the changes between the current
state and the snapshotted state are transmitted to the server.
c C s3 t t | ƒ j ƒ | | _ | | _ | j ƒ d S( N( t superR t __init__t _persistt _providert _refresh( t selft persistt provider( ( s: /usr/lib/python2.7/dist-packages/landscape/user/changes.pyR s c C sp | j j d i ƒ | _ | j j d i ƒ | _ | j d | j j ƒ ƒ | _ | j d | j j ƒ ƒ | _ d S( s3 Load the previous snapshot and update current data.t userst groupst usernamet nameN(
R t gett
_old_userst _old_groupst
_create_indexR t get_userst
_new_userst
get_groupst _new_groups( R ( ( s: /usr/lib/python2.7/dist-packages/landscape/user/changes.pyR s c C s0 | j j d | j ƒ | j j d | j ƒ d S( s; Save the current state and use it as a comparison snapshot.R
R N( R t setR R ( R ( ( s: /usr/lib/python2.7/dist-packages/landscape/user/changes.pyt snapshot s c C s$ | j j d ƒ | j j d ƒ d S( s`
Reset the snapshot state and forget all knowledge of users and
groups.
R
R N( R t remove( R ( ( s: /usr/lib/python2.7/dist-packages/landscape/user/changes.pyt clear% s c C s) i } x | D] } | | | | <q
W| S( ss
Given a key and a sequence of dicts, return a dict of the form
C{{dict[key]: dict, ...}}.
( ( R t keyt sequencet indext data( ( s: /usr/lib/python2.7/dist-packages/landscape/user/changes.pyR - s
c C s: | j ƒ i } | j | j ƒ ƒ | j | j ƒ ƒ | S( s¶ Returns the changes since the last snapshot.
See landscape.message_schemas.USERS schema for a description of the
dictionary returned by this method.
( R t updatet _detect_user_changest _detect_group_changes( R t changes( ( s: /usr/lib/python2.7/dist-packages/landscape/user/changes.pyt create_diff7 s
c C s… i } t | j | j ƒ \ } } } | rC t | j ƒ ƒ | d <n | rb t | j ƒ ƒ | d <n | r t | j ƒ ƒ | d <n | S( så
Compare the current user snapshot to the old one and return a
C{dict} with C{create-users}, C{update-users} and
C{delete-users} fields. Fields without data aren't included
in the result.
s create-userss update-userss delete-users( R R R t listt
itervaluest iterkeys( R R! t createst updatest deletes( ( s: /usr/lib/python2.7/dist-packages/landscape/user/changes.pyR C s c C s" i } t | j | j ƒ \ } } } | r¬ g } i } xS | j ƒ D]E } | j ƒ } | j d ƒ } | r{ | | | d <n | j | ƒ qC W| | d <| r¬ | | d <q¬ n | ri } i } g }
xà | j ƒ D]µ \ } } | j | }
t |
d ƒ } t | d ƒ } | | } | r-t | ƒ | | <n | | } | rPt | ƒ | | <n |
d | d k rÑ |
j i | d 6| d d 6ƒ qÑ qÑ W| r²| j
d i ƒ } | j | ƒ n | rÚ| j
d i ƒ } | j | ƒ n |
r| j
d g ƒ } | j |
ƒ qn | r| j
ƒ | d <n | S( s
Compare the current group snapshot to the old one and create a
C{dict} with C{create-groups}, C{delete-groups},
C{create-group-members} and {delete-group-members} fields.
Fields without data aren't included in the result.
t membersR
s
create-groupss create-group-memberst gids delete-group-memberss
update-groupss
delete-groups( R R R R$ t copyt popt appendt iteritemsR t sortedt
setdefaultR t extendt keys( R R! R&