~ubuntu-branches/ubuntu/jaunty/landscape-client/jaunty-proposed

« back to all changes in this revision

Viewing changes to landscape/message_schemas.py

  • Committer: Bazaar Package Importer
  • Author(s): Free Ekanayaka
  • Date: 2010-06-28 18:07:18 UTC
  • mfrom: (1.2.5 upstream)
  • Revision ID: james.westby@ubuntu.com-20100628180718-m3t2ttgg8efbg19d
Tags: 1.5.2.1-0ubuntu0.9.04.0
Filter duplicate network interfaces in get_active_interfaces (LP: #597000)

Show diffs side-by-side

added added

removed removed

Lines of Context:
29
29
    {"kill-processes": List(Int()),
30
30
     "kill-all-processes": Bool(),
31
31
     "add-processes": List(process_info),
32
 
     "update-processes": List(process_info)
33
 
     },
 
32
     "update-processes": List(process_info)},
34
33
    # XXX Really we don't want all three of these keys to be optional:
35
34
    # we always want _something_...
36
35
    optional=["add-processes", "update-processes", "kill-processes",
97
96
                        Tuple(Constant("delete"),
98
97
                              Unicode()),
99
98
                        ),
100
 
                    )
101
 
    })
 
99
                    )})
102
100
 
103
101
 
104
102
LOAD_AVERAGE = Message("load-average", {
118
116
    optional=["operation-id"])
119
117
 
120
118
MOUNT_ACTIVITY = Message("mount-activity", {
121
 
    "activities": List(Tuple(Float(), utf8, Bool()))
122
 
    })
 
119
    "activities": List(Tuple(Float(), utf8, Bool()))})
 
120
 
123
121
 
124
122
MOUNT_INFO = Message("mount-info", {
125
123
    "mount-info": List(Tuple(Float(),
131
129
    })
132
130
 
133
131
FREE_SPACE = Message("free-space", {
134
 
    "free-space": List(Tuple(Float(), utf8, Int()))
135
 
    })
 
132
    "free-space": List(Tuple(Float(), utf8, Int()))})
136
133
 
137
134
 
138
135
REGISTER = Message(
148
145
REGISTER_CLOUD_VM = Message(
149
146
    "register-cloud-vm",
150
147
    {"hostname": utf8,
151
 
     "otp":  Any(String(), Constant(None)),
 
148
     "otp": Any(String(), Constant(None)),
152
149
     "instance_key": Unicode(),
153
150
     "account_name": Any(utf8, Constant(None)),
154
151
     "registration_password": Any(utf8, Constant(None)),
156
153
     "public_hostname": Unicode(),
157
154
     "local_hostname": Unicode(),
158
155
     "kernel_key": Unicode(),
159
 
     "ramdisk_key": Unicode(),
 
156
     "ramdisk_key": Any(Unicode(), Constant(None)),
160
157
     "launch_index": Int(),
161
158
     "image_key": Unicode(),
162
159
     "tags": Any(utf8, Constant(None))},
187
184
    "work-phone": Any(utf8, Constant(None)),
188
185
    "primary-gid": Any(Int(), Constant(None)),
189
186
    "primary-groupname": utf8},
190
 
    optional=["primary-groupname", "primary-gid"]
191
 
    )
 
187
    optional=["primary-groupname", "primary-gid"])
192
188
 
193
189
group_data = KeyDict({
194
190
    "gid": Int(),
195
 
    "name": utf8
196
 
    })
 
191
    "name": utf8})
197
192
 
198
193
USERS = Message(
199
194
    "users",
262
257
                           optional=["location", "home-phone", "work-phone"])),
263
258
     "groups": List(KeyDict({"gid": Int(),
264
259
                             "name": utf8,
265
 
                             "members": List(utf8)}))
266
 
     },
 
260
                             "members": List(utf8)}))},
267
261
    optional=["groups"])
268
262
 
269
263
package_ids_or_ranges = List(Any(Tuple(Int(), Int()), Int()))
308
302
                              "section": Unicode(),
309
303
                              "relations": List(Tuple(Int(), utf8)),
310
304
                              "summary": Unicode(),
311
 
                              "installed-size":  Any(Int(), Constant(None)),
312
 
                              "size":  Any(Int(), Constant(None)),
 
305
                              "installed-size": Any(Int(), Constant(None)),
 
306
                              "size": Any(Int(), Constant(None)),
313
307
                              "version": utf8,
314
308
                              "type": Int(),
315
309
                              })),
317
311
    })
318
312
 
319
313
TEXT_MESSAGE = Message("text-message", {
320
 
    "message": Unicode()
321
 
    })
 
314
    "message": Unicode()})
322
315
 
323
316
TEST = Message(
324
317
    "test",
336
329
CUSTOM_GRAPH = Message("custom-graph", {
337
330
    "data": Dict(Int(), GRAPH_DATA)})
338
331
 
 
332
# XXX This is kept for backward compatibility, it can eventually be removed
 
333
# when all clients will support REBOOT_REQUIRED_INFO
339
334
REBOOT_REQUIRED = Message(
340
335
    "reboot-required",
341
336
    {"flag": Bool()})
342
337
 
 
338
REBOOT_REQUIRED_INFO = Message(
 
339
    "reboot-required-info",
 
340
    {"flag": Bool(),
 
341
     "packages": List(Unicode())},
 
342
    optional=["flag", "packages"])
 
343
 
343
344
APT_PREFERENCES = Message(
344
345
    "apt-preferences",
345
346
    {"data": Any(Dict(Unicode(), Unicode()), Constant(None))})
356
357
    "eucalyptus-info-error",
357
358
    {"error": String()})
358
359
 
 
360
NETWORK_DEVICE = Message(
 
361
    "network-device",
 
362
    {"devices": List(KeyDict({"interface": String(),
 
363
                              "ip_address": String(),
 
364
                              "mac_address": String(),
 
365
                              "broadcast_address": String(),
 
366
                              "netmask": String(),
 
367
                              "flags": Int()}))})
 
368
 
 
369
NETWORK_ACTIVITY = Message(
 
370
    "network-activity",
 
371
    # Dict maps interfaces to their network activity. The network activity of
 
372
    # an interface a is a list of 3-tuples (step, in, out), where 'step' is the
 
373
    # time interval and 'in'/'out' are number of bytes received/sent over the
 
374
    # interval.
 
375
    {"activities": Dict(String(), List(Tuple(Int(), Int(), Int())))})
 
376
 
359
377
 
360
378
message_schemas = {}
361
379
for schema in [ACTIVE_PROCESS_INFO, COMPUTER_UPTIME, CLIENT_UPTIME,
367
385
               CHANGE_PACKAGES_RESULT, UNKNOWN_PACKAGE_HASHES,
368
386
               ADD_PACKAGES, TEXT_MESSAGE, TEST, CUSTOM_GRAPH,
369
387
               REBOOT_REQUIRED, APT_PREFERENCES, EUCALYPTUS_INFO,
370
 
               EUCALYPTUS_INFO_ERROR]:
 
388
               EUCALYPTUS_INFO_ERROR, NETWORK_DEVICE, NETWORK_ACTIVITY,
 
389
               REBOOT_REQUIRED_INFO]:
371
390
    message_schemas[schema.type] = schema