1111from packstack .installer import basedefs , output_messages
1212from packstack .installer .exceptions import ScriptRuntimeError
1313
14- from packstack .modules .ospluginutils import ( gethostlist ,
15- manifestfiles ,
14+ from packstack .modules .common import filtered_hosts
15+ from packstack . modules . ospluginutils import ( manifestfiles ,
1616 scan_puppet_logfile ,
1717 validate_puppet_logfile )
1818
@@ -46,15 +46,6 @@ def initConfig(controllerObject):
4646 controller .addGroup (groupDict , paramsList )
4747
4848
49- def getinstallhostlist (conf ):
50- list = []
51- exclude_list = map (str .strip , conf ['EXCLUDE_SERVERS' ].split (',' ))
52- for host in gethostlist (conf ):
53- if host not in exclude_list :
54- list .append (host )
55- return list
56-
57-
5849def initSequences (controller ):
5950 puppetpresteps = [
6051 {'title' : 'Clean Up' , 'functions' :[runCleanup ]},
@@ -76,7 +67,7 @@ def runCleanup(config):
7667
7768
7869def installdeps (config ):
79- for hostname in getinstallhostlist ( controller . CONF ):
70+ for hostname in filtered_hosts ( config ):
8071 server = utils .ScriptRunner (hostname )
8172 for package in ("puppet" , "openssh-clients" , "tar" , "nc" ):
8273 server .append ("rpm -q %s || yum install -y %s" % (package , package ))
@@ -100,9 +91,8 @@ def copyPuppetModules(config):
10091 tar_opts = ""
10192 if platform .linux_distribution ()[0 ] == "Fedora" :
10293 tar_opts += "--exclude create_resources "
103- for hostname in getinstallhostlist ( controller . CONF ):
94+ for hostname in filtered_hosts ( config ):
10495 host_dir = controller .temp_map [hostname ]
105- puppet_dir = os .path .join (host_dir , basedefs .PUPPET_MANIFEST_RELATIVE )
10696 server .append ("cd %s/puppet" % basedefs .DIR_PROJECT_DIR )
10797 # copy Packstack facts
10898 server .append ("tar %s --dereference -cpzf - facts | "
@@ -165,7 +155,7 @@ def waitforpuppet(currently_running):
165155 if hasattr (sys .stdout , "isatty" ) and sys .stdout .isatty ():
166156 sys .stdout .write (("\r " ).ljust (45 + log_len ))
167157
168- except ScriptRuntimeError , e :
158+ except ScriptRuntimeError :
169159 # the test raises an exception if the file doesn't exist yet
170160 # TO-DO: We need to start testing 'e' for unexpected exceptions
171161 time .sleep (3 )
@@ -176,7 +166,7 @@ def waitforpuppet(currently_running):
176166
177167 # check the log file for errors
178168 validate_puppet_logfile (log )
179- sys .stdout .write (("\r %s : " % log_file ).ljust (basedefs . SPACE_LEN ))
169+ sys .stdout .write (("\r %s : " % log_file ).ljust (space_len ))
180170 print ("[ " + utils .color_text (output_messages .INFO_DONE , 'green' ) + " ]" )
181171
182172
@@ -191,7 +181,7 @@ def applyPuppetManifest(config):
191181 waitforpuppet (currently_running )
192182 lastmarker = marker
193183
194- for hostname in getinstallhostlist ( controller . CONF ):
184+ for hostname in filtered_hosts ( config ):
195185 if "%s_" % hostname not in manifest :
196186 continue
197187
0 commit comments