compose: Fix network option field names and update dockerode types

Change-type: patch
Signed-off-by: Cameron Diver <cameron@balena.io>
This commit is contained in:
Cameron Diver 2018-11-28 17:38:43 +00:00
parent fd68ee6a1c
commit 5c04df2cb8
No known key found for this signature in database
GPG Key ID: 49690ED87032539F
4 changed files with 15 additions and 14 deletions

9
package-lock.json generated
View File

@ -1,6 +1,6 @@
{
"name": "balena-supervisor",
"version": "8.4.3",
"version": "8.6.0",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
@ -63,12 +63,11 @@
"dev": true
},
"@types/dockerode": {
"version": "2.5.5",
"resolved": "https://registry.npmjs.org/@types/dockerode/-/dockerode-2.5.5.tgz",
"integrity": "sha512-NSDdW9JUia7bLba87jTfZR/o1YcIFDcSC9HcdrXGJluHVfl8hXiUBFJwB9z3LSk/xmvv/pmEKzHFq6JmpNhlfg==",
"version": "2.5.9",
"resolved": "https://registry.npmjs.org/@types/dockerode/-/dockerode-2.5.9.tgz",
"integrity": "sha512-JS7NIXYcXitpNT3I5rYw68C3VhYmO2AHUbxr5uYsKDyL7SURlhdYGmseg0fCmBQLCl/VoK32NsJLYSR7mifBVA==",
"dev": true,
"requires": {
"@types/events": "*",
"@types/node": "*"
}
},

View File

@ -30,7 +30,7 @@
},
"devDependencies": {
"@types/bluebird": "^3.5.20",
"@types/dockerode": "2.5.5",
"@types/dockerode": "^2.5.9",
"@types/event-stream": "^3.3.34",
"@types/express": "^4.11.1",
"@types/knex": "^0.14.14",

View File

@ -417,18 +417,20 @@ export function serviceNetworksToDockerNetworks(
conf.IPAMConfig = {};
conf.Aliases = [];
_.each(net, (v, k) => {
// We know that IPAMConfig is set because of the intialisation
// above, but typescript doesn't agree, so use !
switch (k) {
case 'ipv4Address':
conf.IPAMConfig.IPV4Address = v;
conf.IPAMConfig!.IPv4Address = v as string;
break;
case 'ipv6Address':
conf.IPAMConfig.IPV6Address = v;
conf.IPAMConfig!.IPv6Address = v as string;
break;
case 'linkLocalIps':
conf.IPAMConfig.LinkLocalIps = v;
conf.IPAMConfig!.LinkLocalIPs = v as string[];
break;
case 'aliases':
conf.Aliases = v;
conf.Aliases = v as string[];
break;
}
});

View File

@ -309,7 +309,7 @@ describe 'compose/service', ->
EndpointsConfig: {
'123456_balena': {
IPAMConfig: {
IPV4Address: '1.2.3.4'
IPv4Address: '1.2.3.4'
},
Aliases: []
}
@ -327,9 +327,9 @@ describe 'compose/service', ->
EndpointsConfig: {
'123456_balena': {
IPAMConfig: {
IPV4Address: '1.2.3.4'
IPV6Address: '5.6.7.8'
LinkLocalIps: [ '123.123.123' ]
IPv4Address: '1.2.3.4'
IPv6Address: '5.6.7.8'
LinkLocalIPs: [ '123.123.123' ]
}
Aliases: [ 'test', '1123' ]
}