tucked / yaas

Yet Another Ambari Shell
MIT License
0 stars 2 forks source link

Revise env vars. #8

Closed dmtucker closed 9 years ago

dmtucker commented 9 years ago

I've switched YAAS_SERVER_URL to YAAS_SCHEMA, YAAS_SERVER, and YAAS_PORT for a few reasons.

  1. We can set reasonable defaults for schema and port.
  2. A proper URL (like the example above) includes a path (/); however, it is yaas's job to specify the appropriate path (/api/v1/...). If both do it, we get something like http://ambari.server:8080//api/v1/... which returns a 404.
  3. If we want to be smart about handling 2, we would probably end up parsing out schema, server, and port and storing them separately anyways. If they are split from the beginning, we can save the user some typing and the developer some parsing... win-win.

Also, I'm removing automatic printing from the requests hook. We have to check if verbose mode is set anyways to avoid printing non-verbose (read: redundant) output. Instead, we ought to use a git branch -v-like paradigm which more closely aligns with only printing the JSON response in verbose mode. (Perhaps we add a -vv or --debug option down the road to show the full request and response.)

karth295 commented 9 years ago

I feel like having verbose and debug is overkill--can we just have "--debug" print something like this:

Request: PUT http://ambari.server:8080/api/v1/hosts {"some": "data"} Response: 200 {"more": "data"}