remotelogin/oper_sys/linux/shellcommands.py
def change_ntpclient_config(self, ntp_servers, add=True, restart_svc=False):
        """ change ntp.conf file in solaris server

        @param ntp_servers: one or more ntp servers ip or fqdn
        @param add: flag to indicate if we are going to add or delete servers
        @param restart_svc: flag to indicate if we want to restart ntp client service

        """
        if not fdutils.lists.is_sequence(ntp_servers):
            ntp_servers = [ntp_servers]
        ntp_servers = ['server ' + s for s in ntp_servers]
        restart = '' if not restart_svc else '/etc/init.d/ntpd restart'
        if add:
            ntp_servers = '\n'.join(ntp_servers)
            return 'echo -e "{0}" >> /etc/ntp.conf;{1}'.format(ntp_servers, restart)
        else:
            ntp_servers = '|'.join(ntp_servers)
            return "sed '/({0})/ d' /etc/ntp.conf > ntp.conf.bak; " \
                   "mv ntp.conf.bak /etc/ntp.conf;{1} ".format(ntp_servers, restart)
 change ntp.conf file in solaris server

        @param ntp_servers: one or more ntp servers ip or fqdn
        @param add: flag to indicate if we are going to add or delete servers
        @param restart_svc: flag to indicate if we want to restart ntp client service

        
change ntp.conf file in solaris server
change ntp . conf file in solaris server
def change_ntpclient_config(self, ntp_servers, add=True, restart_svc=False):
        if not fdutils.lists.is_sequence(ntp_servers):
            ntp_servers = [ntp_servers]
        ntp_servers = ['server ' + s for s in ntp_servers]
        restart = '' if not restart_svc else '/etc/init.d/ntpd restart'
        if add:
            ntp_servers = '\n'.join(ntp_servers)
            return 'echo -e "{0}" >> /etc/ntp.conf;{1}'.format(ntp_servers, restart)
        else:
            ntp_servers = '|'.join(ntp_servers)
            return "sed '/({0})/ d' /etc/ntp.conf > ntp.conf.bak; " \
                   "mv ntp.conf.bak /etc/ntp.conf;{1} ".format(ntp_servers, restart)
def change_ntpclient_config ( self , ntp_servers , add = True , restart_svc = False ) : if not fdutils . lists . is_sequence ( ntp_servers ) : ntp_servers = [ ntp_servers ] ntp_servers = [ 'server ' + s for s in ntp_servers ] restart = '' if not restart_svc else '/etc/init.d/ntpd restart' if add : ntp_servers = '\n' . join ( ntp_servers ) return 'echo -e "{0}" >> /etc/ntp.conf;{1}' . format ( ntp_servers , restart ) else : ntp_servers = '|' . join ( ntp_servers ) return "sed '/({0})/ d' /etc/ntp.conf > ntp.conf.bak; " "mv ntp.conf.bak /etc/ntp.conf;{1} " . format ( ntp_servers , restart )
change ntp.conf file in solaris server
change ntp . conf file in solaris server
""" change ntp.conf file in solaris server

        @param ntp_servers: one or more ntp servers ip or fqdn
        @param add: flag to indicate if we are going to add or delete servers
        @param restart_svc: flag to indicate if we want to restart ntp client service

        """
self
ntp_servers
one or more ntp servers ip or fqdn
one or more ntp servers ip or fqdn
add
flag to indicate if we are going to add or delete servers
flag to indicate if we are going to add or delete servers
restart_svc
flag to indicate if we want to restart ntp client service
flag to indicate if we want to restart ntp client service