@ -387,10 +387,29 @@ class OpenRCStrategy(BaseStrategy):
class OpenBSDStrategy ( FileStrategy ) :
class OpenBSDStrategy ( FileStrategy ) :
"""
"""
This is a OpenBSD family Hostname manipulation strategy class - it edits
This is a OpenBSD family Hostname manipulation strategy class - it edits
the / etc / myname file .
the / etc / myname file for the permanent hostname and executes hostname
command for the current hostname .
"""
"""
FILE = ' /etc/myname '
FILE = ' /etc/myname '
COMMAND = " hostname "
def __init__ ( self , module ) :
super ( OpenBSDStrategy , self ) . __init__ ( module )
self . hostname_cmd = self . module . get_bin_path ( self . COMMAND , True )
def get_current_hostname ( self ) :
cmd = [ self . hostname_cmd ]
rc , out , err = self . module . run_command ( cmd )
if rc != 0 :
self . module . fail_json ( msg = " Command failed rc= %d , out= %s , err= %s " % ( rc , out , err ) )
return to_native ( out ) . strip ( )
def set_current_hostname ( self , name ) :
cmd = [ self . hostname_cmd , name ]
rc , out , err = self . module . run_command ( cmd )
if rc != 0 :
self . module . fail_json ( msg = " Command failed rc= %d , out= %s , err= %s " % ( rc , out , err ) )
class SolarisStrategy ( BaseStrategy ) :
class SolarisStrategy ( BaseStrategy ) :