[master 1/6] analog: handle a config file we can't open.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



---
 scripts/analog |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/scripts/analog b/scripts/analog
index 7f2ba02..b392acd 100755
--- a/scripts/analog
+++ b/scripts/analog
@@ -157,8 +157,12 @@ if __name__ == "__main__":
     options.output = os.path.abspath(options.output)
     config = generate_rsyslog_config(options.port, directory)
     if options.output:
-        with open(options.output, 'w') as file:
-            file.write(config)
+        try:
+            with open(options.output, 'w') as file:
+                file.write(config)
+        except IOError as e:
+            print >> sys.stderr, "Can't write into file %s" % options.output
+            sys.exit(1)
         if options.stdout:
             pid = pid_location(options.port)
             print HINT % {
-- 
1.6.6

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list

[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux