From 5341949f02a1c0ae056e84eeaf4a295ebf4a86f5 Mon Sep 17 00:00:00 2001 From: Andy McCrae Date: Mon, 13 Apr 2015 11:15:04 +0100 Subject: [PATCH] Remove md5sum check for environment vs user_config The md5sum check doesn't currently solve any issues we have, and with the addition of a custom "env.d" directory this will only cause frustration as the md5sum changes. The initial idea was to prompt a user to update their user_config/user_variables/environment files between updates in the os-a-d repository but the md5sum check never really solved this problem, since both the files being checked won't have changed if you update the repo and don't copy the new versions over. Change-Id: Id1e7d307aa5dbffe069d6d4fa4569dd13ad4e8c1 Partial-Bug: #1399430 --- .../openstack_user_config.yml | 2 - .../openstack_user_config.yml.example | 4 -- playbooks/inventory/dynamic_inventory.py | 40 ------------------- scripts/bootstrap-aio.sh | 2 - 4 files changed, 48 deletions(-) diff --git a/etc/openstack_deploy/openstack_user_config.yml b/etc/openstack_deploy/openstack_user_config.yml index ee27da8708..c1edacdfdc 100644 --- a/etc/openstack_deploy/openstack_user_config.yml +++ b/etc/openstack_deploy/openstack_user_config.yml @@ -1,6 +1,4 @@ --- -environment_version: a09bd162bf75ed2044b054c33b777929 - cidr_networks: container: 172.29.236.0/22 tunnel: 172.29.240.0/22 diff --git a/etc/openstack_deploy/openstack_user_config.yml.example b/etc/openstack_deploy/openstack_user_config.yml.example index 4e549a8ee5..98b01847fc 100644 --- a/etc/openstack_deploy/openstack_user_config.yml.example +++ b/etc/openstack_deploy/openstack_user_config.yml.example @@ -13,10 +13,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -# This is the md5 of the environment file -# this will ensure consistency when deploying. -environment_version: 35946eced47eb8461f1eea62fa01bcf0 - # User defined container networks in CIDR notation. The inventory generator # assigns IP addresses to network interfaces inside containers from these # ranges. diff --git a/playbooks/inventory/dynamic_inventory.py b/playbooks/inventory/dynamic_inventory.py index 5c18473fe1..22e89c0e61 100755 --- a/playbooks/inventory/dynamic_inventory.py +++ b/playbooks/inventory/dynamic_inventory.py @@ -811,34 +811,6 @@ def append_if(array, item): return array -def md5_checker(localfile): - """Check for different Md5 in CloudFiles vs Local File. - - If the md5 sum is different, return True else False - - :param localfile: - :return True|False: - """ - - def calc_hash(): - """Read the hash. - - :return data_hash.read(): - """ - - return data_hash.read(128 * md5.block_size) - - if os.path.isfile(localfile) is True: - md5 = hashlib.md5() - with open(localfile, 'rb') as data_hash: - for chk in iter(calc_hash, ''): - md5.update(chk) - - return md5.hexdigest() - else: - raise SystemExit('This [ %s ] is not a file.' % localfile) - - def _merge_dict(base_items, new_items): """Recursively merge new_items into some base_items. @@ -907,18 +879,6 @@ def main(): with open(environment_file, 'rb') as f: environment = yaml.safe_load(f.read()) - # Check the version of the environment file - env_version = md5_checker(localfile=environment_file) - version = user_defined_config.get('environment_version') - if env_version != version: - raise SystemExit( - 'The MD5 sum of the environment file does not match the expected' - ' value. To ensure that you are using the proper environment' - ' please repull the correct environment file from the upstream' - ' repository. Found MD5: [ %s ] expected MD5 [ %s ]' - % (env_version, version) - ) - # Load anything in an env.d directory if found env_plugins = os.path.join(local_path, 'env.d') if os.path.isdir(env_plugins): diff --git a/scripts/bootstrap-aio.sh b/scripts/bootstrap-aio.sh index 173496c71e..4a717a3d6c 100755 --- a/scripts/bootstrap-aio.sh +++ b/scripts/bootstrap-aio.sh @@ -248,8 +248,6 @@ scripts/pw-token-gen.py --file /etc/openstack_deploy/user_secrets.yml # change the generated passwords for the OpenStack (admin) sed -i "s/keystone_auth_admin_password:.*/keystone_auth_admin_password: ${ADMIN_PASSWORD}/" /etc/openstack_deploy/user_secrets.yml -ENV_VERSION="$(md5sum /etc/openstack_deploy/openstack_environment.yml | awk '{print $1}')" -sed -i "s/environment_version:.*/environment_version: ${ENV_VERSION}/" /etc/openstack_deploy/openstack_user_config.yml sed -i "s/external_lb_vip_address:.*/external_lb_vip_address: ${PUBLIC_ADDRESS}/" /etc/openstack_deploy/openstack_user_config.yml # Service region set