mirror of
https://github.com/ansible/awx.git
synced 2026-05-10 02:47:36 -02:30
Cleaned up some more stale TODO's and FIXME's (or did / fixed the things)
This commit is contained in:
@@ -218,8 +218,8 @@ class BaseSerializer(serializers.ModelSerializer):
|
|||||||
class Meta:
|
class Meta:
|
||||||
fields = ('id', 'type', 'url', 'related', 'summary_fields', 'created',
|
fields = ('id', 'type', 'url', 'related', 'summary_fields', 'created',
|
||||||
'modified', 'name', 'description')
|
'modified', 'name', 'description')
|
||||||
summary_fields = () # FIXME: List of field names from this serializer that should be used when included as part of another's summary_fields.
|
summary_fields = ()
|
||||||
summarizable_fields = () # FIXME: List of field names on this serializer that should be included in summary_fields.
|
summarizable_fields = ()
|
||||||
|
|
||||||
# add the URL and related resources
|
# add the URL and related resources
|
||||||
type = serializers.SerializerMethodField()
|
type = serializers.SerializerMethodField()
|
||||||
@@ -668,11 +668,6 @@ class UnifiedJobStdoutSerializer(UnifiedJobSerializer):
|
|||||||
else:
|
else:
|
||||||
return super(UnifiedJobStdoutSerializer, self).get_types()
|
return super(UnifiedJobStdoutSerializer, self).get_types()
|
||||||
|
|
||||||
# TODO: Needed?
|
|
||||||
#def to_representation(self, obj):
|
|
||||||
# ret = super(UnifiedJobStdoutSerializer, self).to_representation(obj)
|
|
||||||
# return ret.get('result_stdout', '')
|
|
||||||
|
|
||||||
|
|
||||||
class UserSerializer(BaseSerializer):
|
class UserSerializer(BaseSerializer):
|
||||||
|
|
||||||
@@ -1309,7 +1304,6 @@ class InventorySourceOptionsSerializer(BaseSerializer):
|
|||||||
|
|
||||||
def validate_source_vars(self, value):
|
def validate_source_vars(self, value):
|
||||||
# source_env must be blank, a valid JSON or YAML dict, or ...
|
# source_env must be blank, a valid JSON or YAML dict, or ...
|
||||||
# FIXME: support key=value pairs.
|
|
||||||
try:
|
try:
|
||||||
json.loads((value or '').strip() or '{}')
|
json.loads((value or '').strip() or '{}')
|
||||||
return value
|
return value
|
||||||
@@ -1335,9 +1329,9 @@ class InventorySourceOptionsSerializer(BaseSerializer):
|
|||||||
try:
|
try:
|
||||||
if source_script.organization != self.instance.inventory.organization:
|
if source_script.organization != self.instance.inventory.organization:
|
||||||
errors['source_script'] = "The 'source_script' does not belong to the same organization as the inventory."
|
errors['source_script'] = "The 'source_script' does not belong to the same organization as the inventory."
|
||||||
except Exception:
|
except Exception as exc:
|
||||||
# TODO: Log
|
|
||||||
errors['source_script'] = "'source_script' doesn't exist."
|
errors['source_script'] = "'source_script' doesn't exist."
|
||||||
|
logger.error(str(exc))
|
||||||
|
|
||||||
if errors:
|
if errors:
|
||||||
raise serializers.ValidationError(errors)
|
raise serializers.ValidationError(errors)
|
||||||
@@ -1610,8 +1604,6 @@ class ResourceAccessListElementSerializer(UserSerializer):
|
|||||||
|
|
||||||
class CredentialSerializer(BaseSerializer):
|
class CredentialSerializer(BaseSerializer):
|
||||||
|
|
||||||
# FIXME: may want to make some fields filtered based on user accessing
|
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = Credential
|
model = Credential
|
||||||
fields = ('*', 'kind', 'cloud', 'host', 'username',
|
fields = ('*', 'kind', 'cloud', 'host', 'username',
|
||||||
@@ -1886,7 +1878,6 @@ class JobTemplateSerializer(UnifiedJobTemplateSerializer, JobOptionsSerializer):
|
|||||||
|
|
||||||
def validate_extra_vars(self, value):
|
def validate_extra_vars(self, value):
|
||||||
# extra_vars must be blank, a valid JSON or YAML dict, or ...
|
# extra_vars must be blank, a valid JSON or YAML dict, or ...
|
||||||
# FIXME: support key=value pairs.
|
|
||||||
try:
|
try:
|
||||||
json.loads((value or '').strip() or '{}')
|
json.loads((value or '').strip() or '{}')
|
||||||
return value
|
return value
|
||||||
@@ -2574,7 +2565,6 @@ class ScheduleSerializer(BaseSerializer):
|
|||||||
try:
|
try:
|
||||||
rrule.rrulestr(rrule_value)
|
rrule.rrulestr(rrule_value)
|
||||||
except Exception:
|
except Exception:
|
||||||
# TODO: Log
|
|
||||||
raise serializers.ValidationError("rrule parsing failed validation.")
|
raise serializers.ValidationError("rrule parsing failed validation.")
|
||||||
return value
|
return value
|
||||||
|
|
||||||
@@ -2609,7 +2599,6 @@ class ActivityStreamSerializer(BaseSerializer):
|
|||||||
try:
|
try:
|
||||||
return json.loads(obj.changes)
|
return json.loads(obj.changes)
|
||||||
except Exception:
|
except Exception:
|
||||||
# TODO: Log
|
|
||||||
logger.warn("Error deserializing activity stream json changes")
|
logger.warn("Error deserializing activity stream json changes")
|
||||||
return {}
|
return {}
|
||||||
|
|
||||||
|
|||||||
@@ -2301,7 +2301,6 @@ class JobTemplateSurveySpec(GenericAPIView):
|
|||||||
try:
|
try:
|
||||||
obj.survey_spec = json.dumps(request.data)
|
obj.survey_spec = json.dumps(request.data)
|
||||||
except ValueError:
|
except ValueError:
|
||||||
# TODO: Log
|
|
||||||
return Response(dict(error="Invalid JSON when parsing survey spec."), status=status.HTTP_400_BAD_REQUEST)
|
return Response(dict(error="Invalid JSON when parsing survey spec."), status=status.HTTP_400_BAD_REQUEST)
|
||||||
if "name" not in obj.survey_spec:
|
if "name" not in obj.survey_spec:
|
||||||
return Response(dict(error="'name' missing from survey spec."), status=status.HTTP_400_BAD_REQUEST)
|
return Response(dict(error="'name' missing from survey spec."), status=status.HTTP_400_BAD_REQUEST)
|
||||||
|
|||||||
@@ -880,7 +880,6 @@ class JobTemplateAccess(BaseAccess):
|
|||||||
|
|
||||||
team_ids = Team.objects.filter(deprecated_users__in=[self.user])
|
team_ids = Team.objects.filter(deprecated_users__in=[self.user])
|
||||||
|
|
||||||
# TODO: I think the below queries can be combined
|
|
||||||
deploy_permissions_ids = Permission.objects.filter(
|
deploy_permissions_ids = Permission.objects.filter(
|
||||||
Q(user=self.user) | Q(team_id__in=team_ids),
|
Q(user=self.user) | Q(team_id__in=team_ids),
|
||||||
permission_type__in=allowed_deploy,
|
permission_type__in=allowed_deploy,
|
||||||
@@ -1094,7 +1093,6 @@ class JobAccess(BaseAccess):
|
|||||||
allowed_check = [PERM_JOBTEMPLATE_CREATE, PERM_INVENTORY_DEPLOY, PERM_INVENTORY_CHECK]
|
allowed_check = [PERM_JOBTEMPLATE_CREATE, PERM_INVENTORY_DEPLOY, PERM_INVENTORY_CHECK]
|
||||||
team_ids = Team.objects.filter(deprecated_users__in=[self.user])
|
team_ids = Team.objects.filter(deprecated_users__in=[self.user])
|
||||||
|
|
||||||
# TODO: I think the below queries can be combined
|
|
||||||
deploy_permissions_ids = Permission.objects.filter(
|
deploy_permissions_ids = Permission.objects.filter(
|
||||||
Q(user=self.user) | Q(team__in=team_ids),
|
Q(user=self.user) | Q(team__in=team_ids),
|
||||||
permission_type__in=allowed_deploy,
|
permission_type__in=allowed_deploy,
|
||||||
|
|||||||
@@ -29,12 +29,10 @@ class UriCleaner(object):
|
|||||||
username = o.username
|
username = o.username
|
||||||
password = o.password
|
password = o.password
|
||||||
|
|
||||||
# Given a python MatchObject, with respect to redactedtext, find and
|
# Given a python MatchObject, with respect to redactedtext, find and
|
||||||
# replace the first occurance of username and the first and second
|
# replace the first occurance of username and the first and second
|
||||||
# occurance of password
|
# occurance of password
|
||||||
|
|
||||||
# TODO: Ideally, we would replace username and password using the index
|
|
||||||
# that they were found at.
|
|
||||||
uri_str = redactedtext[match.start():match.end()]
|
uri_str = redactedtext[match.start():match.end()]
|
||||||
if username:
|
if username:
|
||||||
uri_str = uri_str.replace(username, UriCleaner.REPLACE_STR, 1)
|
uri_str = uri_str.replace(username, UriCleaner.REPLACE_STR, 1)
|
||||||
|
|||||||
@@ -322,7 +322,6 @@ def activity_stream_create(sender, instance, created, **kwargs):
|
|||||||
# Skip recording any inventory source directly associated with a group.
|
# Skip recording any inventory source directly associated with a group.
|
||||||
if isinstance(instance, InventorySource) and instance.group:
|
if isinstance(instance, InventorySource) and instance.group:
|
||||||
return
|
return
|
||||||
# TODO: Rethink details of the new instance
|
|
||||||
object1 = camelcase_to_underscore(instance.__class__.__name__)
|
object1 = camelcase_to_underscore(instance.__class__.__name__)
|
||||||
changes = model_to_dict(instance, model_serializer_mapping)
|
changes = model_to_dict(instance, model_serializer_mapping)
|
||||||
# Special case where Job survey password variables need to be hidden
|
# Special case where Job survey password variables need to be hidden
|
||||||
|
|||||||
@@ -142,8 +142,8 @@ def tower_periodic_scheduler(self):
|
|||||||
try:
|
try:
|
||||||
last_run = dateutil.parser.parse(fd.read())
|
last_run = dateutil.parser.parse(fd.read())
|
||||||
return last_run
|
return last_run
|
||||||
except Exception:
|
except Exception as exc:
|
||||||
#TODO: LOG
|
logger.error("get_last_run failed: {}".format(exc))
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def write_last_run(last_run):
|
def write_last_run(last_run):
|
||||||
|
|||||||
Reference in New Issue
Block a user