class ChefCLI::PolicyfileServices::CleanPolicies

def orphaned_policies

def orphaned_policies
  policy_lister.policies_by_name.keys.inject([]) do |orphans, policy_name|
    orphans + policy_lister.orphaned_revisions(policy_name).map do |revision_id|
      Orphan.new(policy_name, revision_id)
    end
  end
rescue => e
  raise PolicyfileCleanError.new("Failed to list policies for cleaning.", e)
end