-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[PR #6820/601fa0df backport][stable-7] locale_gen: refactor module to…
… use CmdRunner (#6867) locale_gen: refactor module to use CmdRunner (#6820) * refactor module to use CmdRunner * add changelog frag (cherry picked from commit 601fa0d) Co-authored-by: Alexei Znamensky <[email protected]>
- Loading branch information
1 parent
abd2a85
commit f8fc184
Showing
3 changed files
with
52 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
minor_changes: | ||
- locale_gen - module now using ``CmdRunner`` to execute external commands (https://github.com/ansible-collections/community.general/pull/6820). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# -*- coding: utf-8 -*- | ||
# Copyright (c) 2023, Alexei Znamensky <[email protected]> | ||
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt) | ||
# SPDX-License-Identifier: GPL-3.0-or-later | ||
|
||
from __future__ import absolute_import, division, print_function | ||
__metaclass__ = type | ||
|
||
from ansible_collections.community.general.plugins.module_utils.cmd_runner import CmdRunner, cmd_runner_fmt | ||
|
||
|
||
def locale_runner(module): | ||
runner = CmdRunner( | ||
module, | ||
command=["locale", "-a"], | ||
check_rc=True, | ||
) | ||
return runner | ||
|
||
|
||
def locale_gen_runner(module): | ||
runner = CmdRunner( | ||
module, | ||
command="locale-gen", | ||
arg_formats=dict( | ||
name=cmd_runner_fmt.as_list(), | ||
purge=cmd_runner_fmt.as_fixed('--purge'), | ||
), | ||
check_rc=True, | ||
) | ||
return runner |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters