Skip to content

Commit

Permalink
[Non-Inclusive Language] Replace isDevClusterMaster with isDevCluster…
Browse files Browse the repository at this point in the history
…Manager

Signed-off-by: manasvis <[email protected]>
  • Loading branch information
manasvinibs committed Jun 13, 2022
1 parent 3ff99cf commit 1fe6799
Show file tree
Hide file tree
Showing 13 changed files with 26 additions and 26 deletions.
4 changes: 2 additions & 2 deletions packages/osd-config/src/__mocks__/env.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export function getEnvOptions(options: DeepPartial<EnvOptions> = {}): EnvOptions
runExamples: false,
...(options.cliArgs || {}),
},
isDevClusterMaster:
options.isDevClusterMaster !== undefined ? options.isDevClusterMaster : false,
isDevClusterManager:
options.isDevClusterManager !== undefined ? options.isDevClusterManager : false,
};
}
12 changes: 6 additions & 6 deletions packages/osd-config/src/__snapshots__/env.test.ts.snap

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/osd-config/src/env.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ test('correctly creates default environment in dev mode.', () => {
REPO_ROOT,
getEnvOptions({
configs: ['/test/cwd/config/opensearch_dashboards.yml'],
isDevClusterMaster: true,
isDevClusterManager: true,
})
);

Expand Down
8 changes: 4 additions & 4 deletions packages/osd-config/src/env.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ import { PackageInfo, EnvironmentMode } from './types';
export interface EnvOptions {
configs: string[];
cliArgs: CliArgs;
isDevClusterMaster: boolean;
isDevClusterManager: boolean;
}

/** @internal */
Expand Down Expand Up @@ -110,10 +110,10 @@ export class Env {
public readonly configs: readonly string[];

/**
* Indicates that this OpenSearch Dashboards instance is run as development Node Cluster master.
* Indicates that this OpenSearch Dashboards instance is run as development Node Cluster manager.
* @internal
*/
public readonly isDevClusterMaster: boolean;
public readonly isDevClusterManager: boolean;

/**
* @internal
Expand All @@ -137,7 +137,7 @@ export class Env {

this.cliArgs = Object.freeze(options.cliArgs);
this.configs = Object.freeze(options.configs);
this.isDevClusterMaster = options.isDevClusterMaster;
this.isDevClusterManager = options.isDevClusterManager;

const isDevMode = this.cliArgs.dev || this.cliArgs.envName === 'development';
this.mode = Object.freeze<EnvironmentMode>({
Expand Down
4 changes: 2 additions & 2 deletions src/core/server/bootstrap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
*/

import chalk from 'chalk';
import { isMaster } from 'cluster';
import { isMaster as isClusterManager } from 'cluster';
import { CliArgs, Env, RawConfigService } from './config';
import { Root } from './root';
import { CriticalError } from './errors';
Expand Down Expand Up @@ -82,7 +82,7 @@ export async function bootstrap({
const env = Env.createDefault(REPO_ROOT, {
configs,
cliArgs,
isDevClusterMaster: isMaster && cliArgs.dev && features.isClusterModeSupported,
isDevClusterManager: isClusterManager && cliArgs.dev && features.isClusterModeSupported,
});

const rawConfigService = new RawConfigService(env.configs, applyConfigOverrides);
Expand Down
2 changes: 1 addition & 1 deletion src/core/server/http/http_service.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ test('does not start http server if process is dev cluster master', async () =>
const service = new HttpService({
coreId,
configService,
env: Env.createDefault(REPO_ROOT, getEnvOptions({ isDevClusterMaster: true })),
env: Env.createDefault(REPO_ROOT, getEnvOptions({ isDevClusterManager: true })),
logger,
});

Expand Down
2 changes: 1 addition & 1 deletion src/core/server/http/http_service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ export class HttpService
* @internal
* */
private shouldListen(config: HttpConfig) {
return !this.coreContext.env.isDevClusterMaster && config.autoListen;
return !this.coreContext.env.isDevClusterManager && config.autoListen;
}

public async stop() {
Expand Down
4 changes: 2 additions & 2 deletions src/core/server/legacy/legacy_service.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@ describe('once LegacyService is set up in `devClusterMaster` mode', () => {
REPO_ROOT,
getEnvOptions({
cliArgs: { silent: true, basePath: false },
isDevClusterMaster: true,
isDevClusterManager: true,
})
),
logger,
Expand Down Expand Up @@ -402,7 +402,7 @@ describe('once LegacyService is set up in `devClusterMaster` mode', () => {
REPO_ROOT,
getEnvOptions({
cliArgs: { quiet: true, basePath: true },
isDevClusterMaster: true,
isDevClusterManager: true,
})
),
logger,
Expand Down
2 changes: 1 addition & 1 deletion src/core/server/legacy/legacy_service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ export class LegacyService implements CoreService {
this.log.debug('starting legacy service');

// Receive initial config and create osdServer/ClusterManager.
if (this.coreContext.env.isDevClusterMaster) {
if (this.coreContext.env.isDevClusterManager) {
await this.createClusterManager(this.legacyRawConfig!);
} else {
this.osdServer = await this.createOsdServer(
Expand Down
2 changes: 1 addition & 1 deletion src/core/server/plugins/plugins_service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ export class PluginsService implements CoreService<PluginsServiceSetup, PluginsS
const config = await this.config$.pipe(first()).toPromise();

let contracts = new Map<PluginName, unknown>();
const initialize = config.initialize && !this.coreContext.env.isDevClusterMaster;
const initialize = config.initialize && !this.coreContext.env.isDevClusterManager;
if (initialize) {
contracts = await this.pluginsSystem.setupPlugins(deps);
this.registerPluginStaticDirs(deps);
Expand Down
2 changes: 1 addition & 1 deletion src/core/test_helpers/osd_server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ export function createRootWithSettings(
dist: false,
...cliArgs,
},
isDevClusterMaster: false,
isDevClusterManager: false,
});

return new Root(
Expand Down
4 changes: 2 additions & 2 deletions src/legacy/server/logging/rotate/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
* under the License.
*/

import { isMaster, isWorker } from 'cluster';
import { isMaster as isClusterManager, isWorker } from 'cluster';
import { Server } from '@hapi/hapi';
import { LogRotator } from './log_rotator';
import { OpenSearchDashboardsConfig } from '../../osd_server';
Expand All @@ -43,7 +43,7 @@ export async function setupLoggingRotate(server: Server, config: OpenSearchDashb

// We just want to start the logging rotate service once
// and we choose to use the master (prod) or the worker server (dev)
if (!isMaster && isWorker && process.env.osdWorkerType !== 'server') {
if (!isClusterManager && isWorker && process.env.osdWorkerType !== 'server') {
return;
}

Expand Down
4 changes: 2 additions & 2 deletions src/legacy/server/logging/rotate/log_rotator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
*/

import * as chokidar from 'chokidar';
import { isMaster } from 'cluster';
import { isMaster as isClusterManager } from 'cluster';
import fs from 'fs';
import { Server } from '@hapi/hapi';
import { throttle } from 'lodash';
Expand Down Expand Up @@ -359,7 +359,7 @@ export class LogRotator {
}

_sendReloadLogConfigSignal() {
if (isMaster) {
if (isClusterManager) {
(process as NodeJS.EventEmitter).emit('SIGHUP');
return;
}
Expand Down

0 comments on commit 1fe6799

Please sign in to comment.