Skip to content

Commit 5c19935

Browse files
authored
Merge pull request #35 from netfoundry/feature/skip_dns_skip_systemd
Feature/skip dns skip systemd
2 parents 012421e + 23a1b07 commit 5c19935

File tree

2 files changed

+32
-12
lines changed

2 files changed

+32
-12
lines changed

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
11
# Changelog
22

33
All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
4+
## [1.0.19] - 2023-12-28
5+
6+
### Added
7+
8+
- Add skipDNS to not configure local DNS
9+
- Add skipSystemd to not configure systemd nor take any systemd actions
10+
411
## [1.0.18] - 2023-12-13
512

613
### Changed

ziti_router_auto_enroll.py

Lines changed: 25 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,10 @@ def add_install_arguments(parser):
261261
install_config.add_argument('--downloadUrl', type=str,
262262
help='Bundle download url - '
263263
'Default https://github.com/openziti/ziti/releases/latest/')
264+
install_config.add_argument('--skipSystemd',
265+
action='store_true',
266+
help='Skip systemd installation',
267+
default=False)
264268

265269
def add_router_identity_arguments(parser):
266270
"""
@@ -490,6 +494,10 @@ def add_router_listener_arguments(parser):
490494
'with the {default_gw_adapter} as the local resolver '
491495
'and LANIf',
492496
default=False)
497+
router_listener_group.add_argument('--skipDNS',
498+
action='store_true',
499+
help='Skip DNS configuration',
500+
default=False)
493501

494502
def add_router_web_arguments(parser):
495503
"""
@@ -721,7 +729,7 @@ def create_parser():
721729
722730
:return: A Namespace containing arguments
723731
"""
724-
__version__ = '1.0.18'
732+
__version__ = '1.0.19'
725733
parser = argparse.ArgumentParser()
726734

727735
add_general_arguments(parser, __version__)
@@ -1140,8 +1148,9 @@ def handle_resolved_dns(args):
11401148
logging.error("Unable to write dns configuration")
11411149
sys.exit(1)
11421150
logging.debug("Restarting network service to apply dns changes")
1143-
manage_systemd_service('systemd-networkd', 'restart')
1144-
manage_systemd_service('systemd-resolved', 'restart')
1151+
if not args.skipSystemd:
1152+
manage_systemd_service('systemd-networkd', 'restart')
1153+
manage_systemd_service('systemd-resolved', 'restart')
11451154

11461155
def handle_systemd_setup(install_version, install_dir):
11471156
"""
@@ -1175,7 +1184,8 @@ def handle_systemd_setup(install_version, install_dir):
11751184
def handle_ziti_install(controller_info,
11761185
download_url=None,
11771186
install_version=None,
1178-
install_dir=None):
1187+
install_dir=None,
1188+
skip_systemd=False):
11791189
"""
11801190
Handle the download and installation of Ziti binaries.
11811191
@@ -1207,7 +1217,8 @@ def handle_ziti_install(controller_info,
12071217
download_uri = download_url
12081218
downloaded_file = download_file(download_uri)
12091219
install_ziti_binaries(downloaded_file, install_dir)
1210-
handle_systemd_setup(install_version, install_dir)
1220+
if not skip_systemd:
1221+
handle_systemd_setup(install_version, install_dir)
12111222

12121223
def install_ziti_binaries(file_to_extract, install_dir):
12131224
"""
@@ -1941,8 +1952,6 @@ def main(args):
19411952
if args.parametersFile:
19421953
check_parameters_file(args, parser)
19431954

1944-
1945-
19461955
# iptables check if tunneler
19471956
if args.tunnelListener or args.autoTunnelListener:
19481957
check_iptables(args)
@@ -1955,7 +1964,8 @@ def main(args):
19551964
sys.exit(1)
19561965
else:
19571966
if not args.printConfig:
1958-
manage_systemd_service('ziti-router.service','stop')
1967+
if not args.skipSystemd:
1968+
manage_systemd_service('ziti-router.service','stop')
19591969
cleanup_previous_versions()
19601970

19611971
# print template
@@ -1981,7 +1991,8 @@ def main(args):
19811991
handle_ziti_install(controller_info,
19821992
args.downloadUrl,
19831993
args.installVersion,
1984-
args.installDir)
1994+
args.installDir,
1995+
args.skipSystemd)
19851996

19861997
# write config
19871998
logging.info("Creating config file")
@@ -1992,11 +2003,13 @@ def main(args):
19922003

19932004
# set up local dns for tunnel mode
19942005
if args.tunnelListener or args.autoTunnelListener:
1995-
handle_dns(args)
2006+
if not args.skipDNS:
2007+
handle_dns(args)
19962008

19972009
# start ziti
1998-
manage_systemd_service('ziti-router.service', 'start')
1999-
manage_systemd_service('ziti-router.service', 'enable')
2010+
if not args.skipSystemd:
2011+
manage_systemd_service('ziti-router.service', 'start')
2012+
manage_systemd_service('ziti-router.service', 'enable')
20002013

20012014
# main
20022015
if __name__ == '__main__':

0 commit comments

Comments
 (0)