-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
182f2c6
commit e933de0
Showing
12 changed files
with
432 additions
and
111 deletions.
There are no files selected for viewing
3 changes: 3 additions & 0 deletions
3
airbyte-integrations/bases/source-acceptance-test/CHANGELOG.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
...ntegrations/bases/source-acceptance-test/source_acceptance_test/utils/config_migration.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# | ||
# Copyright (c) 2022 Airbyte, Inc., all rights reserved. | ||
# | ||
|
||
import argparse | ||
from pathlib import Path | ||
|
||
import yaml | ||
from source_acceptance_test.config import Config | ||
from yaml import load | ||
|
||
try: | ||
from yaml import CLoader as Loader | ||
except ImportError: | ||
from yaml import Loader | ||
|
||
parser = argparse.ArgumentParser(description="Migrate legacy acceptance-test-config.yml to the latest configuration format.") | ||
parser.add_argument("config_path", type=str, help="Path to the acceptance-test-config.yml to migrate.") | ||
|
||
|
||
def migrate_legacy_configuration(config_path: Path): | ||
|
||
with open(config_path, "r") as file: | ||
to_migrate = load(file, Loader=Loader) | ||
|
||
if Config.is_legacy(to_migrate): | ||
migrated_config = Config.migrate_legacy_to_current_config(to_migrate) | ||
with open(config_path, "w") as output_file: | ||
yaml.dump(migrated_config, output_file) | ||
print(f"Your configuration was successfully migrated to the latest configuration format: {config_path}") | ||
else: | ||
print("Your configuration is not in a legacy format.") | ||
|
||
|
||
if __name__ == "__main__": | ||
args = parser.parse_args() | ||
migrate_legacy_configuration(Path(args.config_path)) |
Oops, something went wrong.