55 lines
2.2 KiB
Python
55 lines
2.2 KiB
Python
#!/usr/bin/env python3
|
|
"""Explicit UI-only approval of an already pending Hello-World VM operation.
|
|
|
|
Planned for use after controlled non-root deployment and sync acceptance. This
|
|
runner does not provision an agent, create a plan, or bypass a blocked VM gate.
|
|
It uses the same isolated NSS store as run_pending.py, never global trust.
|
|
"""
|
|
import argparse
|
|
import os
|
|
from pathlib import Path
|
|
import shutil
|
|
import subprocess
|
|
import sys
|
|
import uuid
|
|
|
|
from run_pending import CA, ROOT, STATE, quiet_run
|
|
|
|
|
|
def identifier(value):
|
|
return str(uuid.UUID(value))
|
|
|
|
|
|
def main():
|
|
parser = argparse.ArgumentParser(description=__doc__)
|
|
parser.add_argument('--operation-id', type=identifier, required=True)
|
|
parser.add_argument('--asset-id', type=identifier, required=True)
|
|
parser.add_argument('--dev-test-approve', action='store_true', required=True)
|
|
args = parser.parse_args()
|
|
cache = ROOT / 'web/node_modules/.cache'
|
|
home = cache / 'browser-home'
|
|
nss = home / '.pki/nssdb'
|
|
nss.mkdir(parents=True, exist_ok=True, mode=0o700)
|
|
home.chmod(0o700)
|
|
certutil = shutil.which('certutil') or str(cache / 'nss-tools/root/usr/bin/certutil')
|
|
if not (nss / 'cert9.db').exists():
|
|
quiet_run([certutil, '-N', '-d', 'sql:' + str(nss), '--empty-password'])
|
|
quiet_run([certutil, '-A', '-d', 'sql:' + str(nss), '-n', 'RMM isolated development CA',
|
|
'-t', 'C,,', '-i', str(CA)])
|
|
quiet_run([certutil, '-V', '-d', 'sql:' + str(nss), '-n', 'RMM isolated development CA', '-u', 'L'])
|
|
env = {k: v for k, v in os.environ.items() if k not in ('DEBUG', 'PWDEBUG', 'NODE_DEBUG')}
|
|
env.update(RMM_E2E_PROFILE='dev/test', RMM_E2E_MODE='vm-hello',
|
|
RMM_E2E_LOGIN_FILE=str(STATE / 'browser-login.json'),
|
|
RMM_E2E_ASSET_ID=args.asset_id, RMM_E2E_OPERATION_ID=args.operation_id,
|
|
PLAYWRIGHT_BROWSERS_PATH=str(cache / 'playwright-browsers'))
|
|
return subprocess.run(['npm', 'run', 'test:browser', '--', 'vm-jobs.spec.ts'],
|
|
cwd=ROOT / 'web', env=env).returncode
|
|
|
|
|
|
if __name__ == '__main__':
|
|
try:
|
|
sys.exit(main())
|
|
except Exception:
|
|
print('FAIL: VM browser runner incomplete; private diagnostics withheld', file=sys.stderr)
|
|
sys.exit(1)
|