got rid of comments in supervisor, updated edit method in nginx

This commit is contained in:
Ronny Abraham 2018-10-25 20:45:11 +03:00
parent a3fcded489
commit 257de6483d
2 changed files with 38 additions and 13 deletions

View file

@ -58,25 +58,54 @@ def restart():
@task
def edit(location='conf'):
def edit(param='help'):
"""
calls up mvim on the Nginx conf file
"""
configuration = env.config
conf_path = os.path.join(
config_file_path = os.path.join(
configuration.nginx.sites_available,
configuration.nginx.conf.name)
if location == 'conf':
remote_path = conf_path
elif location == 'log.error' or location == 'log':
remote_path = configuration.logging.nginx.error
elif location == 'log.access':
remote_path = configuration.logging.nginx.access
locations = {
'conf': {
'path': config_file_path,
'desc': "nginx configuration file",
},
'log.error': {
'path': configuration.logging.nginx.error,
'desc': "nginx error log file",
},
'log.access': {
'path': configuration.logging.nxing.access,
'desc': "nginx access log file",
},
}
if param in locations.keys():
remote_path = locations[param]['path']
maintenance_edit(remote_path=remote_path)
else:
# if param == 'help':
print("""
"fab nginx.edit" automates editing files important to nginx whether
locally or remotely
to use this you must pass one of the editable locations in as a
parameter
currently editable locations are:
""")
for k_loc in locations.keys():
print("\t{0: <20} - {1}".format(k_loc, locations[k_loc]['desc']))
return
@task

View file

@ -138,10 +138,6 @@ def edit(param='help'):
},
}
print("\n\n\nlocations: %s\n\n\n" % locations)
print("\n\n\nlocations.keys: %s\n\n\n" % locations.keys())
print("\n\n\nparam: %s\n\n\n" % param)
if param in locations.keys():
remote_path = locations[param]['path']
maintenance_edit(remote_path=remote_path)