463 Commits

Author SHA1 Message Date
tomdds
33c6e8c68c Merge CSP secret handling implementations and refine updating. 2020-01-29 18:22:21 -05:00
tomdds
0bc0e15134 Merge branch 'staging' into azure-config-values 2020-01-29 16:50:44 -05:00
tomdds
d4dd581b7a Implement principal creation and admin elevation provisioning features. 2020-01-29 16:17:28 -05:00
dandds
63b5ddbdd4 Merge branch 'staging' into app-env-provisioning 2020-01-29 11:16:55 -05:00
dandds
abd03be806 Store and pull tenant creds from Key Vault.
The tenant ID should be hashed and used as the key for the JSON blob of
relevant creds for any given tenant. Azure CSP interface methods that
need to source creds should call the internal `_source_creds` method,
either with a `tenant_id` or no parameters. That method will source the
creds. If a tenant ID is provided, it will source them from the Key
Vault. If not provided, it will return the default creds for the app
registration in the home tenant.
2020-01-29 10:49:27 -05:00
tomdds
144312863c Draft implementations of remote admin creation and root management group ownership. 2020-01-28 20:14:50 -05:00
tomdds
7bf6b9addc Remove creds from payloads and passthroughs. 2020-01-28 14:12:04 -05:00
dandds
67bfe09bbf
Merge branch 'staging' into alpha-numeric-to-numbers 2020-01-28 11:24:40 -05:00
dandds
a10d733fb7 Fix test and LGTM warnings.
- Fixes LGTM warnings for an unused import and equality comparisons to
  None in SQLAlchemy filters.
- Removes part of a unit test asserting that the claimed_until locking
  mechanism works correctly. If I recall correctly, this does not work
  in unit tests because the test takes place inside a transaction, and
  the database provider does evaluate the current time until the
  transaction is written.
2020-01-27 06:27:18 -05:00
dandds
ef8f92b678 Merge branch 'staging' into app-env-provisioning 2020-01-26 18:56:29 -05:00
dandds
37a5218a1d Split and barrel cloud module for merge. 2020-01-26 18:38:02 -05:00
tomdds
5b0a523e92 Use more specific imports for cloud models and exceptions. 2020-01-26 15:52:55 -05:00
tomdds
466a575229 Move portfolio state machine helpers directly to model file to prevent import issues.
Having `get_stage_csp_class` in the csp module meant that any file that interacted with that import path would throw an error in a REPL. This will allow importing of the Azure and Mock providers for interactive dev.
2020-01-26 15:17:53 -05:00
tomdds
d02d47615e First step in breaking out cloud.py
Move cloud.py to a module init. Move policy with it. Update related unit tests. Also adds a patch to state machine test to prevent randomness in mock from failing test.
2020-01-26 14:03:09 -05:00
dandds
8810a59e0a Orchestration for creating app management groups.
This adds:
- A Celery beat task for enqueuing application creation tasks
- A Celery task for creating the application
- Payload and Response dataclasses for creating management groups

It also does some incidental cleanup.
2020-01-26 12:23:33 -05:00
dandds
02438dc39b Query for applications that need to be provisioned.
Adds a method to the Applications domain class that can return a list of
UUIDs for applications that are ready to be provisioned. It requires
that:

- the associated portfolio and state machine have a state of COMPLETED
- the application not have been marked deleted
- the application not have an existing cloud_id
- the application does not have an existing claim on it
2020-01-25 14:30:17 -05:00
tomdds
f08d53d7a0 Transition all Cloud Interface Methods to use Dataclasses 2020-01-24 15:42:23 -05:00
tomdds
b9206ed7be Some more LGTM fixes 2020-01-24 13:35:46 -05:00
tomdds
35eea8e31c
Merge branch 'staging' into azure-custom-integration 2020-01-24 11:16:11 -05:00
tomdds
e9d03ec68b Fix some LGTM errors and start sketching in credential update functionality 2020-01-24 11:15:35 -05:00
tomdds
910920af44 Formatting fixes 2020-01-24 11:03:38 -05:00
tomdds
ea040a914e Properly report initial clin information
Includes fixed up state machine test as well as adds some missing dependencies
2020-01-24 11:01:53 -05:00
leigh-mil
84d0a32694 Update TO form to account for new TO rules: alpha numeric, between 13 and 17 characters, dashes should be stripped, and coerce to uppercase 2020-01-24 09:18:22 -05:00
dandds
944c5d3c9f Forcibly destroy existing session on logout.
To comply with security guidelines, we need to destroy the session when
a user logs out. This means that the session's key in the Redis cache
needs to be deleted. Flask expects to _always_ have a session object. If
the current session object does not exist in the Redis cache, Flask will
reserialize and store it at the end of the request. In order for
session deletion to work, we need to delete the key for the existing
session and then replace the session object with a new, empty one.

This also updates the SessionLimiter class so that the session prefix is
configurable.
2020-01-23 10:31:20 -05:00
597ea32e42 portfolio provision process. add logging, __repr___ method, fix broken tests 2020-01-23 10:14:22 -05:00
tomdds
e5332897f1 Fix formatting 2020-01-22 14:52:06 -05:00
tomdds
1b1a20cf52 Restore implementations for policies and management group creation
These were accidentally stripped out during a rebase.
2020-01-22 14:39:30 -05:00
tomdds
f5e4b603cb Bring naming conventions for methods and classes related to CSP provisioning in line with state machine 2020-01-22 13:39:41 -05:00
tomdds
d646c3c00f Updates from Production Scripts
Made a bunch of tweaks when using these tests to run production scripts for initial setup, this brings over a bunch of those changes
2020-01-22 13:39:41 -05:00
tomdds
b1adaf771d state machine integration wip 2020-01-22 13:39:35 -05:00
187ee0033e state machine unit tests 2020-01-16 10:32:30 -05:00
tomdds
81f23ebc22 Finish first passes at baseline tenant integration
Add last of the integrations for setting up billing and reporting a CLIN.
2020-01-14 17:17:34 -05:00
tomdds
161462f3cb Sample create and validate billing profile integration
Adds 2 methods to the azure csp interface to create and subsequently validate creation of the billing profile.
2020-01-14 17:16:54 -05:00
tomdds
7c22922d6d Create new AliasModel for CSP datalcasses, ignore credentials when converting to dictionary.This will allow all of our dataclasses to convert automatically between python style snake_case and the camelCase that the Azure APIs use. This also allows us to default to that behavior while specifying aliases for any fields as necessary.Additionally, any dataclass including the creds schema will have those creds removed from their dict representation. This can help keep creds out of logs as well as making the dataclasses more consumable for API usage. 2020-01-14 17:16:54 -05:00
tomdds
2ac333e0b7 Sample create tenant itegration
This integration works with the happy path, we'll need to expand some fields and handle error states more coherently.
2020-01-14 17:16:54 -05:00
tomdds
dfee80680d Skip legacy azure csp tests 2020-01-14 16:36:16 -05:00
tomdds
7b2c77298d Fix app name collision errors in portfolio tests 2020-01-14 16:36:16 -05:00
tomdds
d81d953c31 Fix formatting and some typos 2020-01-14 16:36:16 -05:00
Philip Kalinsky
69bd2f43a5 provision portfolio state machine 2020-01-14 16:36:16 -05:00
leigh-mil
17864cc060 Add migration to change environment_roles role column from string to
enum type.
Fix tests and functions affected by the column type change.
2020-01-14 13:12:29 -05:00
leigh-mil
79b2773852 Portfolio manager invite updates:
- Update the form to use BooleanFields for the permissions and make the
form more similar to the Application Members form
- Use MemberFormTemplate macro in the portfolio settings template
- fix tests affected by the form changes
2020-01-10 10:25:55 -05:00
graham-dds
490d778743 Better incorporate fixture data into reporting
Before this commit, if a portfolio wasn't present in the spending fixture
data, the reporting screen would be empty -- even if the portfolio had
applications and environments associated with it on the database. Now,
0s appear if an application and / or environment isn't present in the
fixture data.
2020-01-06 12:01:13 -05:00
dandds
3bfb6c9621 Basic implementation for a policy wrapper.
The implementation here is meant to wrap a library of JSON policy
documents. Policies should be added to directories corresponding to
where they will be defined (portfolio, application, environment).
Functionality for parsing portfolio policy definitions is included. When
the policies need to be defined on a management group, the
AzureCloudProvider can iterate the appropriate tier of the policy
manager and add those definitions.
2019-12-20 10:34:12 -05:00
dandds
b61956080e Initial policies and method for creating policy definition.
This adds some initial example policies:

- One for region restrictions
- One for service restrictions

Note that the MS ARM team has said that region restrictions may be
controlled by ARM, so that policy might prove unnecessary. The
parameters list for the service restrictions is stubbed for now, pending
the full list.

I also added an internal method for adding policy definitions to a
management group. This method is agnostic about what tier of management
group the policy is being defined at. It requires that a dictionary
representing the properties section of a valid Azure JSON policy
definition be passed as an argument.
2019-12-20 10:34:12 -05:00
leigh-mil
812caf5d7d Update schema and create/update Environments domain methods to enforce environment name uniqueness within an application context. 2019-12-18 10:54:17 -05:00
leigh-mil
22dd5d7b85 Add migration for enforcing uniqueness of an application name within a portfolio and update create/update Applicaiton domain methods. 2019-12-16 14:39:32 -05:00
leigh-mil
6446b4fbd0 Raise AlreadyExistsError if a task order is created or updated with a number of an existing task order 2019-12-13 14:53:58 -05:00
leigh-mil
1550f32b4c
Merge branch 'staging' into to-index-page-redesign_part-3 2019-12-13 13:01:11 -05:00
leigh-mil
2552d4c700 Styling for empty status accordion and update Not signed to Unsigned 2019-12-13 11:49:50 -05:00
tomdds
8a1ed5b193 Sketch in Management Group integration for Azure
Add mocks and real implementations for creating nested management groups that reflect the Portfolio->Application->Environment->Subscription hierarchy.
2019-12-13 10:53:24 -05:00