Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove /api/v1 and deprecated credential fields #3413

Merged
merged 6 commits into from
Jun 10, 2019

Conversation

ryanpetrello
Copy link
Contributor

No description provided.

@softwarefactory-project-zuul
Copy link
Contributor

Build failed.

if field_name in V1Credential.FIELDS:
return self.build_standard_field(field_name,
V1Credential.FIELDS[field_name])
return super(V1CredentialFields, self).build_field(field_name, info, model_class, nested_depth)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh thank heaven

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll second that. This was the worst 😂

@@ -6,4 +6,4 @@ One result should be returned containing the following fields:

{% include "api/_result_fields_common.md" %}

Use the primary URL for the user (/api/v1/users/N/) to modify the user.
Use the primary URL for the user (/api/v2/users/N/) to modify the user.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

well this wasn't ideal documentation. We could peel some of these off for sooner merge.

@@ -23,7 +22,6 @@
urls = [
url(r'^$', JobList.as_view(), name='job_list'),
url(r'^(?P<pk>[0-9]+)/$', JobDetail.as_view(), name='job_detail'),
url(r'^(?P<pk>[0-9]+)/start/$', JobStart.as_view(), name='job_start'), # Todo: Remove In 3.3
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it took sooo many years...

# the given list without merging with JT credentials
if prompted_value:
obj._deprecated_credential_launch = True # signal to not merge credentials
new_credentials.extend(prompted_value)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this removal of the loop looks good on first read. It'll need some more attention when we get closer to merge.

@@ -3412,56 +3349,17 @@ class SystemJobTemplateNotificationTemplatesSuccessList(SubListCreateAttachDetac
relationship = 'notification_templates_success'


class JobList(ListCreateAPIView):
class JobList(ListAPIView):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@@ -2853,13 +2799,6 @@ class JobTemplateJobsList(SubListCreateAPIView):
relationship = 'jobs'
parent_key = 'job_template'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

JobTemplateJobsList(SubListCreateAPIView)

--> sublist view, as with jobs list

'Group "%s" from v1 API is not deleted by overwrite',
self.inventory_source.deprecated_group.name
)
del_group_pks.discard(self.inventory_source.deprecated_group_id)

This comment was marked as resolved.

@ryanpetrello
Copy link
Contributor Author

recheck

@softwarefactory-project-zuul
Copy link
Contributor

Build failed.

def get_queryset(self):
# TODO: remove after the depreciation of v1 API
qs = super(UnifiedJobTemplateAccess, self).get_queryset()
return qs.exclude(inventorysource__source="")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should remove all inventory sources with source="" through a data migration, and remove empty string from the choices for the source field. (Django might help you auto-generate a migration file after you make the change to the choices)

I've been turning this over in my mind, and it just doesn't make any sense to keep them.

@softwarefactory-project-zuul
Copy link
Contributor

Build failed.

@softwarefactory-project-zuul
Copy link
Contributor

Build failed.

@softwarefactory-project-zuul
Copy link
Contributor

Build succeeded.

else:
return ['copy', 'edit', 'delete']
def show_capabilities(self):
return ['copy', 'edit', 'delete']
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This, as well as the other similar method, no longer needs to be a @property it can just be

show_capabilities = ['copy', 'edit', 'delete']

@softwarefactory-project-zuul
Copy link
Contributor

Build failed.

@softwarefactory-project-zuul
Copy link
Contributor

Build succeeded.

@ryanpetrello ryanpetrello force-pushed the bye-bye-v1 branch 2 times, most recently from 60d3d97 to e66da4c Compare May 30, 2019 01:19
@kdelee
Copy link
Member

kdelee commented May 30, 2019

Not sure where this is going on but this is a bug:

GIVEN a cred that has "prompt on launch" associated with a JT,
should NOT be able to make a schedule.

But right now you are able to

@softwarefactory-project-zuul
Copy link
Contributor

Build succeeded.

summary_fields['extra_credentials'] = extra_creds
summary_fields['credentials'] = all_creds
if self.is_detail_view:
summary_fields['extra_credentials'] = extra_creds
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since you removed the credential field, I don't know if I agree with providing extra_credentials in the summary fields (I know there's a lot of special handling in the job launch view too). Aren't these both parts of the same compatibility shim?

I do see extra_credentials referenced in javascript, which does seem like a problem.

So I'm still lacking an idea of exactly which fields are being removed, and why.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm... going back and fourth with the job launch view, I think I'm seeing better the intentionality of this. I'm inferring that extra_credentials was maybe introduced later than credential and vault_credential, and gives cloud credentials in general.

Copy link
Contributor Author

@ryanpetrello ryanpetrello May 30, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've kind of gone back and forth on this, and my rationale here was that the extra_credentials interface is considerably more recent than the the credential and vault_credential polyfills (cir. Ansible Tower 3.3, providing support for multiple cloud/network credentials vs Ansible Tower 3.2).

I would like to remove extra_credentials (it's been deprecated for some time), but I think it would be more responsible to keep it around for awhile longer.

@AlanCoding
Copy link
Member

AlanCoding commented May 30, 2019

@kdelee I agree that looks like a bug, is it specific to this branch, or is it pre-existing?

I think I'm about done with this, but that seems like 1 open question that's still hanging around.

Copy link
Member

@AlanCoding AlanCoding left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no more questions left to ask

@kdelee
Copy link
Member

kdelee commented May 30, 2019

@AlanCoding looking more into it looks like might be bug on my side of how I am associating credentials

'id': cred.pk,
'name': cred.name,
'description': cred.description,
'kind': cred.kind,
Copy link
Contributor

@jakemcdermott jakemcdermott Jun 6, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we will most likely be removing kind from credentials in the near future but we haven't done so yet - so i've included the kind field in the summary to keep it consistent with how we represent summarized credentials elsewhere.

@softwarefactory-project-zuul
Copy link
Contributor

Build succeeded.

@softwarefactory-project-zuul
Copy link
Contributor

Build succeeded.

ryanpetrello and others added 6 commits June 6, 2019 12:23
Currently, the credentials list doesn't seem to be returning
any options data for 'kind' so this code wasn't being reached. In
the future api updates, we'll also be removing the 'kind' field from
credentials in general.
@softwarefactory-project-zuul
Copy link
Contributor

Build failed.

@jakemcdermott
Copy link
Contributor

recheck

@softwarefactory-project-zuul
Copy link
Contributor

Build succeeded.

Copy link
Member

@mabashian mabashian left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

UI changes lgtm

@softwarefactory-project-zuul
Copy link
Contributor

Build succeeded (gate pipeline).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants