Prove CMS r39 restoration and version runtime fingerprints
This commit is contained in:
@@ -92,7 +92,8 @@ def cms_application_inventory():
|
||||
|
||||
def cms_installed_release():
|
||||
for row in load_state(FAILED_STATE_FILE):
|
||||
if row.get('component') in ('dc-cms-release','dc-cms-autodeploy') and row.get('started_apply') and not str(row.get('rollback_status','')).startswith('ok:'):
|
||||
if (row.get('component') in ('dc-cms-release','dc-cms-autodeploy') and row.get('started_apply')
|
||||
and not str(row.get('rollback_status','')).startswith('ok:') and not cms_r39_reconciled(row)):
|
||||
die('CMS deployment requires failed-rollback reconciliation')
|
||||
rows = [r for r in load_state(STATE_FILE) if r.get('component') == 'dc-cms-release']
|
||||
if rows:
|
||||
@@ -172,7 +173,7 @@ def preflight_cms_release(payload, entries, identity):
|
||||
if not set(installed) <= set(entries):die('CMS v1 release cannot remove existing application files')
|
||||
cms_healthchecks()
|
||||
return {'descriptor':d,'entries':list(entries),'predecessor':previous['sourceCommit'],
|
||||
'runtime':cms_runtime_snapshot(),'otherServices':cms_other_services(),
|
||||
'runtimeFingerprintVersion':2,'runtime':cms_runtime_snapshot_v2(),'otherServices':cms_other_services(),
|
||||
'foundation':cms_foundation(),'data':cms_preserved_data(),'installedFiles':installed,'installedMetadata':metadata}
|
||||
|
||||
|
||||
@@ -211,9 +212,16 @@ for(const d of ['admin','server'])for(const n of fs.readdirSync('/app/'+d)){
|
||||
|
||||
def accept_cms_release(before, *, rollback=False):
|
||||
cms_healthchecks()
|
||||
current=cms_runtime_snapshot();old=before['runtime']
|
||||
version=before.get('runtimeFingerprintVersion',1)
|
||||
if type(version) is not int or version not in (1,2):die('CMS runtime fingerprint version mismatch')
|
||||
current=cms_runtime_snapshot_v2() if version==2 else cms_runtime_snapshot();old=before['runtime']
|
||||
if current['configSha256'] != old['configSha256'] or current['imageRef'] != old['imageRef']:
|
||||
die('CMS environment, mounts, ports or network topology changed')
|
||||
detail=''
|
||||
if version==2:
|
||||
previous=old.get('fieldSha256') or {};actual=current.get('fieldSha256') or {}
|
||||
changed=sorted(k for k in set(previous)|set(actual) if previous.get(k)!=actual.get(k))
|
||||
detail='; fields='+','.join(changed)
|
||||
die('CMS environment, mounts, ports or network topology changed'+detail)
|
||||
expected_image=old['imageId'] if rollback else before['builtImageId']
|
||||
if current['imageId'] != expected_image or (not rollback and current['id']==old['id']):
|
||||
die('CMS selected service image/generation mismatch')
|
||||
|
||||
Reference in New Issue
Block a user