You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

25 lines
735 B

import {SSHHost} from './SSHHost'
import * as ssh2 from 'ssh2'
import {shellCommand, ShellCommand} from './types'
import {ExecutionResult} from './ExecutionResult'
import {ErrorWithContext, Filesystem} from '@extollo/lib'
export class PCTHost extends SSHHost {
constructor(
config: ssh2.ConnectConfig,
protected readonly vmid: number,
) {
super(config)
}
async execute(command: ShellCommand): Promise<ExecutionResult> {
return super.execute(shellCommand('pct exec', `${this.vmid}`, '--', command))
}
getFilesystem(): Promise<Filesystem>{
throw new ErrorWithContext('Accessing Filesystem of PCTHost is not supported.', {
vmid: this.vmid,
})
}
}