From 21e36ad19a0c15ba7c7b7e198f12ae1a0d932885 Mon Sep 17 00:00:00 2001 From: Jeff Bradberry Date: Thu, 20 Feb 2020 13:46:03 -0500 Subject: [PATCH] Add the calculated natural key to the export data for each asset --- awxkit/awxkit/cli/resource.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/awxkit/awxkit/cli/resource.py b/awxkit/awxkit/cli/resource.py index 81eb58dac2..042a8e3572 100644 --- a/awxkit/awxkit/cli/resource.py +++ b/awxkit/awxkit/cli/resource.py @@ -4,7 +4,7 @@ import sys from awxkit import api, config from awxkit.utils import to_str -from awxkit.api.pages import Page, TentativePage +from awxkit.api.pages import Page from awxkit.cli.format import FORMATTERS, format_response, add_authentication_arguments from awxkit.cli.utils import CustomRegistryMeta, cprint @@ -75,8 +75,8 @@ NATURAL_KEYS = { def get_natural_key(page): - natural_key = {'type': page.type} - lookup = NATURAL_KEYS.get(page.type, ()) + natural_key = {'type': page['type']} + lookup = NATURAL_KEYS.get(page['type'], ()) for key in lookup or (): if key.startswith(':'): @@ -236,6 +236,7 @@ class Export(CustomCommand): key: asset[key] for key in options if key in asset.json and key not in asset.related } + fields['natural_key'] = get_natural_key(asset) fk_fields = { key: get_natural_key(asset.related[key].get()) for key in options