Browse Source

Fixed issue in PHP, Added Swap creation

bugfixes
gau1991 10 years ago
parent
commit
d32559081e
  1. 13
      ee/cli/plugins/stack.py
  2. 2
      ee/core/addswap.py
  3. 95
      ee/core/aptget.py
  4. 5
      ee/core/fileutils.py
  5. 5
      ee/core/variables.py

13
ee/cli/plugins/stack.py

@ -297,6 +297,19 @@ class EEStackController(CementBaseController):
" /etc/php5/fpm/pool.d/www.conf")
config.write(configfile)
# Generate /etc/php5/fpm/pool.d/debug.conf
EEFileUtils.copyfile(self, "/etc/php5/fpm/pool.d/www.conf",
"/etc/php5/fpm/pool.d/debug.conf")
EEFileUtils.searchreplace(self, "/etc/php5/fpm/pool.d/"
"debug.conf", "[www]", "[debug]")
config = configparser.ConfigParser()
config.read('/etc/php5/fpm/pool.d/debug.conf')
config['debug']['listen'] = '127.0.0.1:9001'
with open('/etc/php5/fpm/pool.d/debug.conf', 'w') as confifile:
self.app.log.debug("writting PHP5 configartion into "
" /etc/php5/fpm/pool.d/debug.conf")
config.write(confifile)
if set(EEVariables.ee_mysql).issubset(set(apt_packages)):
config = configparser.ConfigParser()
config.read('/etc/mysql/my.cnf')

2
ee/core/addswap.py

@ -21,4 +21,4 @@ class EESwap():
EEFileUtils.chmod(self, "/ee-swapfile", 0o600)
EEShellExec.cmd_exec(self, "swapon /ee-swapfile")
with open("/etc/fstab", "a") as swap_file:
myfile.write("/ee-swapfile\tnone\tswap\tsw\t0 0")
swap_file.write("/ee-swapfile\tnone\tswap\tsw\t0 0")

95
ee/core/aptget.py

@ -161,52 +161,61 @@ class EEAptGet():
.format(package_name=package.name))
continue
if package.marked_delete:
my_selected_packages.append(package.name)
# Mark for deletion the first package, to fire up
# auto_removable Purge?
if purge:
package.mark_delete(purge=True)
else:
package.mark_delete(purge=False)
continue
else:
my_selected_packages.append(package.name)
# How logic works:
# 1) We loop trough dependencies's dependencies and add them to
# the list.
# 2) We sequentially remove every package in list
# - via is_auto_installed we check if we can safely remove it
deplist = []
onelevel = __dependencies_loop(cache, deplist, package,
onelevel=True)
# Mark for deletion the first package, to fire up auto_removable
# Purge?
if purge:
package.mark_delete(purge=True)
else:
package.mark_delete(purge=False)
# Also ensure we remove AT LEAST the first level of dependencies
# (that is, the actual package's dependencies).
if auto:
markedauto = []
for pkg in onelevel:
if (not pkg.marked_install and pkg.is_installed
and not pkg.is_auto_installed):
pkg.mark_auto()
markedauto.append(pkg)
for pkg in deplist:
if (not pkg.marked_install and pkg.is_installed and
pkg.is_auto_removable):
# Purge?
if purge:
pkg.mark_delete(purge=True)
else:
pkg.mark_delete(purge=False)
# Restore auted items
for pkg in markedauto:
if not pkg.marked_delete:
pkg.mark_auto(False)
else:
# We need to ensure that the onelevel packages are not marked
# as automatically installed, otherwise the user may drop
# them via autoremove or aptitude.
for pkg in onelevel:
if pkg.is_installed and pkg.is_auto_installed:
pkg.mark_auto(auto=False)
print(my_selected_packages)
# How logic works:
# 1) We loop trough dependencies's dependencies and add them to
# the list.
# 2) We sequentially remove every package in list
# - via is_auto_installed we check if we can safely remove it
deplist = []
onelevel = __dependencies_loop(cache, deplist, package,
onelevel=True)
# Mark for deletion the first package, to fire up
# auto_removable Purge?
if purge:
package.mark_delete(purge=True)
else:
package.mark_delete(purge=False)
# Also ensure we remove AT LEAST the first level of
# dependencies (that is, the actual package's dependencies).
if auto:
markedauto = []
for pkg in onelevel:
if (not pkg.marked_install and pkg.is_installed
and not pkg.is_auto_installed):
pkg.mark_auto()
markedauto.append(pkg)
for pkg in deplist:
if (not pkg.marked_install and pkg.is_installed and
pkg.is_auto_removable):
# Purge?
if purge:
pkg.mark_delete(purge=True)
else:
pkg.mark_delete(purge=False)
# Restore auted items
for pkg in markedauto:
if not pkg.marked_delete:
pkg.mark_auto(False)
else:
# We need to ensure that the onelevel packages are not
# marked as automatically installed, otherwise the user may
# drop them via autoremove or aptitude.
for pkg in onelevel:
if pkg.is_installed and pkg.is_auto_installed:
pkg.mark_auto(auto=False)
# Check if packages available for remove/update.
if cache.delete_count > 0:

5
ee/core/fileutils.py

@ -47,7 +47,7 @@ class EEFileUtils():
.format(e.errno, e.strerror))
sys.exit(1)
def copyfile(self, src, dst):
def copyfile(self, src, dest):
try:
shutil.copy2(src, dest)
except shutil.Error as e:
@ -58,7 +58,8 @@ class EEFileUtils():
def searchreplace(self, fnm, sstr, rstr):
try:
for line in fileinput.input(fnm, inplace=True):
print(line.replace(textToSearch, textToReplace), end='')
print(line.replace(sstr, rstr), end='')
fileinput.close()
except Exception as e:
print('Error : {0}'.format(e))

5
ee/core/variables.py

@ -52,8 +52,9 @@ class EEVariables():
elif ee_platform_codename == 'wheezy':
ee_php_repo = ("deb http://packages.dotdeb.org {codename}-php55 all"
.format(codename=ee_platform_codename))
ee_php = ["php5-curl", "php5-gd", "php5-cli", "php5-fpm", "php5-imap",
"php5-mcrypt", "php5-xdebug"]
ee_php = ["php5-fpm", "php5-curl", "php5-gd", "php5-cli", "php5-imap",
"php5-mcrypt", "php5-xdebug", "php5-common", "php5-readline",
"php5-mysql"]
# MySQL repo and packages
ee_mysql_repo = ("deb http://repo.percona.com/apt {codename} main"

Loading…
Cancel
Save