Changeset 502

Show
Ignore:
Timestamp:
05/28/08 13:42:34 (8 months ago)
Author:
jmowery
Message:

adding code for fetching updated local modules from the agents (error path to come shortly)

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/trunk-pmd-intproto/agent/agent.py

    r498 r502  
    128128                if not len(modified_modules): 
    129129                        return None 
     130                message_body = [(x, self.storage.get_current(x)) for x in modified_modules] 
    130131                self.storage.apply_local_files() 
    131132                self.storage.update() 
    132                 return protocol.Message('modules','update',modified_modules
     133                return protocol.Message('modules', 'update', message_body
    133134 
    134135################################################################# 
  • branches/trunk-pmd-intproto/server/master.py

    r501 r502  
    168168        def modules(self, (val, clientid)): 
    169169                n = storage.Node(clientid, storage_root) 
    170                 #TODO: set file status for each file in the node here 
     170                local_layer = get_layer_by_group(storage_root, n.classification) 
     171                #val is list of pairs (file_name, path on client system) 
     172                for (file_name, file_path) in val: 
     173                        if local_layer.is_locked(file_name): 
     174                #if locked on server (this) side send back current (server) version and deny the update 
     175                                pass 
     176                        else: 
     177                                cmd = ['/usr/bin/scp', clientid + ':' + file_path, os.path.join(local_layer.storage.path, file_name)] 
     178                                proc = subprocess.Popen(cmd) 
     179                                proc.wait() 
     180                                local_layer.add(file_name, int(storage.get_timestamp(file_path))) 
     181                        n.set_file_status(file_name, local_layer.storage.path, local_layer.get_entry(file_name).applied, False) 
     182                local_layer.update() 
    171183                n.update() 
    172184