def finalize_policy(new_policy, agent_identity, new_policy_users, missing)
      manage_existing_users(new_policy_users)

      user_lines = login_users_to_authorized_keys(new_policy_users)

      InstanceState.login_policy = new_policy

      write_keys_file(user_lines, RIGHTSCALE_KEYS_FILE, { :user => 'rightscale', :group => 'rightscale' })

      unless @login_policy_tag_set
        tags = [RESTRICTED_TAG]
        AgentTagManager.instance.add_tags(tags)
        @login_policy_tag_set = true
      end

      # Schedule a timer to handle any expiration that is planned to happen in the future
      schedule_expiry(new_policy, agent_identity)

      # Yield a human-readable description of the policy, e.g. for an audit entry
      yield describe_policy(new_policy_users, new_policy_users.select { |u| u.superuser }, missing)

      true
    end
def finalize_policy(new_policy, agent_identity, new_policy_users, missing)
      manage_existing_users(new_policy_users)

      user_lines = login_users_to_authorized_keys(new_policy_users)

      InstanceState.login_policy = new_policy

      write_keys_file(user_lines, RIGHTSCALE_KEYS_FILE, { :user => 'rightscale', :group => 'rightscale' })

      unless @login_policy_tag_set
        tags = [RESTRICTED_TAG]
        AgentTagManager.instance.add_tags(tags)
        @login_policy_tag_set = true
      end

      # Schedule a timer to handle any expiration that is planned to happen in the future
      schedule_expiry(new_policy, agent_identity)

      # Yield a human-readable description of the policy, e.g. for an audit entry
      yield describe_policy(new_policy_users, new_policy_users.select { |u| u.superuser }, missing)

      true
    end
Manipulates the authorized_keys file to match the given login policy
 Schedules expiration of users from policy and audits the policy in
 a human-readable format

 == Parameters:
 @param [RightScale::LoginPolicy] New login policy
 @param [String] Serialized instance agent identity
 @param [Array<LoginUsers>] Array of updated users
 @param [Array<LoginUsers>] Array of users with public keys missing

 == Yields:
 @yield [String] audit content yielded to the block provided

 == Returns:
 @return [TrueClass] always returns true