[tor-commits] [ooni-probe/master] Fixes Issue 300 Endless recursion 'Configuration file does not exist'
art at torproject.org
art at torproject.org
Wed Apr 30 17:30:23 UTC 2014
commit a76b3b049f43e237fe6c958212399674752ec368
Author: olafmk <mail at olaf-koehler.com>
Date: Fri Apr 11 18:17:24 2014 +0200
Fixes Issue 300 Endless recursion 'Configuration file does not exist'
---
HACKING | 10 +++++-----
ooni/settings.py | 7 ++++---
2 files changed, 9 insertions(+), 8 deletions(-)
diff --git a/HACKING b/HACKING
index aad7ebb..89b9edf 100644
--- a/HACKING
+++ b/HACKING
@@ -45,11 +45,6 @@ Code Structure
- ooni/
Contains the main ooni probe comand line client
-- ooni/config.py
- Parts of the code related to parsing OONI
- configuration files and making them accessible
- to other components of the software.
-
- ooni/inputunit.py
In here we have functions related to the creation of input
units. Input units are how the inputs to be fed to tests are
@@ -75,6 +70,11 @@ Code Structure
Handles running ooni.nettests as well as
ooni.plugoo.tests.OONITests.
+- ooni/settings.py
+ Parts of the code related to parsing OONI
+ configuration files and making them accessible
+ to other components of the software.
+
- ooni/otime.py
Generation of timestamps, time conversions and all the rest
diff --git a/ooni/settings.py b/ooni/settings.py
index 97e5297..adeba85 100644
--- a/ooni/settings.py
+++ b/ooni/settings.py
@@ -66,13 +66,14 @@ class OConfig(object):
def _create_config_file(self):
sample_config_file = os.path.join(self.data_directory,
'ooniprobe.conf.sample')
- target_config_file = os.path.join(self.ooni_home,
- 'ooniprobe.conf')
+ target_config_file = self.config_file
print "Creating it for you in '%s'." % target_config_file
usr_share_path = '/usr/share'
if hasattr(sys, 'real_prefix'):
usr_share_path = os.path.abspath(os.path.join(sys.prefix, 'share'))
-
+
+ if not os.path.isdir(os.path.dirname(target_config_file)):
+ os.mkdir(os.path.dirname(target_config_file))
with open(sample_config_file) as f:
with open(target_config_file, 'w+') as w:
for line in f:
More information about the tor-commits
mailing list