Page MenuHomeDevCentral

nano.py
No OneTemporary

# -*- coding: utf-8 -*-
# -------------------------------------------------------------
# Salt — Nano state
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Project: Nasqueron
# Created: 2020-02-09
# Description: Allow to generate a nano configuration
# License: BSD-2-Clause
# -------------------------------------------------------------
def config_autogenerated(
name="/etc/nanorc", nanorc_dir="/usr/share/nano", extra_settings=[]
):
ret = {"name": name, "result": False, "changes": {}, "comment": ""}
if __salt__["nano.check_rc_up_to_date"](
name=name, nanorc_dir=nanorc_dir, extra_settings=extra_settings
):
ret["result"] = True
ret["comment"] = "{0} is already up to date".format(name)
return ret
if __opts__["test"]:
ret["result"] = None
ret["comment"] = "State nano will write config file {0}".format(name)
return ret
try:
__salt__["nano.config_autogenerate"](
name=name, nanorc_dir=nanorc_dir, extra_settings=extra_settings
)
except Exception as e:
ret["comment"] = e
return ret
ret["comment"] = "Configuration written"
ret["result"] = True
return ret

File Metadata

Mime Type
text/x-python
Expires
Mon, Nov 25, 11:56 (1 d, 9 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2260127
Default Alt Text
nano.py (1 KB)

Event Timeline