Page Menu
Home
DevCentral
Search
Configure Global Search
Log In
Files
F3770213
nano.py
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
nano.py
View Options
# -*- 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
Details
Attached
Mime Type
text/x-python
Expires
Mon, Nov 25, 19:24 (8 h, 4 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2260127
Default Alt Text
nano.py (1 KB)
Attached To
Mode
rOPS Nasqueron Operations
Attached
Detach File
Event Timeline
Log In to Comment