Skip to content

Commit

Permalink
include default_organization at minimum (#655)
Browse files Browse the repository at this point in the history
This is a near-term workaround until we include all resources on the server as part of the export. This fix will ensure that the default_organization is included at minimum, which is in line with our documentation around being able to utilize default_organization behind the scenes.

This will unblock users from currently hitting an error when trying to utilize an organization not defined in the manifest directory.
  • Loading branch information
SteveDMurphy authored May 18, 2022
1 parent 4fb1e41 commit 44ba54e
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
7 changes: 7 additions & 0 deletions src/fidesctl/core/export_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -300,11 +300,18 @@ def get_datamap_fides_keys(taxonomy: Taxonomy) -> Dict:
Gathers all fides keys for an organization, systems,
and datasets based on the resources found in the
provided taxonomy built from manifests.
If no Organization is found, ensure the 'default_organization'
is applied. This is a temporary measure put in place until a
more thorough change is made to pull all resources from the
server.
"""
taxonomy_keys_dict = {}
taxonomy_keys_dict["organization"] = [
resource.fides_key for resource in taxonomy.organization
]
if not taxonomy_keys_dict["organization"]:
taxonomy_keys_dict["organization"] = ["default_organization"]
taxonomy_keys_dict["system"] = [resource.fides_key for resource in taxonomy.system]
taxonomy_keys_dict["dataset"] = [
resource.fides_key for resource in taxonomy.dataset
Expand Down
11 changes: 9 additions & 2 deletions tests/cli/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -245,8 +245,15 @@ def test_evaluate_with_dataset_collection_failed(
@pytest.mark.parametrize(
"export_resource", ["system", "dataset", "organization", "datamap"]
)
@pytest.mark.parametrize(
"manifest_dir",
["demo_resources/", ".fides/"],
)
def test_export_resources(
test_config_path: str, test_cli_runner: CliRunner, export_resource: str
test_config_path: str,
test_cli_runner: CliRunner,
export_resource: str,
manifest_dir: str,
) -> None:
"""
Tests that each resource is successfully exported
Expand All @@ -259,7 +266,7 @@ def test_export_resources(
test_config_path,
"export",
export_resource,
"demo_resources/",
manifest_dir,
"--dry",
],
)
Expand Down

0 comments on commit 44ba54e

Please sign in to comment.