Commit Graph

2113 Commits

Author SHA1 Message Date
Leo Hemsted
b4036e062d rework query to use count() 2017-02-16 12:44:40 +00:00
Rebecca Law
ed4b9d34a6 Changes as per code review comments.
Fix my backward date math :P
2017-02-15 17:41:07 +00:00
Rebecca Law
52342afe3f Add a limit to the number of active 2fa codes that we create. At the moment that is set to 10. 2017-02-15 16:18:05 +00:00
Rebecca Law
9de88c50ba Remove test for resetting the failed_login_count, the admin app will request that. 2017-02-15 15:24:42 +00:00
Rebecca Law
c4bf7a1331 Merge branch 'master' into stronger-2fa-security 2017-02-15 14:20:32 +00:00
Rebecca Law
f2cb5bc699 Merge pull request #830 from alphagov/fix-redis-cache
Redis cache bug fix when incrementing the cache
2017-02-15 12:19:03 +00:00
Rebecca Law
07fc71cc4c Fix codestyle 2017-02-15 11:59:31 +00:00
Rebecca Law
74e29708f9 Fix bug where the increment calls set count to 1 if the cache does not exist. 2017-02-15 11:49:19 +00:00
imdadahad
01dcb52389 Merge pull request #825 from alphagov/fix-clear-instance-before-deploy
Remove app and py3 packages on codedeploy-ment
2017-02-15 10:54:39 +00:00
Rebecca Law
6674640330 Removed resetting of the login count 2017-02-15 10:54:09 +00:00
Rebecca Law
fb8d3c58d8 Merge pull request #826 from alphagov/add-template-usage-cache
Add template usage cache
2017-02-14 16:07:11 +00:00
Rebecca Law
53b7ad0961 Moved the cache key to the utils module.
Renamed the dao method.
2017-02-14 14:22:52 +00:00
Rebecca Law
5f48367ee5 Set the expiry time on a verify code (2fa) to 10 minutes.
When the verify code is wrong or expired increment the failed to login count for the user.
When the verify code is successfully used reset the failed login count to 0.
2017-02-14 14:04:11 +00:00
Imdad Ahad
2e4b09154e Remove verbose logging of directory creation 2017-02-14 11:37:47 +00:00
Imdad Ahad
5ac3643d9d Cancel uninstalling all py3 packages 2017-02-14 11:36:38 +00:00
Rebecca Law
1c6cfb9bc8 Got the SqlAlchemy query to work 2017-02-14 11:05:23 +00:00
Rebecca Law
681f52b691 Missed some print statements and unused imports. 2017-02-14 09:59:33 +00:00
Rebecca Law
2346634fec Some code clean up, removed print statements. 2017-02-14 09:54:37 +00:00
Rebecca Law
458adefcb8 Added a redis cache for the template usage stats.
Cache expires every 10 minutes, but will help with the every 2 second query, especially when a job is running.
There is some clean up and qa to do for this yet
2017-02-13 18:47:29 +00:00
Imdad Ahad
383553b964 Remove notify app folder and installed python packages before we deploy the app 2017-02-13 17:13:39 +00:00
Chris Hill-Scott
b2267ae5fc Merge pull request #823 from alphagov/bump-utils-markdown-links
Bump utils to turn on Markdown links
2017-02-13 12:44:19 +00:00
minglis
0ea64080d2 Merge pull request #822 from alphagov/build-stop-scripts
Add a stop celery script into the scripts folder.
2017-02-10 09:09:01 +00:00
imdadahad
7417662fc1 Merge pull request #819 from alphagov/fix-auto-provider-switch-update-history
Fix: Update history when auto switching provider
2017-02-09 10:50:01 +00:00
Imdad Ahad
41a689f4be Update test to assert that the provider history table has been updated 2017-02-08 17:14:46 +00:00
Chris Hill-Scott
6c37686f71 Bump utils to turn on Markdown links 2017-02-08 17:01:44 +00:00
Martyn Inglis
19fd4b3ce9 Log which file we're trying to stop. 2017-02-08 16:58:26 +00:00
Martyn Inglis
a7cfaf3f13 Better logging for multiple instances running. 2017-02-08 16:35:09 +00:00
Martyn Inglis
703e12e516 Code style check passed. 2017-02-08 16:26:12 +00:00
Martyn Inglis
5d0bc0abe8 Add a stop celery script into the scripts folder.
Stopping celery via upstart issues a TERM signal to the whole process group, which immediately kills the worker threads. This can lead to inconsistentcy in the state of a notification as an API call, for example, can take several seconds consequently the likelihood of the call being lost due to a restart is relatively high.

