File tree Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -15,6 +15,9 @@ const (
1515 InventoryPolicyStrict = "strict"
1616 InventoryPolicyAdopt = "adopt"
1717 InventoryPolicyForceAdopt = "force-adopt"
18+ StatusPolicyFlag = "status-policy"
19+ StatusPolicyAll = "all"
20+ StatusPolicyNone = "none"
1821)
1922
2023// ConvertPropagationPolicy converts a propagationPolicy described as a
@@ -47,6 +50,19 @@ func ConvertInventoryPolicy(policy string) (inventory.Policy, error) {
4750 }
4851}
4952
53+ // ConvertStatusPolicy converts as status policy described as a string to a
54+ // StatusPolicy type that is passed into the Applier.
55+ func ConvertStatusPolicy (policy string ) (inventory.StatusPolicy , error ) {
56+ switch policy {
57+ case StatusPolicyNone :
58+ return inventory .StatusPolicyNone , nil
59+ case StatusPolicyAll :
60+ return inventory .StatusPolicyAll , nil
61+ default :
62+ return inventory .StatusPolicyAll , fmt .Errorf ("status policy must be one of none, all" )
63+ }
64+ }
65+
5066// PathFromArgs returns the path which is a positional arg from args list
5167// returns "-" if there is length of args is 0, which implies no path is provided
5268func PathFromArgs (args []string ) string {
You can’t perform that action at this time.
0 commit comments