Page Menu
Home
DevCentral
Search
Configure Global Search
Log In
Files
F4793110
cleanup.sls
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
cleanup.sls
View Options
#!py
# -------------------------------------------------------------
# Salt — Provision PHP websites — php-fpm pools
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Project: Nasqueron
# License: Trivial work, not eligible to copyright
# Description: When a site is declared to be served by
# an instance, pools from other instances
# should be deleted if they exist.
#
# That allows to move pools among instances.
# -------------------------------------------------------------
def get_etc_dir()
:
if __grains__['os'] == 'FreeBSD'
:
return "/usr/local/etc"
return "/etc"
def files_to_delete_if_they_exist()
:
files = []
etc_dir = get_etc_dir()
for instance in __pillar__['php_fpm_instances']
:
files.extend([etc_dir + "/php-fpm.d/" + instance + "-pools/" + site['user'] + ".conf"
for _, site in __pillar__['web_php_sites'].items()
if site['php-fpm'] != instance])
return files
def run()
:
config = {}
# Task
:
delete php-fpm stale files
for file in files_to_delete_if_they_exist()
:
config[file] = {"file.absent"
:
[]
}
return config
File Metadata
Details
Attached
Mime Type
text/x-python
Expires
Fri, Feb 28, 21:39 (1 d, 7 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2436323
Default Alt Text
cleanup.sls (1 KB)
Attached To
Mode
rOPS Nasqueron Operations
Attached
Detach File
Event Timeline
Log In to Comment