We need to ensure that we stop cleanly to ensure code deploys and autoscale events do not cause issues.

this script is called as part of a pre-stop hook in upstart, which passes a pid file location to the script. The script will then issues the TERM signal to only the master celery process. which will cleanly shut down the workers and exit.

the script will loop based on the existence of a /proc/{pid} for the celery master process. Once the file is gone the script will exit. Upstart blocks on this script before issuing kill on whatever processes may be left hanging around.

the length of the loop is a maximum 15 minutes - which is the tested max time a task may take. In reality it will exit much quicker.
2017-02-08 16:17:50 +00:00
Imdad Ahad
42bb2f14da Add test to check version is updated after switch 2017-02-08 14:15:45 +00:00
Chris Hill-Scott
8cefe6a71b Merge pull request #820 from alphagov/fix-monthly-miscount
Fix miscount with monthly totals
2017-02-08 13:05:43 +00:00
imdadahad
cdc693fae5 Merge pull request #818 from alphagov/feat-add-update-user-password-endpoint
Add separate endpoint to update a user's password
2017-02-08 09:44:29 +00:00
Rebecca Law
08e39d4b93 Merge pull request #816 from alphagov/refactor-send_to_providers
Small refactor to reuse code.
2017-02-07 17:27:51 +00:00
Chris Hill-Scott
0dfa4a93d5 Make sure status dictionary is assinged each time
The status dictionary was being assigned once, and then subsequent
uses of it were by reference. This meant that each template type was
pointing at the same dictionary, and updating one meant updating all.

This commit adds a dictionary comprehension, which gets evaluated once
for each template type, so each template type has its own `dict` of
statuses.

Before
--
```
Email     SMS       Letter
  |        |           |
{'sending':, 'failed', …}
```

After
--
```
Email                SMS                   Letter
   |                  |                      |
{'sending':,      {'sending':,            {'sending':,
'failed',          'failed',               'failed',
…}                 …}                      …}
```
2017-02-07 13:14:58 +00:00
Chris Hill-Scott
4805ccdeed Check email and letter count in monthly stats test
Before we were only checking counts for SMS, because we’d only created
SMS notifications.

This commit also checks the counts for email and letter, which should be
0. But they’re not. So this commit is adding the test case which
demonstrates the bug.
2017-02-07 13:13:06 +00:00
Chris Hill-Scott
dd2e754730 Refactor test into loop
This makes it less repetitive, and will let us add more assertions for
each month that we’re checking.
2017-02-07 13:12:23 +00:00
Imdad Ahad
c512b31afd Update provider history when auto switching provider 2017-02-07 12:38:56 +00:00
Imdad Ahad
a764ba8451 Rename update password test 2017-02-07 11:32:03 +00:00
Imdad Ahad
69b1007c33 Add schema and separate endpoint to update a user password 2017-02-07 11:27:13 +00:00
Imdad Ahad
ac48e4c944 Add separate method to update user password 2017-02-07 11:05:15 +00:00
Rebecca Law
c36d61c071 Update as per comments on review 2017-02-06 16:20:44 +00:00
imdadahad
85b441b445 Merge pull request #817 from alphagov/reset-schedule-for-performance-stats
Reset schedule to run at 00:30 daily
2017-02-03 15:08:28 +00:00
Imdad Ahad
708ef48198 Reset schedule to run at 00:30 daily 2017-02-03 14:57:42 +00:00
Rebecca Law
4085594a53 Small refactor to reuse code. 2017-02-03 14:27:04 +00:00
imdadahad
be24bfe147 Merge pull request #815 from alphagov/fix-perf-platform-stats-job
Fix perf platform stats job
2017-02-03 14:01:25 +00:00
Imdad Ahad
e75b618c6e Use datetime in other test for consistency 2017-02-03 13:35:50 +00:00
Imdad Ahad
1e541b5079 TEMPORARY: Execute every 10 minutes 2017-02-03 13:34:09 +00:00
Imdad Ahad
99cc2f5897 Format date correctly for upload + refactor tests 2017-02-03 13:32:19 +00:00
Chris Hill-Scott
0dca47b249 Merge pull request #813 from alphagov/pep8-rename
Use pycodestyle instead of PEP8
2017-02-02 16:02:02 +00:00
Rebecca Law
30ca9e7e78 Merge pull request #811 from alphagov/check-service-is-active
Check service is active
2017-02-02 11:59:28 +00:00