Modify to use one same command to change password
Previously, we use different commands to set admin password for different linux distros. However, we found this can be done by chpasswd command on all distros, so change to use it. Change-Id: I0cbbb4644e12fe8fb773fefbfe112b7bc2b0444d
This commit is contained in:
parent
6bbebe3f3e
commit
6cc8bc12a2
|
@ -116,13 +116,12 @@ class LinuxDist(object):
|
||||||
"""Get network file configuration path."""
|
"""Get network file configuration path."""
|
||||||
pass
|
pass
|
||||||
|
|
||||||
@abc.abstractmethod
|
|
||||||
def get_change_passwd_command(self, admin_password):
|
def get_change_passwd_command(self, admin_password):
|
||||||
"""construct change password command
|
"""construct change password command
|
||||||
|
|
||||||
:admin_password: the password to be changed to
|
:admin_password: the password to be changed to
|
||||||
"""
|
"""
|
||||||
pass
|
return "echo 'root:%s' | chpasswd" % admin_password
|
||||||
|
|
||||||
@abc.abstractmethod
|
@abc.abstractmethod
|
||||||
def _get_cfg_str(self, device, broadcast_v4, gateway_v4, ip_v4,
|
def _get_cfg_str(self, device, broadcast_v4, gateway_v4, ip_v4,
|
||||||
|
@ -187,9 +186,6 @@ class rhel(LinuxDist):
|
||||||
def _get_network_file_path(self):
|
def _get_network_file_path(self):
|
||||||
return '/etc/sysconfig/network-scripts/'
|
return '/etc/sysconfig/network-scripts/'
|
||||||
|
|
||||||
def get_change_passwd_command(self, admin_password):
|
|
||||||
return 'echo %s|passwd --stdin root' % admin_password
|
|
||||||
|
|
||||||
def _get_cfg_str(self, device, broadcast_v4, gateway_v4, ip_v4,
|
def _get_cfg_str(self, device, broadcast_v4, gateway_v4, ip_v4,
|
||||||
netmask_v4, address_read, subchannels):
|
netmask_v4, address_read, subchannels):
|
||||||
cfg_str = 'DEVICE=\"' + device + '\"\n'
|
cfg_str = 'DEVICE=\"' + device + '\"\n'
|
||||||
|
@ -400,9 +396,6 @@ class sles11(sles):
|
||||||
'service network restart',
|
'service network restart',
|
||||||
'cio_ignore -u'))
|
'cio_ignore -u'))
|
||||||
|
|
||||||
def get_change_passwd_command(self, admin_password):
|
|
||||||
return 'echo %s|passwd --stdin root' % admin_password
|
|
||||||
|
|
||||||
|
|
||||||
class sles12(sles):
|
class sles12(sles):
|
||||||
def get_znetconfig_contents(self):
|
def get_znetconfig_contents(self):
|
||||||
|
@ -417,9 +410,6 @@ class sles12(sles):
|
||||||
'znetconf -A',
|
'znetconf -A',
|
||||||
'cio_ignore -u'))
|
'cio_ignore -u'))
|
||||||
|
|
||||||
def get_change_passwd_command(self, admin_password):
|
|
||||||
return "echo 'root:%s' | chpasswd" % admin_password
|
|
||||||
|
|
||||||
def get_scp_string(self, root, fcp, wwpn, lun):
|
def get_scp_string(self, root, fcp, wwpn, lun):
|
||||||
return ("=root=%(root)s zfcp.allow_lun_scan=0 "
|
return ("=root=%(root)s zfcp.allow_lun_scan=0 "
|
||||||
"zfcp.device=0.0.%(fcp)s,0x%(wwpn)s,0x%(lun)s") % {
|
"zfcp.device=0.0.%(fcp)s,0x%(wwpn)s,0x%(lun)s") % {
|
||||||
|
@ -556,9 +546,7 @@ class ubuntu(LinuxDist):
|
||||||
|
|
||||||
|
|
||||||
class ubuntu16(ubuntu):
|
class ubuntu16(ubuntu):
|
||||||
|
pass
|
||||||
def get_change_passwd_command(self, admin_password):
|
|
||||||
return "echo 'root:%s' | chpasswd" % admin_password
|
|
||||||
|
|
||||||
|
|
||||||
class ListDistManager(object):
|
class ListDistManager(object):
|
||||||
|
|
Loading…
Reference in New Issue