[PATCH] Cleanup some pylint errors in analog

Brian C. Lane bcl at redhat.com
Tue Feb 10 16:05:43 UTC 2015


On Tue, Feb 10, 2015 at 09:43:00AM +0100, Vratislav Podzimek wrote:
> On Mon, 2015-02-09 at 09:25 -0800, Brian C. Lane wrote:
> > ---
> >  scripts/analog | 15 ++++++++-------
> >  1 file changed, 8 insertions(+), 7 deletions(-)
> > 
> > diff --git a/scripts/analog b/scripts/analog
> > index eb1962e..6a426a7 100755
> > --- a/scripts/analog
> > +++ b/scripts/analog
> > @@ -24,11 +24,9 @@
> >  from __future__ import print_function
> >  
> >  import getpass
> > -import errno
> >  import optparse
> >  import os
> >  import os.path
> > -import signal
> >  import sys
> >  
> >  DEFAULT_PORT = 6080
> > @@ -194,9 +192,9 @@ def pid_location(unique_id):
> >          os.mkdir(directory)
> >      return location
> >  
> > -if __name__ == "__main__":
> > +def main():
> >      try:
> > -        (options, args) = get_opts()
> > +        (options, _args) = get_opts()
> >      except OptParserError as exc:
> >          exc.parser.error(str(exc))
> >          sys.exit(1)
> > @@ -205,9 +203,9 @@ if __name__ == "__main__":
> >      if options.output:
> >          options.output = os.path.abspath(options.output)
> >          try:
> > -            with open(options.output, 'w') as file:
> > -                file.write(config)
> > -        except IOError as e:
> > +            with open(options.output, 'w') as f:
> > +                f.write(config)
> > +        except IOError:
> >              print("Can't write into file %s" % options.output, file=sys.stderr)
> >              sys.exit(1)
> >          if options.stdout:
> > @@ -218,3 +216,6 @@ if __name__ == "__main__":
> >                      })
> >      else:
> >          print(config)
> > +
> > +if __name__ == "__main__":
> > +    main()
> Looks good to me, but I must say my first reaction was "WTH is
> scripts/analog?" Have anybody recently tested it works? And is anybody
> using it?

I think I've only ever used it once. But it is documented at
https://fedoraproject.org/wiki/Anaconda/Logging#Remote_logging_via_virtio
so there may be people using it.

-- 
Brian C. Lane | Anaconda Team | IRC: bcl #anaconda | Port Orchard, WA (PST8PDT)


More information about the anaconda-patches mailing list