Fix issue with intermittent test failures in test_pkg.py

The test failures were a result of randomized test order and the way
in which these tests were setting up mocks for pexpect.spawn.expect
and pexpect.spawn.match.

The code now mocks pexpect.spawn and then sets return values and match
in each test as appropriate. Code in setUp establishes a patch and a
cleanUp function is added to reverse the patch. No code is required in
tearDown as a result.

execute() was being Mocked using code in setUp and tearDown and this
was replaced that with a similar patch in setUp with a corresponding
cleanUp function to reverse its effects.

Since we're close to Juno, I've not gone down the path of converting
this test to use a fixture which would further reduce duplicated code.

Change-Id: I3edfd499823f2c2f4591e709384a24f1b55abe5a
Closes-Bug: 1365531
Marks mysql slave read-only

When a slave is attached to a master site, this change will
mark the slave site as read-only to prevent the slave site
from being updated by users.  Only users with root privileges
or slave priveleges will be able to update the database.

Change-Id: Idb6c54b85a23af9a468ff9d62b3110fa72ff7da0
Closes-bug: #1359392
Register postgres_group in trove config

Change-Id: I9e2c4c166550fbfe77c394e0b5220220d07469df
Closes-Bug: #1367467
Merge "Marks mysql slave read-only"
Merge "Fix issue with intermittent test failures in test_pkg.py"
Strengthens the regex for mongodb json functions

Encloses function args in quotes. abc: Foo(foo, bar)
changes to abc : "foo, bar". Intent is to prevent
mongodb json peculiarities from preventing parsing
of the json

Change-Id: Iafd81cf74908078155344ef4746632d48c460f6a
Closes-Bug: #1368373
Fix NoSuchOptError on Couchbase create

A previous commit moved the backup_incremental_strategy option from
DEFAULT group to datastore specific grouping. However, the option was
only implemented for Mysql and Percona so when any datastore that had
backup support (like Couchbase) attempted to start, it received a
NoSuchOptError because of the missing option.

This fix put an empty dict in for the option for all datastores that
don't currently have backup or incremental backup support implemented.

Note: this wasn't picked up by any automated tests because the gate
currently only tests MySQL.

Author: Doug Shelley <doug@parelastic.com>
Co-Authored-By: Amrith Kumar <amrith@tesora.com>
Change-Id: I6a11dcf79c483a43ebdf79085d1bd17d653afe59
Closes-Bug: 1366175
Imported Translations from Transifex

Change-Id: I020032ab9a35b0dedfb0875cb717aa89d7abca84
Merge "Fix NoSuchOptError on Couchbase create"
Fixed database migration script issues

The db downgrade scripts are currently not dropping foreign key
constraints, causing errors when the script tries to drop related
tables on downgrade.

This commit address issues in the migration scripts, and also
introduces a new test script to test the migration scripts, so that
issues can be prevented in the future. The new test script is based
on the existing migration test script implementated in Nova.

Change-Id: I240d81afc3e43fd3711de8c156cfb43fd14850bf
Closes-Bug: #1347114
Added unit test for test_migration_utils.
tox -e py27 and mysql migration was successful.
Still need to test with postgres, clean up code and remove my comments.
Removed my comments and cleaned up for PEP8
Merge branch 'bug/1347114-dev' of github.com:changsimon/trove into bug/1347114-dev

Change-Id: Ib344e6b78bc18e6660fc0ef8341111c4fa42fa99