Skip to content

Commit

Permalink
change single quote to double (#247)
Browse files Browse the repository at this point in the history
Changed Single quotes in NDB decompile to double

(cherry picked from commit e6b27bde56e6f9d3aa6bac205ada3c65262e870e)
  • Loading branch information
utkarshb07 authored and abhijeetkaurav1st committed Aug 6, 2023
1 parent 81756c6 commit ef7f062
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 25 deletions.
14 changes: 7 additions & 7 deletions calm/dsl/decompile/schemas/ndb_postgres_clone.py.jinja2
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
{% macro database_server_clone(obj) %}
DatabaseServer.Postgres.Clone(
{%- for key, val in obj.items() %}
{{ key }}={% if val.type == "Ref" %}{{val.ref}}('{{val.value}}'){% else %} '{{val.value}}' {% endif %},
{{ key }}={% if val.type == "Ref" %}{{val.ref}}("{{val.value}}"){% else %} "{{val.value}}" {% endif %},
{%- endfor %}
)
{% endmacro %}

{% macro database_clone(obj) %}
Database.Postgres.Clone(
{%- for key, val in obj.items() %}
{{ key }}={% if val.type == "Ref" %}{{val.ref}}('{{val.value}}'){% else %} '{{val.value}}' {% endif %},
{{ key }}={% if val.type == "Ref" %}{{val.ref}}("{{val.value}}"){% else %} "{{val.value}}" {% endif %},
{%- endfor %}
)
{% endmacro %}

{% macro time_machine_clone(obj) %}
TimeMachine.Postgres.Clone(
{%- for key, val in obj.items() %}
{{ key }}={% if val.type == "Ref" %}{{val.ref}}('{{val.value}}'){% else %} '{{val.value}}' {% endif %},
{{ key }}={% if val.type == "Ref" %}{{val.ref}}("{{val.value}}"){% else %} "{{val.value}}" {% endif %},
{%- endfor %}
)
{% endmacro %}
Expand All @@ -27,7 +27,7 @@ Tag.Clone(
{%- for key, obj_val in obj.items() %}
{{ key }}=[
{%- for val in obj_val.value %}
{{obj_val.ref}}('{{val.name}}', '{{val.value}}'),
{{obj_val.ref}}("{{val.name}}", "{{val.value}}"),
{%- endfor %}
],
{%- endfor %}
Expand All @@ -37,15 +37,15 @@ Tag.Clone(
{% macro output_vars_clone(obj) %}
PostgresDatabaseOutputVariables.Clone(
{%- for key, val in obj.items() %}
{{ key }}='{{ val }}',
{{ key }}="{{ val }}",
{%- endfor %}
)
{% endmacro %}

{% macro nutanix_db_postgres_clone(obj) %}
CalmTask.NutanixDB.PostgresDatabase.Clone(
name='{{ obj.name }}',
account=Ref.Account('{{ obj.account }}'),
name="{{ obj.name }}",
account=Ref.Account("{{ obj.account }}"),
database_server_config={{ database_server_clone(obj.database_server) }},
instance_config={{ database_clone(obj.database) }},
timemachine_config={{ time_machine_clone(obj.time_machine) }},
Expand Down
14 changes: 7 additions & 7 deletions calm/dsl/decompile/schemas/ndb_postgres_create.py.jinja2
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
{% macro database_server_create(obj) %}
DatabaseServer.Postgres.Create(
{%- for key, val in obj.items() %}
{{ key }}={% if val.type == "Ref" %}{{val.ref}}('{{val.value}}'){% else %} '{{val.value}}' {% endif %},
{{ key }}={% if val.type == "Ref" %}{{val.ref}}("{{val.value}}"){% else %} "{{val.value}}" {% endif %},
{%- endfor %}
)
{% endmacro %}

{% macro database_create(obj) %}
Database.Postgres.Create(
{%- for key, val in obj.items() %}
{{ key }}={% if val.type == "Ref" %}{{val.ref}}('{{val.value}}'){% else %} '{{val.value}}' {% endif %},
{{ key }}={% if val.type == "Ref" %}{{val.ref}}("{{val.value}}"){% else %} "{{val.value}}" {% endif %},
{%- endfor %}
)
{% endmacro %}

{% macro time_machine_create(obj) %}
TimeMachine.Postgres.Create(
{%- for key, val in obj.items() %}
{{ key }}={% if val.type == "Ref" %}{{val.ref}}('{{val.value}}'){% else %} '{{val.value}}' {% endif %},
{{ key }}={% if val.type == "Ref" %}{{val.ref}}("{{val.value}}"){% else %} "{{val.value}}" {% endif %},
{%- endfor %}
)
{% endmacro %}
Expand All @@ -27,7 +27,7 @@ Tag.Create(
{%- for key, obj_val in obj.items() %}
{{ key }}=[
{%- for val in obj_val.value %}
{{obj_val.ref}}('{{val.name}}', '{{val.value}}'),
{{obj_val.ref}}("{{val.name}}", "{{val.value}}"),
{%- endfor %}
],
{%- endfor %}
Expand All @@ -37,15 +37,15 @@ Tag.Create(
{% macro output_vars_create(obj) %}
PostgresDatabaseOutputVariables.Create(
{%- for key, val in obj.items() %}
{{ key }}='{{ val }}',
{{ key }}="{{ val }}",
{%- endfor %}
)
{% endmacro %}

{% macro nutanix_db_postgres_create(obj) %}
CalmTask.NutanixDB.PostgresDatabase.Create(
name='{{ obj.name }}',
account=Ref.Account('{{ obj.account }}'),
name="{{ obj.name }}",
account=Ref.Account("{{ obj.account }}"),
database_server_config={{ database_server_create(obj.database_server) }},
instance_config={{ database_create(obj.database) }},
timemachine_config={{ time_machine_create(obj.time_machine) }},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{% macro database_create_snapshot(obj) %}
Database.Postgres.CreateSnapshot(
{%- for key, val in obj.items() %}
{{ key }}={% if val.type == "Ref" %}{{val.ref}}('{{val.value}}'){% else %} '{{val.value}}' {% endif %},
{{ key }}={% if val.type == "Ref" %}{{val.ref}}("{{val.value}}"){% else %} "{{val.value}}" {% endif %},
{%- endfor %}
)
{% endmacro %}
Expand All @@ -10,15 +10,15 @@ Database.Postgres.CreateSnapshot(
{% macro output_vars_create_snapshot(obj) %}
PostgresDatabaseOutputVariables.CreateSnapshot(
{%- for key, val in obj.items() %}
{{ key }}='{{ val }}',
{{ key }}="{{ val }}",
{%- endfor %}
)
{% endmacro %}

{% macro nutanix_db_postgres_create_snapshot(obj) %}
CalmTask.NutanixDB.PostgresDatabase.CreateSnapshot(
name='{{ obj.name }}',
account=Ref.Account('{{ obj.account }}'),
name="{{ obj.name }}",
account=Ref.Account("{{ obj.account }}"),
instance_config={{ database_create_snapshot(obj.database) }},
outargs={{ output_vars_create_snapshot(obj.output_vars) }},
)
Expand Down
6 changes: 3 additions & 3 deletions calm/dsl/decompile/schemas/ndb_postgres_delete.py.jinja2
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
{% macro database_delete(obj) %}
Database.Postgres.Delete(
{%- for key, val in obj.items() %}
{{ key }}={% if val.type == "Ref" %}{{val.ref}}('{{val.value}}'){% else %} '{{val.value}}' {% endif %},
{{ key }}={% if val.type == "Ref" %}{{val.ref}}("{{val.value}}"){% else %} "{{val.value}}" {% endif %},
{%- endfor %}
)
{% endmacro %}


{% macro nutanix_db_postgres_delete(obj) %}
CalmTask.NutanixDB.PostgresDatabase.Delete(
name='{{ obj.name }}',
account=Ref.Account('{{ obj.account }}'),
name="{{ obj.name }}",
account=Ref.Account("{{ obj.account }}"),
instance_config={{ database_delete(obj.database) }},
)
{% endmacro %}
Expand Down
8 changes: 4 additions & 4 deletions calm/dsl/decompile/schemas/ndb_postgres_restore.py.jinja2
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{% macro database_restore(obj) %}
Database.Postgres.RestoreFromTimeMachine(
{%- for key, val in obj.items() %}
{{ key }}={% if val.type == "Ref" %}{{val.ref}}('{{val.value}}'){% else %} '{{val.value}}' {% endif %},
{{ key }}={% if val.type == "Ref" %}{{val.ref}}("{{val.value}}"){% else %} "{{val.value}}" {% endif %},
{%- endfor %}
)
{% endmacro %}
Expand All @@ -10,15 +10,15 @@ Database.Postgres.RestoreFromTimeMachine(
{% macro output_vars_restore(obj) %}
PostgresDatabaseOutputVariables.RestoreFromTimeMachine(
{%- for key, val in obj.items() %}
{{ key }}='{{ val }}',
{{ key }}="{{ val }}",
{%- endfor %}
)
{% endmacro %}

{% macro nutanix_db_postgres_restore(obj) %}
CalmTask.NutanixDB.PostgresDatabase.RestoreFromTimeMachine(
name='{{ obj.name }}',
account=Ref.Account('{{ obj.account }}'),
name="{{ obj.name }}",
account=Ref.Account("{{ obj.account }}"),
instance_config={{ database_restore(obj.database) }},
outargs={{ output_vars_restore(obj.output_vars) }},
)
Expand Down

0 comments on commit ef7f062

Please sign in to comment.