Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add migration script for 2.9 #18997

Merged
merged 1 commit into from
Jul 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion make/harbor.yml.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ log:
# port: 5140

#This attribute is for migrator to detect the version of the .cfg file, DO NOT MODIFY!
_version: 2.8.0
_version: 2.9.0

# Uncomment external_database if using external database.
# external_database:
Expand Down
2 changes: 1 addition & 1 deletion make/photon/prepare/commands/migrate.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
@click.command()
@click.option('-i', '--input', 'input_', required=True, help="The path of original config file")
@click.option('-o', '--output', default='', help="the path of output config file")
@click.option('-t', '--target', default='2.8.0', help="target version of input path")
@click.option('-t', '--target', default='2.9.0', help="target version of input path")
def migrate(input_, output, target):
"""
migrate command will migrate config file style to specific version
Expand Down
2 changes: 1 addition & 1 deletion make/photon/prepare/migrations/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

MIGRATION_BASE_DIR = os.path.dirname(__file__)

accept_versions = {'1.9.0', '1.10.0', '2.0.0', '2.1.0', '2.2.0', '2.3.0', '2.4.0', '2.5.0', '2.6.0', '2.7.0', '2.8.0'}
accept_versions = {'1.9.0', '1.10.0', '2.0.0', '2.1.0', '2.2.0', '2.3.0', '2.4.0', '2.5.0', '2.6.0', '2.7.0', '2.8.0', '2.9.0'}
21 changes: 21 additions & 0 deletions make/photon/prepare/migrations/version_2_9_0/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import os
from jinja2 import Environment, FileSystemLoader, StrictUndefined, select_autoescape
from utils.migration import read_conf

revision = '2.9.0'
down_revisions = ['2.8.0']

def migrate(input_cfg, output_cfg):
current_dir = os.path.dirname(__file__)
tpl = Environment(
loader=FileSystemLoader(current_dir),
undefined=StrictUndefined,
trim_blocks=True,
lstrip_blocks=True,
autoescape = select_autoescape()
).get_template('harbor.yml.jinja')

config_dict = read_conf(input_cfg)

with open(output_cfg, 'w') as f:
f.write(tpl.render(**config_dict))
Loading