#!/usr/bin/env python # Copyright (C) 2011-2013 OpenStack Foundation # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or # implied. # # See the License for the specific language governing permissions and # limitations under the License. import os_client_config from six.moves import configparser as ConfigParser import time import yaml import fakeprovider import zk class ConfigValue(object): def __eq__(self, other): if isinstance(other, ConfigValue): if other.__dict__ == self.__dict__: return True return False class Config(ConfigValue): pass class Provider(ConfigValue): def __eq__(self, other): if (other.cloud_config != self.cloud_config or other.max_servers != self.max_servers or other.pool != self.pool or other.image_type != self.image_type or other.rate != self.rate or other.api_timeout != self.api_timeout or other.boot_timeout != self.boot_timeout or other.launch_timeout != self.launch_timeout or other.networks != self.networks or other.ipv6_preferred != self.ipv6_preferred or other.clean_floating_ips != self.clean_floating_ips or other.max_concurrency != self.max_concurrency or other.azs != self.azs): return False new_images = other.images old_images = self.images # Check if images have been added or removed if set(new_images.keys()) != set(old_images.keys()): return False # check if existing images have been updated for k in new_images: if (new_images[k].min_ram != old_images[k].min_ram or new_images[k].name_filter != old_images[k].name_filter or new_images[k].username != old_images[k].username or new_images[k].user_home != old_images[k].user_home or new_images[k].private_key != old_images[k].private_key or new_images[k].meta != old_images[k].meta or new_images[k].config_drive != old_images[k].config_drive): return False return True def __ne__(self, other): return not self.__eq__(other) def __repr__(self): return "" % self.name class ProviderImage(ConfigValue): def __repr__(self): return "" % self.name class Label(ConfigValue): def __repr__(self): return "