コード例 #1
0
ファイル: upstart.py プロジェクト: janfabry/python-deployer
        def content(self):
            self = self.parent

            extra_scripts = ''
            for s in ('start', 'stop'):
                for p in ('pre', 'post'):
                    script = getattr(self, '%s_%s_script' % (p, s), '')
                    if script:
                        extra_scripts += """
%s-%s script
%s
end script
""" % (p, s, indent(script))

            return upstart_template % {
                    'description': esc1(self.description),
                    'author': esc1(self.author),
                    'chdir': esc1(self.chdir),
                    'start_on': self.start_on,
                    'stop_on': self.stop_on,
                    'command': self.full_command,
                    'user': esc1(self.user),
                    'extra': self.extra,
                    'extra_scripts': extra_scripts,
                }
コード例 #2
0
    def print_color(self):
        if '.property' in self.trace.func_name:
            f = lambda string: self._wrap(string, 'property')
        else:
            f = lambda string: self._wrap(string, 'func')

        params = ', '.join(map(repr, self.trace.args) +
                            [ '%s=%s' % (k, repr(v)) for k,v in self.trace.kwargs.items() ])
        if self.trace.items:
            return (f('%s(%s)\n[\n' % (self.trace.func_name, params)) +
                    ''.join([ indent(self._print_item_color(i), prefix='  ') for i in self.trace.items ]) +
                    f(']'))
        else:
            return f('%s(%s)' % (self.trace.func_name, params))
コード例 #3
0
ファイル: upstart.py プロジェクト: viciu/python-deployer
        def content(self):
            self = self.parent

            if self.post_stop_script:
                post_stop_script = post_stop_script_template % {
                        'content': indent(self.post_stop_script),
                    }

            else:
                post_stop_script = ''

            return upstart_template % {
                    'description': esc1(self.description),
                    'author': esc1(self.author),
                    'chdir': esc1(self.chdir),
                    'command': self.full_command,
                    'user': esc1(self.user),
                    'post_stop_script': post_stop_script,
                }
コード例 #4
0
        def content(self):
            self = self.parent

            extra_scripts = ''
            for s in ('start', 'stop'):
                for p in ('pre', 'post'):
                    script = getattr(self, '%s_%s_script' % (p, s), '')
                    if script:
                        extra_scripts += """
%s-%s script
%s
end script
""" % (p, s, indent(script))

            return upstart_template % {
                'description': esc1(self.description),
                'author': esc1(self.author),
                'chdir': esc1(self.chdir),
                'command': self.full_command,
                'user': esc1(self.user),
                'extra': self.extra,
                'extra_scripts': extra_scripts,
            }