Commit Graph

6987 Commits

Author SHA1 Message Date
Leo Hemsted
09decfe3a8 Merge pull request #2460 from alphagov/forgot-about-beat
add delivery-celery-beat to paas_app_wrapper
2019-04-12 11:25:02 +01:00
Leo Hemsted
95ca533df2 add delivery-celery-beat to paas_app_wrapper
Forget about beats by dre
2019-04-12 11:10:18 +01:00
Rebecca Law
22fc4b693a The previous PR added a error handler for the wrong db exception.
This corrects it to look for the unique constraint.
2019-04-12 10:55:21 +01:00
Leo Hemsted
5d26724022 Merge pull request #2456 from alphagov/remove-multi-app-manifests
Remove multi app manifests
2019-04-12 10:34:49 +01:00
Rebecca Law
1c68e0f565 Remove unused method.
last_n_days was only being used in a test.
2019-04-12 10:26:46 +01:00
Rebecca Law
622b3e76f7 Merge pull request #2454 from alphagov/populate-volumne-intentions
Command to populate the volume intentions for services.
2019-04-12 09:44:57 +01:00
Rebecca Law
b7ecaa4a40 Merge pull request #2453 from alphagov/update-response-for-duplicate-domains
Return a useful message if the domain is a duplicate.
2019-04-12 09:44:29 +01:00
Pea Tyczynska
2d71aea7a1 Get rid of an unneeded flag - destination endpoint is slimmer now and doesnt need it 2019-04-11 16:33:40 +01:00
Chris Hill-Scott
08f67dcfdd Merge pull request #2457 from alphagov/count-live-services-and-organisations
Add method to count of live services and orgs
2019-04-11 16:22:54 +01:00
Leo Hemsted
3277c65a7c add jinja2-cli to dev requirements 2019-04-11 15:05:44 +01:00
Leo Hemsted
c786258a60 give instances and NOTIFY_APP_NAME sensible defaults
NOTIFY_APP_NAME follows precedent and just tries to strip 'notify-'
from the beginning of the string.

instances is not specified at all if not defined - it'll scale up to
the same amount of instances as currently present, and then the
autoscaler will take over anyway
2019-04-11 14:57:22 +01:00
Pea Tyczynska
dd9e285684 Refactor preview_letter_template_by_notification_id 2019-04-11 14:27:57 +01:00
Pea Tyczynska
63fe210202 Also show overlay on document download of failed letter
And of course test this new flex
2019-04-11 14:27:12 +01:00
Pea Tyczynska
2f52a8fd64 Call overlaid preview for precompiled letters that fail validation
Also test precompiled letter preview with overlay
2019-04-11 14:26:59 +01:00
Chris Hill-Scott
6bfd999de2 Add method to count of live services and orgs
So that we don’t have to update the home page manually any more.
2019-04-11 13:54:43 +01:00
Leo Hemsted
575ec96b6b fix test that checks manifest contains references to all queues 2019-04-10 16:48:21 +01:00
Leo Hemsted
8cc5d40291 remove old manifest files and creation script 2019-04-10 15:21:30 +01:00
Leo Hemsted
7d9cd58e89 rename public-api to api
we don't use the public-api bit anywhere - even cloudwatch overwrites
based on CW_APP_NAME (which we can get rid of as this distinction is
gone)
2019-04-10 15:19:46 +01:00
Leo Hemsted
66ca98fbfb create manifest from jinja template
newer versions of cf api don't allow you to have multiple apps per
manifest file. So, instead of our current inheritance based model, move
to the newer doc-dl/antivirus/template-preview approved jinja based
model.

the new single manifest.yml.j2 file sets a bunch of variables based on
the CF_APP variable - things like NOTIFY_APP_NAME, default instances,
etc. Then the manifest is built up to define all of the app options
based on these defaults. Things default to sensible values, which can
vary based on environment.

When adding new environment variables, you'll need to add them to the
manifest file. If they're json encoded lists, you'll need to pass them
back to the `tojson` filter, or jinja2 will print them as python lists,
with single quotes around strings.
2019-04-10 15:15:48 +01:00
pyup-bot
adcdac636e Update sqlalchemy from 1.2.18 to 1.3.2 2019-04-10 14:00:12 +01:00
pyup-bot
bd51d82443 Update psycopg2-binary from 2.7.7 to 2.8.1 2019-04-10 14:00:11 +01:00
pyup-bot
0efce16ebf Update marshmallow from 2.19.1 to 2.19.2 2019-04-10 14:00:09 +01:00
pyup-bot
670a50127d Update eventlet from 0.23.0 to 0.24.1 2019-04-10 14:00:08 +01:00
pyup-bot
ee4f0d1b59 Update cffi from 1.12.1 to 1.12.2 2019-04-10 14:00:07 +01:00
Rebecca Law
ba8ab45edf Command to populate the volume intentions for services. 2019-04-10 13:38:12 +01:00
Alexey Bezhan
3845e90ee4 Merge pull request #2452 from alphagov/pin-gunicorn-pyup
Stop pyup from trying to upgrade gunicorn
2019-04-10 13:35:01 +01:00
Rebecca Law
f35960c3a3 Return a useful message if the domain is a duplicate. 2019-04-10 13:23:34 +01:00
Rebecca Law
707d0c349b Merge pull request #2451 from alphagov/stop-using-history-for-perf-platform
Switch table in query to Notification from NotificationHistory
2019-04-10 12:58:40 +01:00
Alexey Bezhan
d43b53db73 Stop pyup from trying to upgrade gunicorn 2019-04-10 11:32:11 +01:00
Rebecca Law
a53340b4d7 Update the query that gets the number of notifications that have been sent under 10 seconds to use Notifications rather than NotificationHistory.
Also removed a test that is not useful
2019-04-10 10:06:27 +01:00
Leo Hemsted
fe77d4f654 move commands from manifest to procfile
cf v3 commands don't appear to support commands in manifest files. They
say that they do, but in practice they fail on cf v3-zdt-push with an
error message "No process types returned from stager". This can be
solved by moving the command from the manifest to a Procfile.

