Skip to content

Commit

Permalink
Merge pull request #10 from netfoundry/release/1.1.1
Browse files Browse the repository at this point in the history
fixed issue with unit file search; updated open to use encoding
  • Loading branch information
emoscardini authored Jun 30, 2023
2 parents ec51f17 + 7db807f commit a18a361
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@

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).

## [1.1.0] - 2023-06-29

### Fixed

- Updated the search & replace to use `ExecStart=` in systemd unit file.
- Updated open statements to use encoding.

## [1.1.0] - 2023-03-2

### Added
Expand Down
10 changes: 5 additions & 5 deletions router_upgrade.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ def extract_controller_ip():
# try to find controller info
for config, binary in config_map.items():
if os.path.isfile(config):
with open(config, "r") as file:
with open(config, "r",encoding='UTF-8') as file:
if binary == "ziti-router":
logging.debug("Trying to open router config")
try:
Expand Down Expand Up @@ -280,11 +280,11 @@ def update_systemd_unitfile(binary_name):
logging.debug("Update systemd unit file")
print("\033[0;31mWARN:\033[0m Upgraded to 0.27.0 and above. You can't use this program to downgrade to lower versions")
try:
with open(service_unit, 'r') as openfile:
with open(service_unit, 'r',encoding='UTF-8') as openfile:
lines = openfile.readlines()
# Find the line to update
for i, line in enumerate(lines):
if line.startswith('ExecStart'):
if line.startswith('ExecStart='):
if binary_name == "router":
lines[i] = ("ExecStart=/opt/netfoundry/ziti/ziti router run /opt/netfoundry/ziti/ziti-router/config.yml\n")
if binary_name == "tunnel":
Expand All @@ -294,7 +294,7 @@ def update_systemd_unitfile(binary_name):
print("\033[0;31mERROR:\033[0m Unable to find the line to update")
sys.exit(1)

with open(service_unit, 'w') as openfile:
with open(service_unit, 'w',encoding='UTF-8') as openfile:
openfile.writelines(lines)

except FileNotFoundError:
Expand Down Expand Up @@ -345,7 +345,7 @@ def main():
"""
Main logic
"""
__version__ = '1.1.0'
__version__ = '1.1.1'
# Change log
# See https://github.com/netfoundry/edge-router-upgrade/blob/main/CHANGELOG.md

Expand Down

0 comments on commit a18a361

Please sign in to comment.