Changeset 502
- 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
| r498 |
r502 |
|
| 128 | 128 | if not len(modified_modules): |
|---|
| 129 | 129 | return None |
|---|
| | 130 | message_body = [(x, self.storage.get_current(x)) for x in modified_modules] |
|---|
| 130 | 131 | self.storage.apply_local_files() |
|---|
| 131 | 132 | self.storage.update() |
|---|
| 132 | | return protocol.Message('modules','update',modified_modules) |
|---|
| | 133 | return protocol.Message('modules', 'update', message_body) |
|---|
| 133 | 134 | |
|---|
| 134 | 135 | ################################################################# |
|---|
| r501 |
r502 |
|
| 168 | 168 | def modules(self, (val, clientid)): |
|---|
| 169 | 169 | 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() |
|---|
| 171 | 183 | n.update() |
|---|
| 172 | 184 | |
|---|
Download in other formats:
* Generating other formats may take time.