mirror of
https://github.com/ansible/awx.git
synced 2024-10-31 15:21:13 +03:00
Filter out managed credential types
since we cannot patch them upon import.
This commit is contained in:
parent
3f204659a8
commit
868aafb263
@ -51,7 +51,7 @@ EXPORTABLE_RESOURCES = [
|
||||
'users',
|
||||
'organizations',
|
||||
'teams',
|
||||
# 'credential_types',
|
||||
'credential_types',
|
||||
# 'credentials',
|
||||
# 'notification_templates',
|
||||
# 'projects',
|
||||
@ -316,9 +316,14 @@ class Export(CustomCommand):
|
||||
results = endpoint.get(all_pages=True).results
|
||||
|
||||
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):
|
||||
# Drop any (credential_type) assets that are being managed by the Tower instance.
|
||||
if asset.json.get('managed_by_tower'):
|
||||
return None
|
||||
|
||||
fields = {
|
||||
key: asset[key] for key in options
|
||||
if key in asset.json and key not in asset.related
|
||||
|
Loading…
Reference in New Issue
Block a user