Fixed procedure execution code

This commit is contained in:
Fabio Manganiello 2018-01-04 16:11:54 +01:00
parent 6b58c96ebe
commit a476de81a8
6 changed files with 25 additions and 22 deletions

View file

@ -119,5 +119,11 @@ class Daemon(object):
self.stop_app() self.stop_app()
def main():
print('Starting platypush v.{}'.format(__version__))
app = Daemon.build_from_cmdline(sys.argv[1:])
app.start()
# vim:sw=4:ts=4:et: # vim:sw=4:ts=4:et:

View file

@ -1,11 +1,6 @@
import sys from platypush import main
from platypush import Daemon, __version__
print('Starting platypush v.{}'.format(__version__))
app = Daemon.build_from_cmdline(sys.argv[1:])
app.start()
main()
# vim:sw=4:ts=4:et: # vim:sw=4:ts=4:et:

View file

@ -53,9 +53,10 @@ class Request(Message):
def _execute_procedure(self, *args, **kwargs): def _execute_procedure(self, *args, **kwargs):
from config import Config from platypush.config import Config
from platypush.procedure import Procedure
logging.info('Executing procedure request: {}'.format(procedure)) logging.info('Executing procedure request: {}'.format(self.action))
proc_name = self.action.split('.')[-1] proc_name = self.action.split('.')[-1]
proc_config = Config.get_procedures()[proc_name] proc_config = Config.get_procedures()[proc_name]
proc = Procedure.build(name=proc_name, requests=proc_config, backend=self.backend, id=self.id) proc = Procedure.build(name=proc_name, requests=proc_config, backend=self.backend, id=self.id)

View file

@ -176,5 +176,15 @@ class Pusher(object):
response_timeout=timeout) response_timeout=timeout)
def main():
opts = Pusher.parse_build_args(sys.argv[1:])
pusher = Pusher(config_file=opts.config, backend=opts.backend)
if opts.type == 'event':
pusher.send_event(target=opts.target, type=opts.event, **opts.args)
else:
pusher.send_request(target=opts.target, action=opts.action, timeout=opts.timeout, **opts.args)
# vim:sw=4:ts=4:et: # vim:sw=4:ts=4:et:

View file

@ -1,15 +1,6 @@
import sys from platypush.pusher import main
from . import Pusher
opts = Pusher.parse_build_args(sys.argv[1:])
pusher = Pusher(config_file=opts.config, backend=opts.backend)
if opts.type == 'event':
pusher.send_event(target=opts.target, type=opts.event, **opts.args)
else:
pusher.send_request(target=opts.target, action=opts.action, timeout=opts.timeout, **opts.args)
main()
# vim:sw=4:ts=4:et: # vim:sw=4:ts=4:et:

View file

@ -43,8 +43,8 @@ setup(
packages = find_packages(), packages = find_packages(),
entry_points = { entry_points = {
'console_scripts': [ 'console_scripts': [
'platypush=platypush.__main__', 'platypush=platypush:main',
'pusher=platypush.pusher.__main__', 'pusher=platypush.pusher:main',
], ],
}, },
data_files = [ data_files = [