mirror of
				https://github.com/apache/cloudstack.git
				synced 2025-10-26 08:42:29 +01:00 
			
		
		
		
	Bug 9542 - install on CentOS 5.6 does not work
get rid of augtool from setup script nstall on CentOS 5.6 does not work# .wscript_build.swp
This commit is contained in:
		
							parent
							
								
									160b2e1114
								
							
						
					
					
						commit
						eaf6468144
					
				| @ -135,7 +135,6 @@ updatercd = Command("update-rc.d") | |||||||
| ufw = Command("ufw") | ufw = Command("ufw") | ||||||
| iptables = Command("/sbin/iptables") | iptables = Command("/sbin/iptables") | ||||||
| iptables_save = Command("/sbin/iptables-save") | iptables_save = Command("/sbin/iptables-save") | ||||||
| augtool = Command("augtool") |  | ||||||
| kvmok = Command("kvm-ok") | kvmok = Command("kvm-ok") | ||||||
| ifconfig = Command("/sbin/ifconfig") | ifconfig = Command("/sbin/ifconfig") | ||||||
| uuidgen = Command("uuidgen") | uuidgen = Command("uuidgen") | ||||||
| @ -166,60 +165,28 @@ try: | |||||||
| except CalledProcessError,e: | except CalledProcessError,e: | ||||||
| 	pass | 	pass | ||||||
| 
 | 
 | ||||||
| requiretty = augtool._print("/files/etc/sudoers/Defaults/requiretty").stdout.strip() | sudoerstext = file("/etc/sudoers").readlines() | ||||||
| sudoeruser = augtool.match("/files/etc/sudoers/spec/user","@MSUSER@").stdout.strip() | def restore(): | ||||||
|  | 	try: file("/etc/sudoers","w").write(''.join(sudoerstext)) | ||||||
|  | 	except OSError,e: raise | ||||||
| 
 | 
 | ||||||
| if requiretty: | try: | ||||||
| 	sudoerstext = file("/etc/sudoers").read() | 	stderr("Configure /etc/sudoers") | ||||||
| 	def restore(): | 	newtext = [] | ||||||
| 		try: file("/etc/sudoers","w").write(sudoerstext) | 	clouder = "cloud ALL = NOPASSWD : ALL" | ||||||
| 		except OSError,e: raise | 	hasClouder = False | ||||||
| 		 | 	for line in sudoerstext: | ||||||
| 	script = """rm %s | 		if "Defaults" in line and "requiretty" in line: | ||||||
| save"""%"/".join(requiretty.split("/")[:-1]) | 			continue | ||||||
| 	 | 		if clouder in line: | ||||||
| 	stderr("Executing the following reconfiguration script:\n%s",script) | 			hasClouder = True | ||||||
| 	 | 		newtext.append(line) | ||||||
| 	try: | 	if not hasClouder: | ||||||
| 		returned = augtool < script | 		newtext.append(clouder+'\n') | ||||||
| 		if "Saved 1 file" not in returned.stdout: | 	file("/etc/sudoers", "w").write(''.join(newtext)) | ||||||
| 			print returned.stdout + returned.stderr | except: | ||||||
| 			restore() | 	restore() | ||||||
| 			bail(E_SUDORECONFIGFAILED,"sudoers reconfiguration failed.") | 	bail(E_SUDORECONFIGFAILED,"sudoers reconfiguration failed") | ||||||
| 		else: |  | ||||||
| 			stderr("sudoers reconfiguration complete") |  | ||||||
| 	except CalledProcessError,e: |  | ||||||
| 		restore() |  | ||||||
| 		print e.stdout + e.stderr |  | ||||||
| 		bail(E_SUDORECONFIGFAILED,"sudoers reconfiguration failed") |  | ||||||
| 
 |  | ||||||
| if "@MSUSER@" not in sudoeruser: |  | ||||||
| 	sudoerstext = file("/etc/sudoers").read() |  | ||||||
| 	def restore(): |  | ||||||
| 		try: file("/etc/sudoers","w").write(sudoerstext) |  | ||||||
| 		except OSError,e: raise |  | ||||||
| 		 |  | ||||||
| 	script = """ins spec after /files/etc/sudoers/spec[last()] |  | ||||||
| set /files/etc/sudoers/spec[last()]/user @MSUSER@ |  | ||||||
| set /files/etc/sudoers/spec[last()]/host_group/host ALL |  | ||||||
| set /files/etc/sudoers/spec[last()]/host_group/command ALL |  | ||||||
| set /files/etc/sudoers/spec[last()]/host_group/command/tag NOPASSWD |  | ||||||
| save""" |  | ||||||
| 	 |  | ||||||
| 	stderr("Executing the following reconfiguration script:\n%s",script) |  | ||||||
| 	 |  | ||||||
| 	try: |  | ||||||
| 		returned = augtool < script |  | ||||||
| 		if "Saved 1 file" not in returned.stdout: |  | ||||||
| 			print returned.stdout + returned.stderr |  | ||||||
| 			restore() |  | ||||||
| 			bail(E_SUDORECONFIGFAILED,"sudoers reconfiguration failed.") |  | ||||||
| 		else: |  | ||||||
| 			stderr("sudoers reconfiguration complete") |  | ||||||
| 	except CalledProcessError,e: |  | ||||||
| 		restore() |  | ||||||
| 		print e.stdout + e.stderr |  | ||||||
| 		bail(E_SUDORECONFIGFAILED,"sudoers reconfiguration failed") |  | ||||||
| 
 | 
 | ||||||
| ports = "80 8080 8096 8250 9090".split() | ports = "80 8080 8096 8250 9090".split() | ||||||
| if Fedora or CentOS: | if Fedora or CentOS: | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user