OLD | NEW |
1 'use strict'; | 1 'use strict'; |
2 | 2 |
3 /** | 3 /** |
4 * The Python store environment. | 4 * The Python store environment. |
5 * | 5 * |
6 * @module env | 6 * @module env |
7 * @submodule env.python | 7 * @submodule env.python |
8 */ | 8 */ |
9 | 9 |
10 YUI.add('juju-env-python', function(Y) { | 10 YUI.add('juju-env-python', function(Y) { |
(...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
349 * @return {undefined} Sends a message to the server only. | 349 * @return {undefined} Sends a message to the server only. |
350 */ | 350 */ |
351 set_config: function(service, config, data, callback) { | 351 set_config: function(service, config, data, callback) { |
352 this._send_rpc({ | 352 this._send_rpc({ |
353 op: 'set_config', | 353 op: 'set_config', |
354 service_name: service, | 354 service_name: service, |
355 config: config, | 355 config: config, |
356 data: data}, callback, true); | 356 data: data}, callback, true); |
357 }, | 357 }, |
358 | 358 |
| 359 // The constraints that the backend understands. Used to generate forms. |
| 360 genericConstraints: ['cpu', 'mem', 'arch'], |
| 361 |
359 /** | 362 /** |
360 * Change the constraints of the given service. | 363 * Change the constraints of the given service. |
361 * | 364 * |
362 * @method set_constraints | 365 * @method set_constraints |
363 * @param {String} service The service name. | 366 * @param {String} service The service name. |
364 * @param {Object} constraints The charm constraints. | 367 * @param {Object} constraints A hash of charm constraints. |
365 * @param {Function} callback A callable that must be called once the | 368 * @param {Function} callback A callable that must be called once the |
366 operation is performed. | 369 operation is performed. |
367 * @return {undefined} Sends a message to the server only. | 370 * @return {undefined} Sends a message to the server only. |
368 */ | 371 */ |
369 set_constraints: function(service, constraints, callback) { | 372 set_constraints: function(service, constraints, callback) { |
| 373 // Transform the constraints mapping into a string the backend |
| 374 // understands. |
| 375 var values = []; |
| 376 Y.Object.each(constraints, function(value, name) { |
| 377 values.push(name + '=' + value); |
| 378 }); |
| 379 |
370 this._send_rpc({ | 380 this._send_rpc({ |
371 op: 'set_constraints', | 381 op: 'set_constraints', |
372 service_name: service, | 382 service_name: service, |
373 constraints: constraints}, callback, true); | 383 constraints: values}, callback, true); |
374 }, | 384 }, |
375 | 385 |
376 /** | 386 /** |
377 * Mark the given unit or relation problem as resolved. | 387 * Mark the given unit or relation problem as resolved. |
378 * | 388 * |
379 * @method resolved | 389 * @method resolved |
380 * @param {String} unit_name The unit name. | 390 * @param {String} unit_name The unit name. |
381 * @param {String} relation_name The relation name. | 391 * @param {String} relation_name The relation name. |
382 * @param {Boolean} retry Whether or not to retry the unit/relation. | 392 * @param {Boolean} retry Whether or not to retry the unit/relation. |
383 * @param {Function} callback A callable that must be called once the | 393 * @param {Function} callback A callable that must be called once the |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
458 environments.PythonEnvironment = PythonEnvironment; | 468 environments.PythonEnvironment = PythonEnvironment; |
459 | 469 |
460 }, '0.1.0', { | 470 }, '0.1.0', { |
461 requires: [ | 471 requires: [ |
462 'base', | 472 'base', |
463 'json-parse', | 473 'json-parse', |
464 'json-stringify', | 474 'json-stringify', |
465 'juju-env-base' | 475 'juju-env-base' |
466 ] | 476 ] |
467 }); | 477 }); |
OLD | NEW |