conman:  Don't export TRYING_OPEN status at startup.

The wcli0 status reflected provisioning having been started when the
provisioning ratchet is created.  The call to set step 0's status has
been moved out of reset (which is called by Ratchet.__init__) into
start, which calls reset and is only called by ConnectionManager when
it actually wants to start provisioning.

Change-Id: Iec3ccce28be61cf5ac12b9f1e21c37f75eea2796
diff --git a/conman/connection_manager.py b/conman/connection_manager.py
index c27ef8d..d0b0838 100755
--- a/conman/connection_manager.py
+++ b/conman/connection_manager.py
@@ -931,7 +931,7 @@
   def start_provisioning(self, wifi):
     wifi.set_gateway_ip(None)
     wifi.set_subnet(None)
-    wifi.provisioning_ratchet.reset()
+    wifi.provisioning_ratchet.start()
 
   def provisioning_failed(self, wifi):
     try:
diff --git a/conman/connection_manager_test.py b/conman/connection_manager_test.py
index a64ab79..d6fb238 100755
--- a/conman/connection_manager_test.py
+++ b/conman/connection_manager_test.py
@@ -658,6 +658,9 @@
   # correct; more thorough tests are in bridge_test in interface_test.py.
   acs_autoprov_filepath = os.path.join(c._tmp_dir, 'acs_autoprovisioning')
 
+  # Each Wifi's provisioning ratchet has beeen created, but not started.
+  wvtest.WVFAIL(c.has_status_files([status.P.TRYING_OPEN]))
+
   # Initially, there is ethernet access (via explicit check of ethernet status,
   # rather than the interface status file).
   wvtest.WVPASS(c.acs())
diff --git a/conman/ratchet.py b/conman/ratchet.py
index 7873c39..350ed47 100644
--- a/conman/ratchet.py
+++ b/conman/ratchet.py
@@ -140,9 +140,12 @@
     for step in self.steps:
       step.reset()
       self._set_step_status(step, False)
-    self._set_current_step_status(True)
     super(Ratchet, self).reset()
 
+  def start(self):
+    self.reset()
+    self._set_current_step_status(True)
+
   # Override check rather than evaluate because we don't want the Ratchet to
   # time out unless one of its steps does.
   def check(self):
diff --git a/conman/ratchet_test.py b/conman/ratchet_test.py
index 10c10ab..97f7c94 100755
--- a/conman/ratchet_test.py
+++ b/conman/ratchet_test.py
@@ -103,6 +103,10 @@
     # Test that timeouts are not just summed, but start whenever the previous
     # step completed.
     wvtest.WVPASSEQ(r._current_step, 0)  # pylint: disable=protected-access
+    wvtest.WVFAIL(os.path.isfile(os.path.join(status_export_path, 'X')))
+    wvtest.WVFAIL(os.path.isfile(os.path.join(status_export_path, 'Y')))
+    wvtest.WVFAIL(os.path.isfile(os.path.join(status_export_path, 'Z')))
+    r.start()
     wvtest.WVPASS(os.path.isfile(os.path.join(status_export_path, 'X')))
     wvtest.WVFAIL(os.path.isfile(os.path.join(status_export_path, 'Y')))
     wvtest.WVFAIL(os.path.isfile(os.path.join(status_export_path, 'Z')))