parent
a6c0b5884a
commit
7e94f9792a
@ -0,0 +1,24 @@
|
|||||||
|
const State = require('../State')
|
||||||
|
|
||||||
|
class PackageAbsentState extends State {
|
||||||
|
constructor(host, config) {
|
||||||
|
if ( !host.packages ) {
|
||||||
|
throw new Error(`Cannot apply package absent state to host ${host.name}: missing package manager API.`)
|
||||||
|
}
|
||||||
|
super(host, config)
|
||||||
|
}
|
||||||
|
|
||||||
|
async reverse() {
|
||||||
|
return this._host.packages.install(this._config.package)
|
||||||
|
}
|
||||||
|
|
||||||
|
async check() {
|
||||||
|
return !(await this._host.packages.is_installed(this._config.package))
|
||||||
|
}
|
||||||
|
|
||||||
|
async apply() {
|
||||||
|
return this._host.packages.uninstall(this._config.package)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = exports = PackageAbsentState
|
Loading…
Reference in new issue