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

🎉 octavia-cli: Add ability to import existing resources #14137

Merged
Merged
Changes from 1 commit
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
aa1ff16
init
danieldiamond May 26, 2022
19a52a2
Update docs and add tests
danieldiamond May 27, 2022
0150ae9
Revert docker run docs
danieldiamond May 27, 2022
7748d63
Add "update" commands
danieldiamond May 29, 2022
58303ea
Add "update sources" and "update destinations" to create yaml files f…
danieldiamond May 29, 2022
d66efbc
Merge branch 'master' into danieldiamond/octavia-cli-generate-existin…
danieldiamond Jun 24, 2022
48676c1
WIP
danieldiamond Jun 24, 2022
89549dc
Revert "WIP"
danieldiamond Jun 24, 2022
87f6b48
Remove update method
danieldiamond Jun 24, 2022
a41fd9b
Merge branch 'master' into danieldiamond/octavia-cli-generate-existin…
danieldiamond Jun 24, 2022
29c3a64
Remove update from tests
danieldiamond Jun 24, 2022
35d9cdd
Remove update related methods in generate_renderers
danieldiamond Jun 24, 2022
a4b03ed
Merge branch 'master' into danieldiamond/octavia-cli-generate-existin…
danieldiamond Jun 26, 2022
528afc1
Reformat get commands
danieldiamond Jun 26, 2022
e376f4e
Remove DuplicateResourceError from apply
danieldiamond Jun 26, 2022
3d96529
Remove ConnectorRenderer from generate
danieldiamond Jun 26, 2022
6f3944d
Update unit tests for commands and resources
danieldiamond Jun 26, 2022
c44903e
Update docs and setup
danieldiamond Jun 26, 2022
c31f2bc
init import commands
danieldiamond Jun 26, 2022
810b089
Add quotes to handle yaml characters
danieldiamond Jun 26, 2022
f147e27
Add source and destination commands
danieldiamond Jun 26, 2022
18f6967
Remove ConnectorRenderer from generate
danieldiamond Jun 26, 2022
3ec8ce3
Merge branch 'master' into danieldiamond/octavia-cli-import
alafanechere Jun 27, 2022
9cc897e
Remove commands for import of multiple resources
danieldiamond Jun 27, 2022
da2e0b5
Improve writes: Avoid intermediate yaml file saved to disk, check if …
danieldiamond Jun 27, 2022
42d37a5
Manage connections and store state
danieldiamond Jun 27, 2022
a55547d
Make resource_requirements an optional field in apply.resources
danieldiamond Jun 28, 2022
654e3a3
Slugify resource_name in get_output_path method in generate.renderers
danieldiamond Jun 28, 2022
108d8a4
Add docstring to import commands
danieldiamond Jun 28, 2022
e1dc6fd
Merge branch 'master' into danieldiamond/octavia-cli-import
danieldiamond Jun 28, 2022
57371e3
Add user warning message to update secrets in source or destination
danieldiamond Jun 28, 2022
8779a00
add slugify dependency
alafanechere Jun 29, 2022
678f8db
write unit tests
alafanechere Jun 29, 2022
cbd183b
wip integration tests
alafanechere Jun 29, 2022
938eef0
fix connection config for integration tests
alafanechere Jun 30, 2022
305bafe
improve connection config cleaning on import
alafanechere Jun 30, 2022
efaa21f
finish integration tests
alafanechere Jun 30, 2022
fa69f09
Merge branch 'master' into danieldiamond/octavia-cli-import
alafanechere Jun 30, 2022
488dc01
update readme
alafanechere Jun 30, 2022
b62796c
update readme
alafanechere Jun 30, 2022
e38c422
update readme
alafanechere Jun 30, 2022
1e26425
update readme
alafanechere Jun 30, 2022
269ffdc
update readme
alafanechere Jun 30, 2022
470824b
Merge branch 'master' into danieldiamond/octavia-cli-import
danieldiamond Jun 30, 2022
3c359fe
Iterate on import_configuration in ConnectionRenderer
danieldiamond Jun 30, 2022
36904d2
fix docstring + clean
alafanechere Jul 1, 2022
2c7dfbb
bump to the right version
alafanechere Jul 1, 2022
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
Prev Previous commit
Next Next commit
Remove ConnectorRenderer from generate
  • Loading branch information
danieldiamond committed Jun 26, 2022
commit 18f6967bc70d2f4325359a334b00b70dbaf119dd
34 changes: 0 additions & 34 deletions octavia-cli/octavia_cli/generate/renderers.py
Original file line number Diff line number Diff line change
Expand Up @@ -247,40 +247,6 @@ def _render(self) -> str:
)


class ConnectorRenderer(BaseRenderer):
TEMPLATE = JINJA_ENV.get_template("source_or_destination.yaml.j2")

def __init__(self, resource_id: str, definition: BaseDefinition) -> None:
"""Connector specification renderer constructor.

Args:
resource_id (str): ID of the existing source or destination.
definition (BaseDefinition): The definition related to a source or a destination.
"""
super().__init__(resource_id)
self.definition = definition

def _parse_connection_specification(self, schema: dict) -> List[List["FieldToRender"]]:
"""Create a renderable structure from the specification schema

Returns:
List[List["FieldToRender"]]: List of list of fields to render.
"""
if schema.get("oneOf"):
roots = []
for one_of_value in schema.get("oneOf"):
required_fields = one_of_value.get("required", [])
roots.append(parse_fields(required_fields, one_of_value["properties"]))
return roots
else:
required_fields = schema.get("required", [])
return [parse_fields(required_fields, schema["properties"])]

def _render(self) -> str:
parsed_schema = self._parse_connection_specification(self.definition.specification.connection_specification)
return self.TEMPLATE.render({"resource_id": self.resource_id, "definition": self.definition, "configuration_fields": parsed_schema})


class ConnectionRenderer(BaseRenderer):

TEMPLATE = JINJA_ENV.get_template("connection.yaml.j2")
Expand Down