Skip to content

Commit

Permalink
Remove md5sum check for environment vs user_config
Browse files Browse the repository at this point in the history
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
  • Loading branch information
andymcc committed Apr 13, 2015
1 parent bfd033d commit 5341949
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 48 deletions.
2 changes: 0 additions & 2 deletions 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
Expand Down
4 changes: 0 additions & 4 deletions etc/openstack_deploy/openstack_user_config.yml.example
Expand Up @@ -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.
Expand Down
40 changes: 0 additions & 40 deletions playbooks/inventory/dynamic_inventory.py
Expand Up @@ -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.
Expand Down Expand Up @@ -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):
Expand Down
2 changes: 0 additions & 2 deletions scripts/bootstrap-aio.sh
Expand Up @@ -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
Expand Down

0 comments on commit 5341949

Please sign in to comment.