diff --git a/__tests__/devenv-e2e/011-logs.spec.js b/__tests__/devenv-e2e/011-logs.spec.js index dcd44b58a..4180b3693 100644 --- a/__tests__/devenv-e2e/011-logs.spec.js +++ b/__tests__/devenv-e2e/011-logs.spec.js @@ -93,7 +93,7 @@ describe( 'vip dev-env logs', () => { ); expect( result.rc ).toBeGreaterThan( 0 ); expect( result.stderr ).toContain( - "Error: Service 'foobar' not found. Please choose from one:" + "Error: Service 'foobar' not found. Please choose from:" ); } ); diff --git a/src/lib/dev-environment/dev-environment-core.ts b/src/lib/dev-environment/dev-environment-core.ts index 5a1d4db75..ea7767b1d 100644 --- a/src/lib/dev-environment/dev-environment-core.ts +++ b/src/lib/dev-environment/dev-environment-core.ts @@ -29,6 +29,7 @@ import { LandoExecOptions, getProxyContainer, removeProxyCache, + getLandoApplication, } from './dev-environment-lando'; import { AppEnvironment } from '../../graphqlTypes'; import app from '../api/app'; @@ -344,15 +345,14 @@ export async function showLogs( const instancePath = getEnvironmentPath( slug ); - debug( 'Instance path for', slug, 'is:', instancePath ); + debug( 'Instance path for %s is %s', slug, instancePath ); if ( options.service ) { - const appInfo = await landoInfo( lando, instancePath ); - if ( ! appInfo.services.includes( options.service ) ) { + const application = await getLandoApplication( lando, instancePath ); + const services = application.info.map( service => service.service ); + if ( ! services.includes( options.service ) ) { throw new UserError( - `Service '${ - options.service - }' not found. Please choose from one: ${ appInfo.services.toString() }` + `Service '${ options.service }' not found. Please choose from: ${ services.join( ', ' ) }` ); } } diff --git a/src/lib/dev-environment/dev-environment-lando.ts b/src/lib/dev-environment/dev-environment-lando.ts index f566d1408..aeaa81fad 100644 --- a/src/lib/dev-environment/dev-environment-lando.ts +++ b/src/lib/dev-environment/dev-environment-lando.ts @@ -341,7 +341,7 @@ async function landoRecovery( lando: Lando, instancePath: string, error: unknown } } -async function getLandoApplication( lando: Lando, instancePath: string ): Promise< App > { +export async function getLandoApplication( lando: Lando, instancePath: string ): Promise< App > { const started = new Date(); try { if ( appMap.has( instancePath ) ) { diff --git a/types/lando/plugins/lando-core/lib/utils.d.ts b/types/lando/plugins/lando-core/lib/utils.d.ts index d0e6b06f3..731c35045 100644 --- a/types/lando/plugins/lando-core/lib/utils.d.ts +++ b/types/lando/plugins/lando-core/lib/utils.d.ts @@ -1,10 +1,9 @@ import App from 'lando/lib/app'; -export interface AppInfo { +export interface AppInfo extends Record< string, unknown > { name: string; location: string; - services: string[]; - [ key: string ]: unknown; + services: string; } export function getHostPath( mount: any ): any;