Ubuntu Pastebin

Paste from smoser at Wed, 4 Mar 2015 14:39:24 +0000

Download as text
 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
29
30
#!/usr/bin/python3

class f(object):
    def debug(*args):
        print(' '.join(args))

def is_upstart_system():
    if not util.which('initctl'):
        print("skipping, no initctl")
        #LOG.debug(("Skipping module named %s," " no /sbin/initctl located"), name)
        return False

    print("HOWDY")
    myenv = os.environ.copy()
    if 'UPSTART_SESSION' in myenv:
        del myenv['UPSTART_SESSION']
    check_cmd = ['initctl', 'version']
    try:
        (out, err) = util.subp(check_cmd, env=myenv)
        return 'upstart' in out
    except util.ProcessExecutionError as e:
        print("'%s' returned '%s', not using upstart" % (' '.join(check_cmd), e.exit_code))
        #LOG.debug("'%s' returned '%s', not using upstart", ' '.join(check_cmd), e.exit_code)
    return False

import os
from cloudinit import util
LOG = f

print(is_upstart_system())
Download as text