blob: dddbe12f6e95981a48c65572ef7446260f7d83ed (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
#!/usr/bin/env python3
#
# Copyright VyOS maintainers and contributors <maintainers@vyos.io>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 or later as
# published by the Free Software Foundation.
#
# 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 General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
#
# N.B. only for use within testing framework; explicit invocation will leave
# system in inconsistent state.
import os
import sys
from argparse import ArgumentParser
from vyos.utils.backend import set_vyconf_backend
if os.getuid() != 0:
sys.exit('Requires root privileges')
parser = ArgumentParser()
parser.add_argument('--disable', action='store_true',
help='enable/disable vyconf backend')
parser.add_argument('--no-prompt', action='store_true',
help='confirm without prompt')
args = parser.parse_args()
match args.disable:
case False:
set_vyconf_backend(True, no_prompt=args.no_prompt)
case True:
set_vyconf_backend(False, no_prompt=args.no_prompt)
|