Code Monkey home page Code Monkey logo

Comments (10)

etingof avatar etingof commented on May 18, 2024

Thanks for raising this!

So what would be the better behavior?

from pysmi.

sebkraemer avatar sebkraemer commented on May 18, 2024

I've seen sys.exit(1), that would work fine.

from pysmi.

etingof avatar etingof commented on May 18, 2024

Do you mean sys.exit(1) here. That totally makes sense to me. Will it fix your issue?

from pysmi.

sebkraemer avatar sebkraemer commented on May 18, 2024

I don't think so. For example, I'm getting

Created/updated MIBs:
Pre-compiled MIBs borrowed:
Up to date MIBs:
Missing source MIBs: foo-MIB
Ignored MIBs:
Failed MIBs:

after calling mibdump.py --mib-borrower= --destination-directory=. --mib-source=/tmp234234 foo-MIB

.. so I believe the error originates somewhere else or is not caught in this PySmiException. The errors in the else branch with the verbose errors is still executed, according to the stderr output.

from pysmi.

etingof avatar etingof commented on May 18, 2024

Aha, I see what you mean! Commit 607d6df (master HEAD) should fix that.

from pysmi.

sebkraemer avatar sebkraemer commented on May 18, 2024

This works nicely, thank you!

Depending on the wanted behaviour one could move the errors output from the verboseFlag part to the lower error checking part. That way, failed and missing mibs will only be logged in error case:

if any(x for x in processed.values() if x == 'missing'):
    exitCode = EX_MIB_MISSING
    sys.stderr.write('Missing source MIBs: %s\r\n' % ', '.join(['%s' % x for x in sorted(processed) if processed[x] == 'missing']))
 
if any(x for x in processed.values() if x == 'failed'):
    exitCode = EX_MIB_FAILED
    sys.stderr.write('Failed MIBs: %s\r\n' % ', '.join(['%s (%s)' % (x, processed[x].error) for x in sorted(processed) if processed[x] == 'failed']))

But that might be personal taste. Your last commit definitely fixes the return code issue 👍

from pysmi.

sebkraemer avatar sebkraemer commented on May 18, 2024

Btw, any idea when this will show up in pip updates? I'm not familiar with the release/sync procedure.

from pysmi.

etingof avatar etingof commented on May 18, 2024

I will try to push the next release later today.

from pysmi.

etingof avatar etingof commented on May 18, 2024

pysmi 0.3.2 has been released

from pysmi.

sebkraemer avatar sebkraemer commented on May 18, 2024

Thanks again.

from pysmi.

Related Issues (20)

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.