def add_abstract_tier_environment(self, environment_name, tier_name, products_information): url = "%s/%s/%s/%s" % (self.paasmanager_url, "catalog/org/FIWARE/environment", environment_name, "tier") tier = Tier(tier_name, self.image) if products_information: products = self.__process_product(products_information) for product in products: tier.add_product(product) payload = tostring(tier.to_tier_xml()) self.__add_tier_environment(url, payload)
def add_tier_environment_network(self, environment_name, tier_name, region='Trento', products_information=None, networks=None): url = "%s/%s/%s/%s/%s/%s/%s" % ( self.paasmanager_url, "catalog/org/FIWARE", "vdc", self.vdc, "environment", environment_name, "tier") tier = Tier(tier_name, self.image, region) if products_information: products = self.__process_product(products_information) for product in products: tier.add_product(product) if networks: networks = self.__process_metwork(networks) for net in networks: tier.add_network(net) print tostring(tier.to_tier_xml()) payload = tostring(tier.to_tier_xml()) print payload self.__add_tier_environment(url, payload)
def __process_environment(self, env): environment = Environment(env['name'], env['description']) try: tiers_string = env['tierDtos'] except: environment.to_string() return environment if isinstance(tiers_string, list): for tier_string in tiers_string: tier = Tier(tier_string['name'], self.image, tier_string['region']) try: products_string = tier_string['productReleaseDtos'] if isinstance(products_string, list): for product_string in products_string: product = ProductRelease(product_string['productName'], product_string['version']) tier.add_product(product) else: product = ProductRelease(products_string['productName'], products_string['version']) tier.add_product(product) except: pass environment.add_tier(tier) else: tier = Tier(tiers_string['name'], self.image) try: products_string = tiers_string['productReleaseDtos'] if isinstance(products_string, list): for product_string in products_string: producte = Product(product_string['productName']) product_release = ProductRelease(producte, product_string['version']) tier.add_product(product_release) else: product = ProductRelease(products_string['productName'], products_string['version']) tier.add_product(product) environment.add_tier(tier) except: print 'error' pass environment.to_string() return environment
def add_tier(self, tier_name, cidr_block, subnet_size=21): tier = Tier(name=tier_name, cidr_block=cidr_block, connection=self.connection, vpc_id=self.id) tier.build([z.name for z in self.region.get_zones()], subnet_size) self.add_tier_tag(tier) return tier
month=MONTH, ranked_only=ONLY_RANKED) to_parse = downloader.download_matches( unique_matches, download_again=REDOWNLOAD_SMALL_FILES) matches_json = Parser.load_matches(unique_matches) tier_positions = p.identify_heroes( replacements, matches_json, forced_replacements, min_couple_matches=MIN_MATCHES_WITH_HERO) tiers = [] for c in categories: if c.rule == 'position': tier = Tier( c.weight, tier_positions[c.parameter], 'Win rate as %s in %s matches' % (c.parameter, TEAM_NAME)) tiers.append((tier, c)) elif c.rule == 'versatility': tier = Tier(c.weight, p.player_versatility(), 'Versatility in %s matches' % TEAM_NAME) tiers.append((tier, c)) elif c.rule == 'discord' and TEAM_NAME == PNK: tier = Tier(c.weight, p.discord(discord_ids, discord_data), 'Total time spoken on Discord') tiers.append((tier, c)) elif c.rule == 'fantasy_value' and TEAM_NAME == PNK: tier = Tier(c.weight, p.fantasy_value_tiers(fantasy_data), 'Sum of Fantasy Cards in ƒ coins') tiers.append((tier, c)) elif c.rule == 'coins_worth' and TEAM_NAME == PNK: