-
Notifications
You must be signed in to change notification settings - Fork 64
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
Switches line 40 and 41 to resolve Serial = None issue #151
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
grahamgilbert
pushed a commit
that referenced
this pull request
Feb 6, 2018
* Rewrite inventory to use queries for all views except ApplicationList ApplicationList has some custom data columns that require the group_type and group_id values, which can't be passed through except as part of the path, at least in my experimentation. This works, although it's not ideal. After updating to the newer Datatableview version and API I'll try again. * Update included datatableview * Update to new datatableview API, backpedal on URL changes The datatables don't seem able to (without fooling around with them) to retain the querystring values that are needed for filtering by machine_group, business_unit, etc. This is due to generating the lengthy querystring required for datatables and just replacing the request's querystring. Since the REST API is separate, and the views here need to only work through the web app, AND we will never NOT want to filter by some group (even 'all'), I restored the group_type and group_id values to the URL paths. These are hardcoded and won't have any issues like filtering inventory items by install path. This also migrates to the new datatableview API, which splits up the concept of a datatable from the actual view class that depends on it. * Add SalSettings for inventory filtering Adds: - inventory_exclusion_pattern - filter_proxied_virtualization_apps * Add django User session handling to custom permission class `HasRWPermission.has_object_permission`, at least on current DRF, is never called. Moved to `HasRWPermission.has_permission` and expanded to handle all three authentication possibilities: (a Sal User, AnonymousUser/no auth attempted), an ApiKey. Also do some minor cleanup. * Add `rest_framework` to installed apps, and use global settings Rather than specify identical auth and perm classes on each view, set them once at the global level. Also, remover some boilerplate comments that are not needed. * Add API doc URLs, and clean up base `urls.py` and `api.urls.py` * Remove view-class-level perm and auth overrides. Reorder imports * Use new django-rest-framework explicit field declarations This is required now; either fields or excludes (or inherited through other serializers). This gets them all working. More work could be done to determine whether we actually want to return all fields! * Update django-rest-framework, add markdown and pygments for docs The DRF docs site does syntax highlighting with pygments and makes use of markdown if it's available. * Remove some boilerplate and the now-unused json_response module. * Use `request.user.userprofile.level` for session auth to API * Begin working on API docs. * Start migrating obvious models to ModelViewSets to simplify This commit moves machine/full machines, business units, and machine groups. This uses a SimpleRouter, although once everythings gets moved, a DefaultRouter would be in order. It also restores some of the (seemingly intended) nested values on *full* machines, e.g. facts, conditions, etc. This allows you to create MachineGroups by specifying an ID for business units. May switch to hyperlinked identities later. * Add custom queryfields mixin along with merging Machines endpoints. * Formatting * Update machine_detail Fix broken img url for product icon * Reports can be unzipped if they re small enough * Don't tie ourselves to System Profiler's format. * Support memory to be shipped in KB * != searches could sneak through and not be negated * Because why not * fix multiple dictionary in array conditions. * Golang struct support Golang has strict formatting for exporting data structures (only can use CamelCase). Rather than hack around it in the client, we can make these changes to the server. * Use variables instead of repeating code * Initial commit of 3rd party client docs * keep default behavior for macos, fill osvers twice * re nest if statement for version length * Switches line 40 and 41 to resolve blow-up issue * removed .count() from filter_machines in uptime.py * Add documentation for filtering machine endpoint. * Implement DRF-style Fact and Condition endpoints. * fix: Enable plugins by name This fixes a regression that was introduced with v3.2.5 3.2.4...3.2.5. * fix: Update Machine Details Plugin to enable vi UI Credit to grahamgilbert * Use has_permission instead of has_object_permission in API auth * Bump build number * Factor out machine filter by serial as a mixin * Move Inventory to new DRF style. * Add django-filters to installed apps and start applying to API views * Add machine__hostname to inventory filtering. * Move pending_updates and pending_apple updates. - Add list operation. - Add filter abilities, including machine serial and hostname. - Add search abilities for update model. * Reorder views into alpha order. * Finish moving routes and use DefaultRouter - DefaultRouter gives the API route a browseable landing page at http://sal/api - Remove PluginScriptSubmission as a route and add as a nested value in PluginScriptRow. - The machine search endpoint is no longer needed with the search_fields added to machine, so it was removed. - Built out the SavedSearches endpoint. - Added filters for Facts and Conditions. * Add documentation for search terms and finish adding search and filter fields. * Might as well update this while we're at it. * Remove now unused Mixin for serial filtration. * Restore the QueryFieldsMixin that had been mistakenly removed. * Add `/api/saved_searches/<id>/execute` endpoint. This allows you to execute a saved search, optionally specifying you want the `?full` `Machine` record rather than the abbreviated one (this is an argument to the `search/views.py` `search_machines()` method. Updates the documentation to describe the usage of this endpoint as well. * fix: Proper fix for when Crypt server is not set fixes #151 * fix: Update undeployed to work Should filter using less than or equal to find dates in the past not greater than or equal which would be dates in the future. This also corrects the machine call to use `Machine` (no 's') * work around race conditions in startup by forcing retries * Fix: illegal filter reference in InventoryItem * Fix: missing import for redirect in license views * Sal 3.2.7 * fix: Correct puppet status alignment * correcting reference to Slack channel * Start to be able to search on facts in the basic search * Handle output from GoSal * Bump version * I am not sure why we cannot search on this * return only distinct results for global search * removed race condition work around for PR * Added deploy 'Status' field Displays 'Deployed' or 'Undeployed' depending on 'machine.deployed' value. Adds this key value pair to 'machine_detail' page, as currently the 'Status' plugin is only view where this info can be seen. * Update search_maint.sh for FreeBSD /usr/bin/env is in Linux, macOS and FreeBSD. This allows those of us running sal in FreeBSD to run the script without changing the documentation. * making search_maint.sh path independent Tweaking the script to extract the path from the script location itself (and two dirs up). * missing sal move to the right dir. * Broken client reporting * Bump version * Fix typo in requirements file. * Remove unused imports. * Version the API, restoring the original API code to v1. This commit also creates an alias for existing URL routes to go to the v1 API. Once it's time to switch to v2 as the default, we can just change the alias. * The DRF update means we have to explicitly state fields on v1 api. * Use args to restrict API docs site to v2. * Fix incorrect field querystring name, remove activity from short results * Start testing the API. * More correctly handle saved search full vs machine full params in API. * Start abstracting common test tasks out. * Add fixtures for more involved testing data usage. * Add stdout suppressing decorator for test case methods. * Factor out repetitive auth and get procedures. * Add SavedSearch tests * Lint. * Fix machine result based on failed tests, test full param This is why we test! * Test API Machine list for full param correctness. * Lint and fix typo in test. * Finish SavedSearch testing, lint, nest search serialization * Restructure testing into separate files. Add API general tests. * Use some magic to automatically generate tests for boring endpoints
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Resolves this issue: