File: install_app.py

package info (click to toggle)
python-mitogen 0.3.25~a2-1
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 6,220 kB
  • sloc: python: 21,989; sh: 183; makefile: 74; perl: 19; ansic: 18
file content (28 lines) | stat: -rw-r--r-- 471 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/usr/bin/env python
"""
Install our application on a remote machine.

Usage:
    install_app.py <hostname>

Where:
    <hostname>  Hostname to install to.
"""
import subprocess
import sys

import mitogen


def install_app():
    subprocess.check_call(['tar', 'zxvf', 'my_app.tar.gz'])


@mitogen.main()
def main(router):
    if len(sys.argv) != 2:
        print(__doc__)
        sys.exit(1)

    context = router.ssh(hostname=sys.argv[1])
    context.call(install_app)