mirror of
https://github.com/kemko/nomad.git
synced 2026-01-07 19:05:42 +03:00
Update drain methods to properly wrap DrainSpec params
This commit is contained in:
@@ -25,14 +25,16 @@ export default Watchable.extend({
|
||||
drain(node, drainSpec) {
|
||||
const url = addToPath(this.urlForFindRecord(node.id, 'node'), '/drain');
|
||||
return this.ajax(url, 'POST', {
|
||||
data: Object.assign(
|
||||
{
|
||||
NodeID: node.id,
|
||||
Deadline: 0,
|
||||
IgnoreSystemJobs: true,
|
||||
},
|
||||
drainSpec
|
||||
),
|
||||
data: {
|
||||
NodeID: node.id,
|
||||
DrainSpec: Object.assign(
|
||||
{
|
||||
Deadline: 0,
|
||||
IgnoreSystemJobs: true,
|
||||
},
|
||||
drainSpec
|
||||
),
|
||||
},
|
||||
});
|
||||
},
|
||||
|
||||
@@ -44,4 +46,14 @@ export default Watchable.extend({
|
||||
})
|
||||
);
|
||||
},
|
||||
|
||||
cancelDrain(node) {
|
||||
const url = addToPath(this.urlForFindRecord(node.id, 'node'), '/drain');
|
||||
return this.ajax(url, 'POST', {
|
||||
data: {
|
||||
NodeID: node.id,
|
||||
DrainSpec: null,
|
||||
},
|
||||
});
|
||||
},
|
||||
});
|
||||
|
||||
@@ -145,8 +145,10 @@ module('Unit | Adapter | Node', function(hooks) {
|
||||
JSON.parse(request.requestBody),
|
||||
{
|
||||
NodeID: node.id,
|
||||
Deadline: 0,
|
||||
IgnoreSystemJobs: true,
|
||||
DrainSpec: {
|
||||
Deadline: 0,
|
||||
IgnoreSystemJobs: true,
|
||||
},
|
||||
},
|
||||
'POST request is made with the default body arguments'
|
||||
);
|
||||
@@ -164,8 +166,10 @@ module('Unit | Adapter | Node', function(hooks) {
|
||||
JSON.parse(request.requestBody),
|
||||
{
|
||||
NodeID: node.id,
|
||||
Deadline: spec.Deadline,
|
||||
IgnoreSystemJobs: spec.IgnoreSystemJobs,
|
||||
DrainSpec: {
|
||||
Deadline: spec.Deadline,
|
||||
IgnoreSystemJobs: spec.IgnoreSystemJobs,
|
||||
},
|
||||
},
|
||||
'POST request is made with the drain spec as body arguments'
|
||||
);
|
||||
@@ -184,8 +188,10 @@ module('Unit | Adapter | Node', function(hooks) {
|
||||
JSON.parse(request.requestBody),
|
||||
{
|
||||
NodeID: node.id,
|
||||
Deadline: -1000000000,
|
||||
IgnoreSystemJobs: true,
|
||||
DrainSpec: {
|
||||
Deadline: -1000000000,
|
||||
IgnoreSystemJobs: true,
|
||||
},
|
||||
},
|
||||
'POST request is made with the default body arguments'
|
||||
);
|
||||
@@ -205,8 +211,10 @@ module('Unit | Adapter | Node', function(hooks) {
|
||||
JSON.parse(request.requestBody),
|
||||
{
|
||||
NodeID: node.id,
|
||||
Deadline: -1000000000,
|
||||
IgnoreSystemJobs: spec.IgnoreSystemJobs,
|
||||
DrainSpec: {
|
||||
Deadline: -1000000000,
|
||||
IgnoreSystemJobs: spec.IgnoreSystemJobs,
|
||||
},
|
||||
},
|
||||
'POST request is made with the drain spec, except deadline is not overridden'
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user