2024-11-27 17:19:30 +01:00
|
|
|
"""
|
|
|
|
|
Silique (https://www.silique.fr)
|
2026-01-09 08:46:16 +01:00
|
|
|
Copyright (C) 2022-2026
|
2026-01-14 14:25:35 +01:00
|
|
|
|
2024-11-27 17:19:30 +01:00
|
|
|
This program is free software: you can redistribute it and/or modify it
|
|
|
|
|
under the terms of the GNU Lesser General Public License as published by the
|
|
|
|
|
Free Software Foundation, either version 3 of the License, or (at your
|
|
|
|
|
option) any later version.
|
|
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful, but WITHOUT
|
|
|
|
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
|
|
|
|
FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
|
|
|
|
|
details.
|
|
|
|
|
|
|
|
|
|
You should have received a copy of the GNU Lesser General Public License
|
|
|
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
"""
|
2026-01-14 14:25:35 +01:00
|
|
|
from .ansible import Inventory
|
2025-04-09 21:31:38 +02:00
|
|
|
from .__version__ import __version__
|
2024-11-27 17:19:30 +01:00
|
|
|
|
|
|
|
|
|
2026-01-14 14:25:35 +01:00
|
|
|
class RougailOutputAnsible:
|
2024-12-02 20:22:27 +01:00
|
|
|
output_name = "ansible"
|
|
|
|
|
|
2024-11-27 17:19:30 +01:00
|
|
|
def __init__(
|
|
|
|
|
self,
|
|
|
|
|
config: "Config",
|
2024-12-02 20:22:27 +01:00
|
|
|
*,
|
2024-11-27 17:19:30 +01:00
|
|
|
rougailconfig: "RougailConfig" = None,
|
2024-12-02 20:22:27 +01:00
|
|
|
**kwargs,
|
2024-11-27 17:19:30 +01:00
|
|
|
) -> None:
|
2026-01-14 14:25:35 +01:00
|
|
|
self.config = config
|
|
|
|
|
self.rougailconfig = rougailconfig
|
|
|
|
|
self.kwargs = kwargs
|
|
|
|
|
|
|
|
|
|
def run(self):
|
|
|
|
|
output = self.rougailconfig['ansible.output']
|
|
|
|
|
if output == 'doc':
|
|
|
|
|
from .doc import Doc
|
|
|
|
|
data = Doc(self.config, rougailconfig=self.rougailconfig, **self.kwargs)
|
|
|
|
|
else:
|
|
|
|
|
data = Inventory(self.config, rougailconfig=self.rougailconfig, **self.kwargs)
|
|
|
|
|
return data.run()
|
|
|
|
|
|
|
|
|
|
def print(self):
|
|
|
|
|
output = self.rougailconfig['ansible.output']
|
|
|
|
|
if output == 'doc':
|
|
|
|
|
from .doc import Doc
|
|
|
|
|
data = Doc(self.config, rougailconfig=self.rougailconfig, **self.kwargs)
|
|
|
|
|
else:
|
|
|
|
|
data = Inventory(self.config, rougailconfig=self.rougailconfig, **self.kwargs)
|
|
|
|
|
return data.print()
|
2024-11-27 17:19:30 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
RougailOutput = RougailOutputAnsible
|
|
|
|
|
|
|
|
|
|
|
2026-01-14 14:25:35 +01:00
|
|
|
__all__ = ("RougailOutputAnsible", '__version__')
|