Giter Club home page Giter Club logo

auto-patch's People

Contributors

rkrahl avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar  avatar

auto-patch's Issues

Add documentation

Documentation is virtually non existent. There should at least be a manual page for the auto-patch script.

Add a configuration file

There are several things that need configuration in the script:

  • mail configuration: mail host, from, to,
  • control of retrying if the ZYPP library is locked, added in #4: lock_max_tries and lock_wait,
  • logging configuration, added in #5.

All of this is currently hard coded in the script, but should be made configurable in a configuration file.

Improve diagnostics: add logging and better error handling

Should improve diagnostics:

Add better error handling. Write a meaningful error message to stderr rather then letting Python emit the stack trace from the unhandled exception.

Add logging. Log relevant events such as zypper calls and return codes with level DEBUG. Log fatal errors (e.g. unhandled exceptions, see above) with level CRITICAL. Log to stderr with level DEBUG if it is a tty and to syslog with level WARN.

zypper already running

Thought you might want to see this. If zypper is already running, you will get exit 7 from it.
Was thinking a wait loop to attempt might get around that.

server6:/opt/auto-patch # /usr/sbin/auto-patch.py
Traceback (most recent call last):
File "/usr/sbin/auto-patch.py", line 88, in
if patch(stdout=tmpf):
File "/usr/sbin/auto-patch.py", line 67, in patch
if Zypper.patch_check(stdout=stdout) == 0:
File "/usr/sbin/auto-patch.py", line 41, in patch_check
return cls.call(args, stdout=stdout, retcodes={100, 101})
File "/usr/sbin/auto-patch.py", line 31, in call
proc.check_returncode()
File "/usr/lib64/python3.8/subprocess.py", line 444, in check_returncode
raise CalledProcessError(self.returncode, self.args, self.stdout,
subprocess.CalledProcessError: Command '['/usr/bin/zypper', '--quiet', '--non-interactive', 'patch-check']' returned non-zero exit status 7.

Improved handling of error return codes from the zypper call

#1 and #4 improved handling of return codes from zypper for two special cases. Yet there are still several error conditions from zypper left to be dealt with. In most cases the proper reaction will probably be just throwing an error, which is what also happens now. But the return codes from zypper should at least translated into an intelligible error message.

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.