Add a "--force" argument to "bin/config done"
Summary: Ref T11922. When we deploy on Saturday I need to rebuild all the cluster indexes, but some instances won't have anything indexed so they won't actually trigger the activity. Add a `--force` flag that just clears an activity even if the activity is not required. Test Plan: Ran `bin/config done reindex --force` several times. Reviewers: chad Reviewed By: chad Maniphest Tasks: T11922 Differential Revision: https://secure.phabricator.com/D16970
This commit is contained in:
		| @@ -10,6 +10,13 @@ final class PhabricatorConfigManagementDoneWorkflow | |||||||
|       ->setSynopsis(pht('Mark a manual upgrade activity as complete.')) |       ->setSynopsis(pht('Mark a manual upgrade activity as complete.')) | ||||||
|       ->setArguments( |       ->setArguments( | ||||||
|         array( |         array( | ||||||
|  |           array( | ||||||
|  |             'name' => 'force', | ||||||
|  |             'short' => 'f', | ||||||
|  |             'help' => pht( | ||||||
|  |               'Mark activities complete even if there is no outstanding '. | ||||||
|  |               'need to complete them.'), | ||||||
|  |           ), | ||||||
|           array( |           array( | ||||||
|             'name' => 'activities', |             'name' => 'activities', | ||||||
|             'wildcard' => true, |             'wildcard' => true, | ||||||
| @@ -18,6 +25,8 @@ final class PhabricatorConfigManagementDoneWorkflow | |||||||
|   } |   } | ||||||
|  |  | ||||||
|   public function execute(PhutilArgumentParser $args) { |   public function execute(PhutilArgumentParser $args) { | ||||||
|  |     $is_force = $args->getArg('force'); | ||||||
|  |  | ||||||
|     $activities = $args->getArg('activities'); |     $activities = $args->getArg('activities'); | ||||||
|     if (!$activities) { |     if (!$activities) { | ||||||
|       throw new PhutilArgumentUsageException( |       throw new PhutilArgumentUsageException( | ||||||
| @@ -29,11 +38,19 @@ final class PhabricatorConfigManagementDoneWorkflow | |||||||
|         'activityType = %s', |         'activityType = %s', | ||||||
|         $type); |         $type); | ||||||
|       if (!$activity) { |       if (!$activity) { | ||||||
|  |         if ($is_force) { | ||||||
|  |           echo tsprintf( | ||||||
|  |             "%s\n", | ||||||
|  |             pht( | ||||||
|  |               'Activity "%s" did not need to be marked as complete.', | ||||||
|  |               $type)); | ||||||
|  |         } else { | ||||||
|           throw new PhutilArgumentUsageException( |           throw new PhutilArgumentUsageException( | ||||||
|             pht( |             pht( | ||||||
|               'Activity "%s" is not currently marked as required, so there '. |               'Activity "%s" is not currently marked as required, so there '. | ||||||
|               'is no need to complete it.', |               'is no need to complete it.', | ||||||
|               $type)); |               $type)); | ||||||
|  |         } | ||||||
|       } else { |       } else { | ||||||
|         $activity->delete(); |         $activity->delete(); | ||||||
|         echo tsprintf( |         echo tsprintf( | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 epriestley
					epriestley