mirror of
https://github.com/balena-os/balena-supervisor.git
synced 2025-01-31 08:25:36 +00:00
Change macAddressPath to /sys/class/net
Previously it was set at /mnt/root/sys/class/net, which is the same as /sys/class/net because Supervisor has a network mode of `host`. Signed-off-by: Christina Ying Wang <christina@balena.io>
This commit is contained in:
parent
75bf2aa3b4
commit
57f4dcbcac
@ -27,9 +27,7 @@ const constants = {
|
|||||||
hostOSVersionPath:
|
hostOSVersionPath:
|
||||||
checkString(process.env.HOST_OS_VERSION_PATH) ||
|
checkString(process.env.HOST_OS_VERSION_PATH) ||
|
||||||
`${rootMountPoint}/etc/os-release`,
|
`${rootMountPoint}/etc/os-release`,
|
||||||
macAddressPath:
|
macAddressPath: checkString(process.env.MAC_ADDRESS_PATH) || `/sys/class/net`,
|
||||||
checkString(process.env.MAC_ADDRESS_PATH) ||
|
|
||||||
`${rootMountPoint}/sys/class/net`,
|
|
||||||
privateAppEnvVars: [
|
privateAppEnvVars: [
|
||||||
'RESIN_SUPERVISOR_API_KEY',
|
'RESIN_SUPERVISOR_API_KEY',
|
||||||
'RESIN_API_KEY',
|
'RESIN_API_KEY',
|
||||||
|
@ -153,9 +153,6 @@ describe('config', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('reads and exposes MAC addresses', async () => {
|
it('reads and exposes MAC addresses', async () => {
|
||||||
// FIXME: this variable defaults to `/mnt/root/sys/class/net`. The supervisor runs with network_mode: host
|
|
||||||
// which means that it can just use the container `/sys/class/net` and the result should be the same
|
|
||||||
constants.macAddressPath = '/sys/class/net';
|
|
||||||
const macAddress = await conf.get('macAddress');
|
const macAddress = await conf.get('macAddress');
|
||||||
expect(macAddress).to.have.length.greaterThan(0);
|
expect(macAddress).to.have.length.greaterThan(0);
|
||||||
});
|
});
|
||||||
|
@ -15,6 +15,7 @@ import * as TargetState from '~/src/device-state/target-state';
|
|||||||
import * as ApiHelper from '~/lib/api-helper';
|
import * as ApiHelper from '~/lib/api-helper';
|
||||||
import supervisorVersion = require('~/lib/supervisor-version');
|
import supervisorVersion = require('~/lib/supervisor-version');
|
||||||
import * as eventTracker from '~/src/event-tracker';
|
import * as eventTracker from '~/src/event-tracker';
|
||||||
|
import * as constants from '~/lib/constants';
|
||||||
|
|
||||||
import { TypedError } from 'typed-error';
|
import { TypedError } from 'typed-error';
|
||||||
import { DeviceNotFoundError } from '~/lib/errors';
|
import { DeviceNotFoundError } from '~/lib/errors';
|
||||||
@ -65,6 +66,10 @@ describe('ApiBinder', () => {
|
|||||||
|
|
||||||
spy(balenaAPI.balenaBackend!, 'registerHandler');
|
spy(balenaAPI.balenaBackend!, 'registerHandler');
|
||||||
server = balenaAPI.listen(3000);
|
server = balenaAPI.listen(3000);
|
||||||
|
|
||||||
|
// TODO: remove when moving this suite to integration tests
|
||||||
|
// @ts-expect-error
|
||||||
|
constants.macAddressPath = './test/data/sys/class/net';
|
||||||
});
|
});
|
||||||
|
|
||||||
after(() => {
|
after(() => {
|
||||||
@ -75,6 +80,10 @@ describe('ApiBinder', () => {
|
|||||||
} catch (error) {
|
} catch (error) {
|
||||||
/* noop */
|
/* noop */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: remove when moving this suite to integration tests
|
||||||
|
// @ts-expect-error
|
||||||
|
constants.macAddressPath = '/sys/class/net';
|
||||||
});
|
});
|
||||||
|
|
||||||
// We do not support older OS versions anymore, so we only test this case
|
// We do not support older OS versions anymore, so we only test this case
|
||||||
|
Loading…
x
Reference in New Issue
Block a user