Index: trunk/ippScripts/scripts/ipp_cleanup.pl
===================================================================
--- trunk/ippScripts/scripts/ipp_cleanup.pl	(revision 23277)
+++ trunk/ippScripts/scripts/ipp_cleanup.pl	(revision 23323)
@@ -86,4 +86,19 @@
         &my_die("Unable to perform chiptool: $error_code", "chip", $stage_id, $error_code);
     }
+
+    # if there are no chipProcessedImfiles (@$stdout_buf == 0), the reset the state to 'new'
+    if (@$stdout_buf == 0)  {
+	my $command = "$chiptool -chip_id $stage_id -updaterun -set_state new";
+	$command .= " -dbname $dbname" if defined $dbname;
+
+	my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
+	    run(command => $command, verbose => $verbose);
+	unless ($success) {
+	    $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
+	    &my_die("Unable to perform chiptool: $error_code", "chip", $stage_id, $error_code);
+	}
+	exit 0;
+    }
+
     my $metadata = $mdcParser->parse(join "", @$stdout_buf) or
         &my_die("Unable to parse metadata config doc", "chip", $stage_id, $PS_EXIT_PROG_ERROR);
