Skip to content

Commit

Permalink
add miigration script for 2.9
Browse files Browse the repository at this point in the history
Signed-off-by: yminer <yminer@vmware.com>

update quota_update_provider

update typo

update comment
  • Loading branch information
MinerYang committed Jul 25, 2023
1 parent 7862870 commit 8ab7d40
Show file tree
Hide file tree
Showing 5 changed files with 629 additions and 3 deletions.
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

0 comments on commit 8ab7d40

Please sign in to comment.