conman: Make sure all directories monitored with inotify exist.

Change-Id: I6e91099cd8ab912db4a30a19be5fc0815b3f92e8
diff --git a/conman/connection_manager.py b/conman/connection_manager.py
index c484d4a..38c8b51 100755
--- a/conman/connection_manager.py
+++ b/conman/connection_manager.py
@@ -209,6 +209,13 @@
 
     self._wlan_configuration = {}
 
+    # Make sure all necessary directories exist.
+    for directory in (self._status_dir, self._interface_status_dir,
+                      self._moca_status_dir):
+      if not os.path.exists(directory):
+        os.makedirs(directory)
+        logging.info('Created monitored directory: %s', directory)
+
     # It is very important that we know whether ethernet is up.  So if the
     # ethernet file doesn't exist for any reason when conman starts, check
     # explicitly.
diff --git a/conman/connection_manager_test.py b/conman/connection_manager_test.py
index afc5c9a..0903c15 100755
--- a/conman/connection_manager_test.py
+++ b/conman/connection_manager_test.py
@@ -368,6 +368,9 @@
         moca_status_dir = tempfile.mkdtemp()
         wpa_control_interface = tempfile.mkdtemp()
 
+        # Test that missing directories are created by ConnectionManager.
+        shutil.rmtree(status_dir)
+
         c = ConnectionManager(status_dir=status_dir,
                               moca_status_dir=moca_status_dir,
                               wpa_control_interface=wpa_control_interface,