However, the Procfile is part of the source code, and as such is the
same for each app. To get around this, make the Procfile command invoke
a new wrapper script, which checks the NOTIFY_APP_NAME env var and then
calls the correct command
2019-04-09 17:05:56 +01:00
Rebecca Law
193ff8548c Merge pull request #2450 from alphagov/email-branding-unique-constraint
Update EmailBranding.name to be not null and unique.
2019-04-09 14:47:09 +01:00
Rebecca Law
e5663ceec9 Merge pull request #2448 from alphagov/fix-alert-for-ack-file
The rstrip() was not working for all file names.
2019-04-09 14:36:22 +01:00
Rebecca Law
64428368d1 Update EmailBranding.name to be not null and unique.
Needed to update old migration scripts so that the email_branding name is not null when creating the test dbs.
This should no affect the migrations elsewhere.
2019-04-09 14:33:38 +01:00
Rebecca Law
4ce2b9eaba The rstrip was not working for all file names so this changes it to a replace. 2019-04-08 12:04:14 +01:00
Rebecca Law
1ce044011c Merge pull request #2447 from alphagov/associate-all-services
The active flag in the query was excluding some services.
2019-04-08 11:37:24 +01:00
Rebecca Law
aca2817184 The active flag in the query was excluding some services.
The active flag wasn't always used, plus a service should always be active on the first version of the service.
2019-04-08 11:24:45 +01:00
Chris Hill-Scott
5a7de22f55 Set default branding for NHS services
The NHS is a special case because it’s not one organisation, but it does
have one consistent brand. So anyone working for an NHS organisation
should have their default branding set when they create a service, even
if we know nothing about their specific organisation.
2019-04-08 10:27:26 +01:00
Rebecca Law
0b4030183c Merge pull request #2446 from alphagov/fix-command
Ignore services where an organisation was not found.
2019-04-05 17:13:47 +01:00
Rebecca Law
7cb51840b5 Ignore services where an organisation was not found. 2019-04-05 17:03:11 +01:00
Chris Hill-Scott
eeb90bed57 Do all version table writes in one commit
The behaviour of stacking the version decorators does not work as
expected.

What you would expect to happen is that each decorator causes a history
row to be written for its respective model object.

What actually happens is that the first decorator adds history records
to the database session, but then causes the database session to commit.
This means that subsequent uses of this decorator find a clean session,
and therefore no changes to copy to their respective history tables.

This commit changes the intended use of the decorator so that it is only
used once per function, and accepts multiple definitions of what to
record history for. This way it can record everything that needs to go
into the history before doing anything that would risk flushing the
session.
2019-04-05 16:11:46 +01:00
Chris Hill-Scott
c257ec105c Raise exception if history can’t be written
This is fiendishly difficult error to discover on your own.

It’s caused when, during the creation of a row in the database, you run
a query on the same table, or a table that joins to the table you’re
inserting into. What I think is happening is that the database is forced
to flush the session before running the query in order to maintain
consistency.

This means that the session is clean by the time the history stuff comes
to do its work, so there’s nothing for it to copy into the history
table, and it silently fails to record history.

Hopefully raising an exception will:
- prevent this from failing silently
- save whoever comes across this issue in the future a whole load of
  time
2019-04-05 16:11:46 +01:00
Chris Hill-Scott
ab22a3d88c Merge pull request #2440 from alphagov/set-default-domains
Set default branding for all organisations
2019-04-05 16:07:30 +01:00
Chris Hill-Scott
f26abe87b2 Merge pull request #2443 from alphagov/ignore-gsi-when-search-for-domain
Ignore gsi in email address when searching for organisation
2019-04-05 16:07:05 +01:00
Rebecca Law
36b4a344fc Update the dao_get_organisation_by_email_address to ignore .gsi in the email address. 2019-04-05 15:47:16 +01:00
Chris Hill-Scott
2ef9618e70 Set default branding for all organisations
Currently when someone creates a service we match them to an
organisation. Then if the organisation has a default branding set, their
service gets that branding.

However none of the organisations yet have a default branding set up.
This commit migrates the data about the relationship between an
organisation and its branding from being inferred from the `domain`
field on the branding, to being a proper database relationship.
2019-04-05 15:40:20 +01:00
Rebecca Law
905251fbb8 Merge pull request #2441 from alphagov/associate-services-to-organisations
Command to associate services to organisations.
2019-04-05 15:12:57 +01:00
Rebecca Law
1848c358f3 Command to associate services to organisations.
The association is based on the email address of the user that created the service, meaning we need to look at version 1 of the service_history.
Then use the existing methods to find the organisation by email address, then add the association.
2019-04-05 15:02:58 +01:00
Chris Hill-Scott
c13d5f0d6d Merge pull request #2434 from alphagov/get-org-by-domain
Add a method to guess organisation from a domain
2019-04-05 14:51:40 +01:00
Rebecca Law
4a085a1e31 Merge pull request #2438 from alphagov/collate-letter-pdfs-cronitor
Add Cronitor decorator collate-letter-pdfs-for-day
2019-04-05 13:57:45 +01:00