mirror of
https://github.com/ansible/awx.git
synced 2024-11-02 09:51:09 +03:00
Merge pull request #1371 from rooftopcellist/fix_app_change_id
Fix id in activity_stream
This commit is contained in:
commit
a1dbd4dd57
@ -38,9 +38,8 @@ from rest_framework.utils.serializer_helpers import ReturnList
|
||||
from polymorphic.models import PolymorphicModel
|
||||
|
||||
# AWX
|
||||
from awx.main.constants import SCHEDULEABLE_PROVIDERS, ANSI_SGR_PATTERN
|
||||
from awx.main.constants import SCHEDULEABLE_PROVIDERS, ANSI_SGR_PATTERN, ACTIVE_STATES, TOKEN_CENSOR
|
||||
from awx.main.models import * # noqa
|
||||
from awx.main.constants import ACTIVE_STATES, TOKEN_CENSOR
|
||||
from awx.main.models.base import NEW_JOB_TYPE_CHOICES
|
||||
from awx.main.access import get_user_capabilities
|
||||
from awx.main.fields import ImplicitRoleField
|
||||
|
@ -31,6 +31,7 @@ import six
|
||||
from awx.main.models import * # noqa
|
||||
from django.contrib.sessions.models import Session
|
||||
from awx.api.serializers import * # noqa
|
||||
from awx.main.constants import TOKEN_CENSOR
|
||||
from awx.main.utils import model_instance_diff, model_to_dict, camelcase_to_underscore
|
||||
from awx.main.utils import ignore_inventory_computed_fields, ignore_inventory_group_removal, _inventory_updates
|
||||
from awx.main.tasks import update_inventory_computed_fields
|
||||
@ -449,6 +450,8 @@ model_serializer_mapping = {
|
||||
WorkflowJobTemplate: WorkflowJobTemplateSerializer,
|
||||
WorkflowJobTemplateNode: WorkflowJobTemplateNodeSerializer,
|
||||
WorkflowJob: WorkflowJobSerializer,
|
||||
OAuth2AccessToken: OAuth2TokenSerializer,
|
||||
OAuth2Application: OAuth2ApplicationSerializer,
|
||||
}
|
||||
|
||||
|
||||
@ -468,7 +471,7 @@ def activity_stream_create(sender, instance, created, **kwargs):
|
||||
if 'extra_vars' in changes:
|
||||
changes['extra_vars'] = instance.display_extra_vars()
|
||||
if type(instance) == OAuth2AccessToken:
|
||||
changes['token'] = '*************'
|
||||
changes['token'] = TOKEN_CENSOR
|
||||
activity_entry = ActivityStream(
|
||||
operation='create',
|
||||
object1=object1,
|
||||
|
@ -383,7 +383,7 @@ def _convert_model_field_for_display(obj, field_name, password_fields=None):
|
||||
field_val = json.dumps(field_val, ensure_ascii=False)
|
||||
except Exception:
|
||||
pass
|
||||
if type(field_val) not in (bool, int, type(None)):
|
||||
if type(field_val) not in (bool, int, type(None), long):
|
||||
field_val = smart_str(field_val)
|
||||
return field_val
|
||||
|
||||
@ -416,10 +416,8 @@ def model_instance_diff(old, new, serializer_mapping=None):
|
||||
_convert_model_field_for_display(old, field, password_fields=old_password_fields),
|
||||
_convert_model_field_for_display(new, field, password_fields=new_password_fields),
|
||||
)
|
||||
|
||||
if len(diff) == 0:
|
||||
diff = None
|
||||
|
||||
return diff
|
||||
|
||||
|
||||
@ -438,7 +436,6 @@ def model_to_dict(obj, serializer_mapping=None):
|
||||
if field.name not in allowed_fields:
|
||||
continue
|
||||
attr_d[field.name] = _convert_model_field_for_display(obj, field.name, password_fields=password_fields)
|
||||
|
||||
return attr_d
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user