#!/usr/bin/perl
#
# Copyright (c) 2018-2020 AT&T Intellectual Property.
# All rights reserved.
#
# SPDX-License-Identifier: GPL-2.0-only
#

use strict;
use warnings;

use lib "/opt/vyatta/share/perl5";
use Vyatta::Config;
use Vyatta::Login::TacplusServer;

my $exists = Vyatta::Login::TacplusServer::check_tacplus_status();

if ($exists) {
    my $config = Vyatta::Config->new();

    if (   $config->isChanged($Vyatta::Login::TacplusServer::TACACS_GLOBAL_PATH)
        || $config->isChanged($Vyatta::Login::TacplusServer::TACACS_OFFLINE_TIMER)
        || $config->isChanged($Vyatta::Login::TacplusServer::TACACS_LOG_PATH) )
    {
        Vyatta::Login::TacplusServer::setup_tacacs_path("changed");
        Vyatta::Login::TacplusServer::setup_tacplusd( "changed", $exists );
    }
}
