mirror of
https://github.com/alexgo-io/stacks-puppet-node.git
synced 2026-04-10 22:41:53 +08:00
subdomain db updates by 'catching up' with new zonefiles
This commit is contained in:
@@ -624,6 +624,7 @@ def list_update_history(name, current_block=None, config_path=CONFIG_PATH, proxy
|
||||
return name_history
|
||||
|
||||
all_update_hashes = []
|
||||
corresponding_block_ids = []
|
||||
block_ids = name_history.keys()
|
||||
block_ids.sort()
|
||||
for block_id in block_ids:
|
||||
@@ -638,9 +639,10 @@ def list_update_history(name, current_block=None, config_path=CONFIG_PATH, proxy
|
||||
|
||||
# changed
|
||||
all_update_hashes.append(value_hash)
|
||||
corresponding_block_ids.append(block_id)
|
||||
|
||||
if return_blockids:
|
||||
return all_update_hashes, block_ids
|
||||
return all_update_hashes, corresponding_block_ids
|
||||
return all_update_hashes
|
||||
|
||||
|
||||
|
||||
@@ -181,7 +181,7 @@ class SubdomainDB(object):
|
||||
self._drop_and_create_table()
|
||||
last_block = 0
|
||||
else:
|
||||
last_block = self.last_seen()
|
||||
last_block = self.last_seen()[1]
|
||||
|
||||
zonefiles, hashes, blockids = data.list_zonefile_history(
|
||||
self.domain, return_hashes = True, from_block = last_block, return_blockids = True)
|
||||
@@ -294,6 +294,10 @@ def _transition_valid(from_sub_record, to_sub_record):
|
||||
return True
|
||||
|
||||
def _build_subdomain_db(domain_fqa, zonefiles, subdomain_db = {}):
|
||||
"""
|
||||
IMPORTANT: zonefiles' origins must ALREADY be verified.
|
||||
|
||||
"""
|
||||
for zf in zonefiles:
|
||||
if isinstance(zf, dict):
|
||||
assert "zonefile" not in zf
|
||||
@@ -302,7 +306,9 @@ def _build_subdomain_db(domain_fqa, zonefiles, subdomain_db = {}):
|
||||
assert isinstance(zf, (str, unicode))
|
||||
zf_json = bs_zonefile.decode_name_zonefile(domain_fqa, zf)
|
||||
assert "zonefile" not in zf_json
|
||||
|
||||
subdomains = parse_zonefile_subdomains(zf_json)
|
||||
domain_name = zf_json["$origin"]
|
||||
|
||||
for subdomain in subdomains:
|
||||
if subdomain.name in subdomain_db:
|
||||
|
||||
@@ -200,7 +200,7 @@ def check( state_engine ):
|
||||
assert 'foo' in user_profile2
|
||||
|
||||
user_profile3 = subdomains.resolve_subdomain_cached_domain("bar", "foo.test")['profile']
|
||||
print "Cache Resolved Profile : {}".format(user_profile2)
|
||||
assert 'bar' in user_profile2
|
||||
print "Cache Resolved Profile : {}".format(user_profile3)
|
||||
assert 'bar' in user_profile3
|
||||
|
||||
return True
|
||||
|
||||
Reference in New Issue
Block a user