Skip to content

Refactor construction of error-page proxy url to detention#94

Merged
cflynn07 merged 20 commits intomasterfrom
SAN-3006-refactor-detention
Dec 5, 2015
Merged

Refactor construction of error-page proxy url to detention#94
cflynn07 merged 20 commits intomasterfrom
SAN-3006-refactor-detention

Conversation

@cflynn07
Copy link
Copy Markdown
Contributor

The idea is to send the instance shortHash to detention via a query parameter in the proxy url so detention can query API for an up-to-date instance status and display the correct error message to the user. This PR will be paired with another detention PR

Comment thread lib/models/api.js Outdated
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in the other PR you check for shorthash, do you need to do same check here?
https://github.com/CodeNow/navi/pull/96/files#diff-7ccf25494e1cbc5cba89bfd84e901eb9R293

+    var findResult = mongo.constructor.findMasterPodBranch(naviEntry);
+    instanceShortHash = keypather.get(findResult, 'directUrlShortHash');
+    if (!instanceShortHash) {
+      log.warn(
+        logData,
+        'getTargetHost redis.lrange mongo.fetchNaviEntry isBrowser !instanceShortHash masterpod');
+      return next(ErrorCat.create(404, 'Not Found'));
+    }

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not here, our data * should * never exist in a state without 1 masterPodBranch. That other PR is checking for the event that the referer header is a valid formatted runnable elastic url but isn't actually a url that the target instance has an association with. Different situation. link you shared - that's an acceptable state that can occur.

…etention

* origin/master: (26 commits)
  3.1.4
  Removed async, because I'm not using it!
  3.1.3
  Fixed bad bug where the replace of {{DOMAIN}} was not being ran because the script wasn't replacing it's contents properly.
  Renaming vars. Adding tests.
  Removed counter
  Fixed tests!
  Removed trumpet dep
  Updated logic to search for the first body or head tag.
  Updated search logic to make it a bit easier to read.
  Updated to use through2 logic!
  Removed writing again!
  Rolling back.
  Bypass script adding for the moment.
  Emitting end data.... Apparently?
  Switched back to emit 'data'
  Use this.queue instead of this.write. (testing a theory)
  Emit 'data', data instead of data
  Updated logic for the content stream.
  Another method of handling injection of the script tag at the start of the head.
  ...

Conflicts:
	lib/models/api.js
This reverts commit 689977a.

Conflicts:
	lib/models/proxy.js
@anandkumarpatel
Copy link
Copy Markdown
Contributor

this LGTM now, passing it over to @bkendall to see if his concerns were resolved

@bkendall
Copy link
Copy Markdown
Contributor

bkendall commented Dec 3, 2015

okay, I think the stuff I was looking at is fine now. have some merge conflicts, but resolve those up and you should be good to go.

…etention

* origin/master:
  3.1.5
  Use sinon assert match for method invocation argument testing
  Use sinon assertion and stub API with findAssociationShortHashByElasticUrl stubs
  Revert "Use sinon assertion and stub API with findMasterPodBranch stubs"
  Revert "Use sinon assertion and stub API with findAssociationShortHashByElasticUrl stubs"
  Use sinon assertion and stub API with findAssociationShortHashByElasticUrl stubs
  Use sinon assertion and stub API with findMasterPodBranch stubs
  Use sinon assertion and stub API with _processTargetInstance stubs
  Update tests and masterPod default routeing logic
  Fix naviEntry document selection for routing
  Add additional unit test for new logic
  Proxy to masterPod instance if no DNS mapping

Conflicts:
	lib/models/api.js
	lib/models/mongo.js
	test/unit/api.js
cflynn07 added a commit that referenced this pull request Dec 5, 2015
Refactor construction of error-page proxy url to detention
@cflynn07 cflynn07 merged commit d9577b4 into master Dec 5, 2015
@cflynn07 cflynn07 deleted the SAN-3006-refactor-detention branch December 5, 2015 01:52
@bkendall bkendall removed their assignment Jul 14, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants