Code Monkey home page Code Monkey logo

pyservice's People

Contributors

photonios avatar

Watchers

 avatar  avatar  avatar

pyservice's Issues

Need unittests

We need an entire test suite so we can get some pretty badges from Travis CI and appveyor.

Add setup.py

We will need a setup.py file if we wish to get this up on PyPI and it will also help with running the tests.

update .gitignore with github's python .gitignore

Now that we are implementing sphinx docs, unittests and integrating with more standard Python toolsets, it will make things easier to take advantage of the work that github has done in building this robust .gitignore file

Standardize Linux / Windows CLI

Now that everything is working (more or less) we need to make the Linux CLI offer some of the same options as the windows CLI, most notably

  • make it so install/remove/start/stop are subcommands
  • offer username for start
  • specific options for each subcommand

move cli argument handling from __init__

As __init__ is for initialization, it would make more sense to have a second method for handling cli arguments and calling the correct methods, this would make our API more verbose, but it would also make testing easier as we can instanciate, mock and test in separate steps.

While I'm at it, I will modify the argument handling to use Python's argparse module so we can later expand the CLI to accept arguments from the user for different options.

ImportError on Linux

When running on Linux, service.py attempts to from .windows import PyServiceWindows on Linux this will fail because pywin32 will not be installed. I propose to import PyServiceWindows or PyServiceLinux as PlatformService. This will allow us to simplify PyService.__init__ as well as we will not need to create a platform_map.

Need more documentation

We need some good documentation which we can host on readthedocs.

  • sphinx quickstart
  • docstrings into sphinx format
  • Quickstart section
  • installation

windows service stuck starting

I have fixed the install issue, but when starting the service, it runs but it is stuck in the "starting" state. This is because we need to report the service status. I've been wrestling with this all night...trying again now with fresh eyes.

cannot install service on windows

python test_linux_daemon.py --install

  • Installing dummy
    C:\Users\IEUser\Desktop\sandbox\test_linux_daemon
    DummyService
    Traceback (most recent call last):
    File "test_linux_daemon.py", line 21, in
    service.handle_cli()
    File "c:\users\ieuser\workspace\pyservice\pyservice\service.py", line 126, in handle_cli
    run_or_exit_with_1(self.install)
    File "c:\users\ieuser\workspace\pyservice\pyservice\service.py", line 120, in run_or_exit_with_1
    if not func():
    File "c:\users\ieuser\workspace\pyservice\pyservice\service.py", line 237, in install
    result = self._install()
    File "c:\users\ieuser\workspace\pyservice\pyservice\windows.py", line 97, in _install
    self.class_name,
    AttributeError: 'DummyService' object has no attribute 'class_name'

Needs a readme

The first place a potential user will look is in the readme. This project lacks one. This will be the second phase of the cleanup effort.

This will be ongoing as I need to dive deeper and gain more insight into how it all works together.

Let's simplify everything and make one factory function

Trying to make everything work on Windows has taken a huge portion of my time and has led me to learn way too much (and too little) about the pywin32 project. What I propose is to create a factory function which takes a function function and returns a class. This class will be constructed based on the current platform.

Come to think of it, this sounds a lot like a decorator. I'm going to try that and see what happens.

Add instructions to systemd based systems

I have tested this on Fedora 24 and it works, but because we use an init.d (ie sys v init) script, the system needs to be rebooted before you can control it with systemctl. This is because the stsemd-sysv-generator needs to run on boot. The other option is to tell systemd to reload, ie systemctl daemon-reload.

Need to drop priviledges as soon as we are installed and running

We need to drop privileges as soon as we are done with them. This is a standard practice to reduce security concerns. It is ok to require administrative privileges to start/stop/install/uninstall but as soon as you no longer need the privileges you should drop them.

Need a license

The original author licensed this under the GPL 2, I wish to move that up to the GPL 3. I will make the changes with the assumption that if the author disagrees I can change it back.

Windows service stuck stopping

So, we have everything working except when I use the tornado example (modified for the new API) it installs/starts/removes just fine, but hangs on stopping. I hope I can fix this using something in the tornado API because I've found the win32serviceutils api to be a pain. I'm sure that this is due to windows and not the pywin32 package. I basically need a way to tell tornado to stop when a flag variable is set.

PyService should Inherit from PlatformService

PyService carries around a reference to the platform specific implementation, this is inefficient and we could drastically simplify the code if it simply inherited from PlatformService instead.

private variables in PyService class are backwards

We are creating the cross-platform public API in PyService, but all action methods are prefixed with an underscore while the platform specific classes are not prefixed with an underscore. To make it more sensible to newcomers, we should make the platform specific methods private (ie. prefixed with an underscore) and the public API public (ie not prefixed with an underscore).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.