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,59 +165,27 @@ 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))
|
||||||
if requiretty:
|
|
||||||
sudoerstext = file("/etc/sudoers").read()
|
|
||||||
def restore():
|
|
||||||
try: file("/etc/sudoers","w").write(sudoerstext)
|
|
||||||
except OSError,e: raise
|
except OSError,e: raise
|
||||||
|
|
||||||
script = """rm %s
|
try:
|
||||||
save"""%"/".join(requiretty.split("/")[:-1])
|
stderr("Configure /etc/sudoers")
|
||||||
|
newtext = []
|
||||||
stderr("Executing the following reconfiguration script:\n%s",script)
|
clouder = "cloud ALL = NOPASSWD : ALL"
|
||||||
|
hasClouder = False
|
||||||
try:
|
for line in sudoerstext:
|
||||||
returned = augtool < script
|
if "Defaults" in line and "requiretty" in line:
|
||||||
if "Saved 1 file" not in returned.stdout:
|
continue
|
||||||
print returned.stdout + returned.stderr
|
if clouder in line:
|
||||||
|
hasClouder = True
|
||||||
|
newtext.append(line)
|
||||||
|
if not hasClouder:
|
||||||
|
newtext.append(clouder+'\n')
|
||||||
|
file("/etc/sudoers", "w").write(''.join(newtext))
|
||||||
|
except:
|
||||||
restore()
|
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")
|
|
||||||
|
|
||||||
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")
|
bail(E_SUDORECONFIGFAILED,"sudoers reconfiguration failed")
|
||||||
|
|
||||||
ports = "80 8080 8096 8250 9090".split()
|
ports = "80 8080 8096 8250 9090".split()
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user