mirror of
https://github.com/ansible/awx.git
synced 2026-05-14 12:57:40 -02:30
Filter out managed credential types
since we cannot patch them upon import.
This commit is contained in:
@@ -51,7 +51,7 @@ EXPORTABLE_RESOURCES = [
|
|||||||
'users',
|
'users',
|
||||||
'organizations',
|
'organizations',
|
||||||
'teams',
|
'teams',
|
||||||
# 'credential_types',
|
'credential_types',
|
||||||
# 'credentials',
|
# 'credentials',
|
||||||
# 'notification_templates',
|
# 'notification_templates',
|
||||||
# 'projects',
|
# 'projects',
|
||||||
@@ -316,9 +316,14 @@ class Export(CustomCommand):
|
|||||||
results = endpoint.get(all_pages=True).results
|
results = endpoint.get(all_pages=True).results
|
||||||
|
|
||||||
options = self.get_options(endpoint)
|
options = self.get_options(endpoint)
|
||||||
return [self.serialize_asset(asset, options) for asset in results]
|
assets = (self.serialize_asset(asset, options) for asset in results)
|
||||||
|
return [asset for asset in assets if asset is not None]
|
||||||
|
|
||||||
def serialize_asset(self, asset, options):
|
def serialize_asset(self, asset, options):
|
||||||
|
# Drop any (credential_type) assets that are being managed by the Tower instance.
|
||||||
|
if asset.json.get('managed_by_tower'):
|
||||||
|
return None
|
||||||
|
|
||||||
fields = {
|
fields = {
|
||||||
key: asset[key] for key in options
|
key: asset[key] for key in options
|
||||||
if key in asset.json and key not in asset.related
|
if key in asset.json and key not in asset.related
|
||||||
|
|||||||
Reference in New Issue
Block a user