)]}'
{"docs/DeveloperDocs/agent_internals.md":[{"author":{"_account_id":11809,"name":"Craig Bryant","email":"craig.bryant@hpe.com","username":"craig-bryant"},"change_message_id":"2d7183c054daf82d1a32cfa4767115476cdc5407","unresolved":false,"context_lines":[{"line_number":140,"context_line":"Kubernetes Connector is a class within [monasca-collector utils](https://github.com/openstack/monasca-agent/blob/master/monasca_agent/collector/checks/utils.py)"},{"line_number":141,"context_line":"that is used for connecting to the Kubernetes API from within a container that is running in a k8 cluster."},{"line_number":142,"context_line":""},{"line_number":143,"context_line":"When a container is brought up in Kubernetes by default there is environmental variables passed in that include needed"},{"line_number":144,"context_line":"configurations to connect to the API. On top of that in the container Kubernetes places down need certs for the connection."},{"line_number":145,"context_line":""},{"line_number":146,"context_line":"# License"}],"source_content_type":"text/x-markdown","patch_set":5,"id":"3a461143_9bca826d","line":143,"range":{"start_line":143,"start_character":62,"end_line":143,"end_character":64},"updated":"2017-02-01 23:34:57.000000000","message":"are","commit_id":"ff57f6c38085a1005036e0857fa97284ea376678"},{"author":{"_account_id":11809,"name":"Craig Bryant","email":"craig.bryant@hpe.com","username":"craig-bryant"},"change_message_id":"2d7183c054daf82d1a32cfa4767115476cdc5407","unresolved":false,"context_lines":[{"line_number":141,"context_line":"that is used for connecting to the Kubernetes API from within a container that is running in a k8 cluster."},{"line_number":142,"context_line":""},{"line_number":143,"context_line":"When a container is brought up in Kubernetes by default there is environmental variables passed in that include needed"},{"line_number":144,"context_line":"configurations to connect to the API. On top of that in the container Kubernetes places down need certs for the connection."},{"line_number":145,"context_line":""},{"line_number":146,"context_line":"# License"},{"line_number":147,"context_line":"(C) Copyright 2016,2017 Hewlett Packard Enterprise Development LP"}],"source_content_type":"text/x-markdown","patch_set":5,"id":"3a461143_fb9f0663","line":144,"range":{"start_line":144,"start_character":38,"end_line":144,"end_character":122},"updated":"2017-02-01 23:34:57.000000000","message":"rewrite this to be clearer","commit_id":"ff57f6c38085a1005036e0857fa97284ea376678"},{"author":{"_account_id":16168,"name":"Tomasz Trębski","email":"kornicameister@gmail.com","username":"trebskit"},"change_message_id":"a9446dea4ee7aaa7657ba36aacceab47ec1edcb8","unresolved":false,"context_lines":[{"line_number":6,"context_line":"  - [Examples](#examples)"},{"line_number":7,"context_line":"      - [Adding a new instance](#adding-a-new-instance)"},{"line_number":8,"context_line":"      - [Changing the current instance](#changing-the-current-instance)"},{"line_number":9,"context_line":"- [Kubernetes Connector](#Kubernetes-Connector)"},{"line_number":10,"context_line":"- [License](#license)"},{"line_number":11,"context_line":""},{"line_number":12,"context_line":"\u003c!-- END doctoc generated TOC please keep comment here to allow auto update --\u003e"}],"source_content_type":"text/x-markdown","patch_set":11,"id":"9a30ddce_31832258","line":9,"updated":"2017-03-09 05:13:49.000000000","message":"Maybe rather a chapter called Connectors and move KubernetesConnector under it ?","commit_id":"2f195fbf18b1a36eb9c60d5a5302d1120db74322"},{"author":{"_account_id":18179,"name":"Kaiyan Sheng","email":"kaiyan.sheng@hpe.com","username":"kaiyan-sheng"},"change_message_id":"f288960130767cb80ade36a059fcbd1d1696ca53","unresolved":false,"context_lines":[{"line_number":6,"context_line":"  - [Examples](#examples)"},{"line_number":7,"context_line":"      - [Adding a new instance](#adding-a-new-instance)"},{"line_number":8,"context_line":"      - [Changing the current instance](#changing-the-current-instance)"},{"line_number":9,"context_line":"- [Kubernetes Connector](#Kubernetes-Connector)"},{"line_number":10,"context_line":"- [License](#license)"},{"line_number":11,"context_line":""},{"line_number":12,"context_line":"\u003c!-- END doctoc generated TOC please keep comment here to allow auto update --\u003e"}],"source_content_type":"text/x-markdown","patch_set":11,"id":"9a30ddce_a2405808","line":9,"in_reply_to":"9a30ddce_31832258","updated":"2017-03-10 17:37:49.000000000","message":"That\u0027s a good idea! Maybe later on we will have more connectors that need documented :-)","commit_id":"2f195fbf18b1a36eb9c60d5a5302d1120db74322"}],"monasca_agent/collector/checks/utils.py":[{"author":{"_account_id":11809,"name":"Craig Bryant","email":"craig.bryant@hpe.com","username":"craig-bryant"},"change_message_id":"adf4d8f9df20f007250cf9aa2727a0d3e6257772","unresolved":false,"context_lines":[{"line_number":57,"context_line":""},{"line_number":58,"context_line":"# Conversion from memory represented in string format to bytes"},{"line_number":59,"context_line":"def convert_memory_string_to_bytes(memory_string):"},{"line_number":60,"context_line":"    if \"m\" in memory_string:"},{"line_number":61,"context_line":"        memory \u003d float(memory_string.split(\u0027m\u0027)[0])"},{"line_number":62,"context_line":"        return memory / 1000"},{"line_number":63,"context_line":"    elif \"K\" in memory_string:"}],"source_content_type":"text/x-python","patch_set":2,"id":"3a461143_178b0169","line":60,"range":{"start_line":60,"start_character":7,"end_line":60,"end_character":11},"updated":"2017-01-31 16:54:42.000000000","message":"What does milli bytes? That seems really strange.","commit_id":"b8bfdba1a1a3c294679ab94b4989c8c7d355edfc"},{"author":{"_account_id":15027,"name":"Michael Hoppal","email":"michael.jam.hoppal@hpe.com","username":"michael-hoppal"},"change_message_id":"9b7903fc3a72b94a04138777329deb2e9b6a24db","unresolved":false,"context_lines":[{"line_number":57,"context_line":""},{"line_number":58,"context_line":"# Conversion from memory represented in string format to bytes"},{"line_number":59,"context_line":"def convert_memory_string_to_bytes(memory_string):"},{"line_number":60,"context_line":"    if \"m\" in memory_string:"},{"line_number":61,"context_line":"        memory \u003d float(memory_string.split(\u0027m\u0027)[0])"},{"line_number":62,"context_line":"        return memory / 1000"},{"line_number":63,"context_line":"    elif \"K\" in memory_string:"}],"source_content_type":"text/x-python","patch_set":2,"id":"3a461143_9737f14b","line":60,"range":{"start_line":60,"start_character":7,"end_line":60,"end_character":11},"in_reply_to":"3a461143_178b0169","updated":"2017-01-31 17:03:23.000000000","message":"kubernetes - read the section \"Resource quantities\" in the documentation https://github.com/kubernetes/community/blob/master/contributors/design-proposals/resources.md","commit_id":"b8bfdba1a1a3c294679ab94b4989c8c7d355edfc"},{"author":{"_account_id":11809,"name":"Craig Bryant","email":"craig.bryant@hpe.com","username":"craig-bryant"},"change_message_id":"adf4d8f9df20f007250cf9aa2727a0d3e6257772","unresolved":false,"context_lines":[{"line_number":91,"context_line":"    # Get necessary variables from container environment to connect to Kubernetes API"},{"line_number":92,"context_line":"    def set_kubernetes_api_connection_info(self):"},{"line_number":93,"context_line":"        cacert_path \u003d \u0027/run/secrets/kubernetes.io/serviceaccount/ca.crt\u0027"},{"line_number":94,"context_line":"        token_path \u003d \u0027/var/run/secrets/kubernetes.io/serviceaccount/token\u0027"},{"line_number":95,"context_line":"        try:"},{"line_number":96,"context_line":"            with open(token_path) as token_file:"},{"line_number":97,"context_line":"                token \u003d token_file.read()"}],"source_content_type":"text/x-python","patch_set":2,"id":"3a461143_3750fd0a","line":94,"range":{"start_line":94,"start_character":23,"end_line":94,"end_character":73},"updated":"2017-01-31 16:54:42.000000000","message":"Does this ever change? Should it be reread each time?","commit_id":"b8bfdba1a1a3c294679ab94b4989c8c7d355edfc"},{"author":{"_account_id":15027,"name":"Michael Hoppal","email":"michael.jam.hoppal@hpe.com","username":"michael-hoppal"},"change_message_id":"9b7903fc3a72b94a04138777329deb2e9b6a24db","unresolved":false,"context_lines":[{"line_number":91,"context_line":"    # Get necessary variables from container environment to connect to Kubernetes API"},{"line_number":92,"context_line":"    def set_kubernetes_api_connection_info(self):"},{"line_number":93,"context_line":"        cacert_path \u003d \u0027/run/secrets/kubernetes.io/serviceaccount/ca.crt\u0027"},{"line_number":94,"context_line":"        token_path \u003d \u0027/var/run/secrets/kubernetes.io/serviceaccount/token\u0027"},{"line_number":95,"context_line":"        try:"},{"line_number":96,"context_line":"            with open(token_path) as token_file:"},{"line_number":97,"context_line":"                token \u003d token_file.read()"}],"source_content_type":"text/x-python","patch_set":2,"id":"3a461143_d73df92b","line":94,"range":{"start_line":94,"start_character":23,"end_line":94,"end_character":73},"in_reply_to":"3a461143_3750fd0a","updated":"2017-01-31 17:03:23.000000000","message":"i am not sure, i will have to look into that. In our kubernetes cluster it has not for however long the agent was running (couple weeks)","commit_id":"b8bfdba1a1a3c294679ab94b4989c8c7d355edfc"},{"author":{"_account_id":15027,"name":"Michael Hoppal","email":"michael.jam.hoppal@hpe.com","username":"michael-hoppal"},"change_message_id":"cc0ffa271f6ac0a7b3ea2fa4797577fca0df9107","unresolved":false,"context_lines":[{"line_number":91,"context_line":"    # Get necessary variables from container environment to connect to Kubernetes API"},{"line_number":92,"context_line":"    def set_kubernetes_api_connection_info(self):"},{"line_number":93,"context_line":"        cacert_path \u003d \u0027/run/secrets/kubernetes.io/serviceaccount/ca.crt\u0027"},{"line_number":94,"context_line":"        token_path \u003d \u0027/var/run/secrets/kubernetes.io/serviceaccount/token\u0027"},{"line_number":95,"context_line":"        try:"},{"line_number":96,"context_line":"            with open(token_path) as token_file:"},{"line_number":97,"context_line":"                token \u003d token_file.read()"}],"source_content_type":"text/x-python","patch_set":2,"id":"3a461143_c20b287c","line":94,"range":{"start_line":94,"start_character":23,"end_line":94,"end_character":73},"in_reply_to":"3a461143_d73df92b","updated":"2017-02-02 14:11:53.000000000","message":"Hi Craig,\n\nI really appreciate this question. Looking into this more each container is under a serviceaccount (kubernetes creates one for each namespace by default) that has a token/cert associated with it. That is classified as a secret in kubernetes and is mounted to each container. If it is changed it should be updated in these files. I put new logic in there to handle that (401 from API). Another thing I did test is I deleted the serviceaccount/secret and kubernetes created a new one with a different token/cacert. In that case it continue to accept the old token,cert. If you want more on this I can point you to documentation.\n\ngreat find though.\n\nMichael","commit_id":"b8bfdba1a1a3c294679ab94b4989c8c7d355edfc"},{"author":{"_account_id":11809,"name":"Craig Bryant","email":"craig.bryant@hpe.com","username":"craig-bryant"},"change_message_id":"adf4d8f9df20f007250cf9aa2727a0d3e6257772","unresolved":false,"context_lines":[{"line_number":101,"context_line":"        api_host \u003d os.environ.get(\u0027KUBERNETES_SERVICE_HOST\u0027, \"kubernetes\")"},{"line_number":102,"context_line":"        api_port \u003d os.environ.get(\u0027KUBERNETES_SERVICE_PORT\u0027, \"443\")"},{"line_number":103,"context_line":"        self.api_url \u003d \"https://{}:{}\".format(api_host, api_port)"},{"line_number":104,"context_line":"        self.api_request_header \u003d {\u0027Authorization\u0027: \u0027Bearer {}\u0027.format(token)}"},{"line_number":105,"context_line":"        self.api_verify \u003d cacert_path if os.path.exists(cacert_path) else False"},{"line_number":106,"context_line":""},{"line_number":107,"context_line":"    # Obtain host the agent is running on in Kubernetes"}],"source_content_type":"text/x-python","patch_set":2,"id":"3a461143_d7adf9e9","line":104,"range":{"start_line":104,"start_character":53,"end_line":104,"end_character":77},"updated":"2017-01-31 16:54:42.000000000","message":"This will result in \u0027Bearer None\u0027 if the token file can\u0027t be opened. Is that correct?","commit_id":"b8bfdba1a1a3c294679ab94b4989c8c7d355edfc"},{"author":{"_account_id":15027,"name":"Michael Hoppal","email":"michael.jam.hoppal@hpe.com","username":"michael-hoppal"},"change_message_id":"9b7903fc3a72b94a04138777329deb2e9b6a24db","unresolved":false,"context_lines":[{"line_number":101,"context_line":"        api_host \u003d os.environ.get(\u0027KUBERNETES_SERVICE_HOST\u0027, \"kubernetes\")"},{"line_number":102,"context_line":"        api_port \u003d os.environ.get(\u0027KUBERNETES_SERVICE_PORT\u0027, \"443\")"},{"line_number":103,"context_line":"        self.api_url \u003d \"https://{}:{}\".format(api_host, api_port)"},{"line_number":104,"context_line":"        self.api_request_header \u003d {\u0027Authorization\u0027: \u0027Bearer {}\u0027.format(token)}"},{"line_number":105,"context_line":"        self.api_verify \u003d cacert_path if os.path.exists(cacert_path) else False"},{"line_number":106,"context_line":""},{"line_number":107,"context_line":"    # Obtain host the agent is running on in Kubernetes"}],"source_content_type":"text/x-python","patch_set":2,"id":"3a461143_57bca9ba","line":104,"range":{"start_line":104,"start_character":53,"end_line":104,"end_character":77},"in_reply_to":"3a461143_d7adf9e9","updated":"2017-01-31 17:03:23.000000000","message":"yes, might not be the behavior i want. I will look into it","commit_id":"b8bfdba1a1a3c294679ab94b4989c8c7d355edfc"},{"author":{"_account_id":16168,"name":"Tomasz Trębski","email":"kornicameister@gmail.com","username":"trebskit"},"change_message_id":"9966825d75c7a68a8545d04194e78f59da030332","unresolved":false,"context_lines":[{"line_number":88,"context_line":"        self.api_request_header \u003d None"},{"line_number":89,"context_line":"        self.set_kubernetes_api_connection_info()"},{"line_number":90,"context_line":""},{"line_number":91,"context_line":"    # Get necessary variables from container environment to connect to Kubernetes API"},{"line_number":92,"context_line":"    def set_kubernetes_api_connection_info(self):"},{"line_number":93,"context_line":"        cacert_path \u003d \u0027/run/secrets/kubernetes.io/serviceaccount/ca.crt\u0027"},{"line_number":94,"context_line":"        token_path \u003d \u0027/var/run/secrets/kubernetes.io/serviceaccount/token\u0027"}],"source_content_type":"text/x-python","patch_set":3,"id":"3a461143_f3367401","line":91,"updated":"2017-02-01 05:14:04.000000000","message":"Shouldn\u0027t those comments be part of doc string ?","commit_id":"6bb4c7a621141ce1cf5dab03110a32b083758077"},{"author":{"_account_id":15027,"name":"Michael Hoppal","email":"michael.jam.hoppal@hpe.com","username":"michael-hoppal"},"change_message_id":"270b80642e20a81043fdcbe42edbfcbe10c918cb","unresolved":false,"context_lines":[{"line_number":88,"context_line":"        self.api_request_header \u003d None"},{"line_number":89,"context_line":"        self.set_kubernetes_api_connection_info()"},{"line_number":90,"context_line":""},{"line_number":91,"context_line":"    # Get necessary variables from container environment to connect to Kubernetes API"},{"line_number":92,"context_line":"    def set_kubernetes_api_connection_info(self):"},{"line_number":93,"context_line":"        cacert_path \u003d \u0027/run/secrets/kubernetes.io/serviceaccount/ca.crt\u0027"},{"line_number":94,"context_line":"        token_path \u003d \u0027/var/run/secrets/kubernetes.io/serviceaccount/token\u0027"}],"source_content_type":"text/x-python","patch_set":3,"id":"3a461143_81ff88a9","line":91,"in_reply_to":"3a461143_f3367401","updated":"2017-02-01 15:28:27.000000000","message":"yes you are right will update.","commit_id":"6bb4c7a621141ce1cf5dab03110a32b083758077"},{"author":{"_account_id":16168,"name":"Tomasz Trębski","email":"kornicameister@gmail.com","username":"trebskit"},"change_message_id":"9966825d75c7a68a8545d04194e78f59da030332","unresolved":false,"context_lines":[{"line_number":90,"context_line":""},{"line_number":91,"context_line":"    # Get necessary variables from container environment to connect to Kubernetes API"},{"line_number":92,"context_line":"    def set_kubernetes_api_connection_info(self):"},{"line_number":93,"context_line":"        cacert_path \u003d \u0027/run/secrets/kubernetes.io/serviceaccount/ca.crt\u0027"},{"line_number":94,"context_line":"        token_path \u003d \u0027/var/run/secrets/kubernetes.io/serviceaccount/token\u0027"},{"line_number":95,"context_line":"        try:"},{"line_number":96,"context_line":"            with open(token_path) as token_file:"}],"source_content_type":"text/x-python","patch_set":3,"id":"3a461143_333d5cdd","line":93,"updated":"2017-02-01 05:14:04.000000000","message":"Maybe class level constants ?","commit_id":"6bb4c7a621141ce1cf5dab03110a32b083758077"},{"author":{"_account_id":15027,"name":"Michael Hoppal","email":"michael.jam.hoppal@hpe.com","username":"michael-hoppal"},"change_message_id":"270b80642e20a81043fdcbe42edbfcbe10c918cb","unresolved":false,"context_lines":[{"line_number":90,"context_line":""},{"line_number":91,"context_line":"    # Get necessary variables from container environment to connect to Kubernetes API"},{"line_number":92,"context_line":"    def set_kubernetes_api_connection_info(self):"},{"line_number":93,"context_line":"        cacert_path \u003d \u0027/run/secrets/kubernetes.io/serviceaccount/ca.crt\u0027"},{"line_number":94,"context_line":"        token_path \u003d \u0027/var/run/secrets/kubernetes.io/serviceaccount/token\u0027"},{"line_number":95,"context_line":"        try:"},{"line_number":96,"context_line":"            with open(token_path) as token_file:"}],"source_content_type":"text/x-python","patch_set":3,"id":"3a461143_41912052","line":93,"in_reply_to":"3a461143_333d5cdd","updated":"2017-02-01 15:28:27.000000000","message":"yes probably right will move","commit_id":"6bb4c7a621141ce1cf5dab03110a32b083758077"},{"author":{"_account_id":11809,"name":"Craig Bryant","email":"craig.bryant@hpe.com","username":"craig-bryant"},"change_message_id":"2d7183c054daf82d1a32cfa4767115476cdc5407","unresolved":false,"context_lines":[{"line_number":81,"context_line":""},{"line_number":82,"context_line":"class KubernetesConnector(object):"},{"line_number":83,"context_line":"    \"\"\"Class for connecting to Kubernetes API from within a container running in a Kubernetes environment\"\"\""},{"line_number":84,"context_line":"    cacert_path \u003d \u0027/run/secrets/kubernetes.io/serviceaccount/ca.crt\u0027"},{"line_number":85,"context_line":"    token_path \u003d \u0027/var/run/secrets/kubernetes.io/serviceaccount/token\u0027"},{"line_number":86,"context_line":""},{"line_number":87,"context_line":"    def __init__(self):"}],"source_content_type":"text/x-python","patch_set":5,"id":"3a461143_5baf3a94","line":84,"range":{"start_line":84,"start_character":4,"end_line":84,"end_character":15},"updated":"2017-02-01 23:34:57.000000000","message":"Should this be capitalized?","commit_id":"ff57f6c38085a1005036e0857fa97284ea376678"},{"author":{"_account_id":14273,"name":"Joe Keen","email":"joe.keen@hpe.com","username":"jkeen"},"change_message_id":"4916418251284850811ecac4263367683ce16ca2","unresolved":false,"context_lines":[{"line_number":3,"context_line":"import base64"},{"line_number":4,"context_line":"import logging"},{"line_number":5,"context_line":"import math"},{"line_number":6,"context_line":"import os"},{"line_number":7,"context_line":"import requests"},{"line_number":8,"context_line":""},{"line_number":9,"context_line":"log \u003d logging.getLogger(__name__)"}],"source_content_type":"text/x-python","patch_set":7,"id":"1a430d35_8839fd43","line":6,"range":{"start_line":6,"start_character":7,"end_line":6,"end_character":9},"updated":"2017-02-06 21:37:37.000000000","message":"Is this import used?","commit_id":"9490c4ca025793e089c7f094fb4cedb08fd5f346"},{"author":{"_account_id":15027,"name":"Michael Hoppal","email":"michael.jam.hoppal@hpe.com","username":"michael-hoppal"},"change_message_id":"7e90a3979d41acc99582a4e5affbd5426d3a147e","unresolved":false,"context_lines":[{"line_number":3,"context_line":"import base64"},{"line_number":4,"context_line":"import logging"},{"line_number":5,"context_line":"import math"},{"line_number":6,"context_line":"import os"},{"line_number":7,"context_line":"import requests"},{"line_number":8,"context_line":""},{"line_number":9,"context_line":"log \u003d logging.getLogger(__name__)"}],"source_content_type":"text/x-python","patch_set":7,"id":"1a430d35_42543220","line":6,"range":{"start_line":6,"start_character":7,"end_line":6,"end_character":9},"in_reply_to":"1a430d35_8839fd43","updated":"2017-02-07 15:34:53.000000000","message":"yes for env variable look up","commit_id":"9490c4ca025793e089c7f094fb4cedb08fd5f346"},{"author":{"_account_id":14273,"name":"Joe Keen","email":"joe.keen@hpe.com","username":"jkeen"},"change_message_id":"4916418251284850811ecac4263367683ce16ca2","unresolved":false,"context_lines":[{"line_number":116,"context_line":"        pod_name \u003d os.environ.get(\"AGENT_POD_NAME\")"},{"line_number":117,"context_line":"        pod_namespace \u003d os.environ.get(\"AGENT_POD_NAMESPACE\")"},{"line_number":118,"context_line":"        if not pod_name or not pod_namespace:"},{"line_number":119,"context_line":"            raise Exception(\"pod_name and pod_namespace is not set as environment variables cannot derive host\")"},{"line_number":120,"context_line":"        pod_url \u003d \"/api/v1/namespaces/{}/pods/{}\".format(pod_namespace, pod_name)"},{"line_number":121,"context_line":"        try:"},{"line_number":122,"context_line":"            agent_pod \u003d self.get_request(pod_url, connection_timeout)"}],"source_content_type":"text/x-python","patch_set":7,"id":"1a430d35_68277164","line":119,"range":{"start_line":119,"start_character":18,"end_line":119,"end_character":27},"updated":"2017-02-06 21:37:37.000000000","message":"Is it worth making a specific exception type here?  Perhaps break it into two exceptions so we know which part of the environment wasn\u0027t set correctly?","commit_id":"9490c4ca025793e089c7f094fb4cedb08fd5f346"},{"author":{"_account_id":15027,"name":"Michael Hoppal","email":"michael.jam.hoppal@hpe.com","username":"michael-hoppal"},"change_message_id":"7e90a3979d41acc99582a4e5affbd5426d3a147e","unresolved":false,"context_lines":[{"line_number":116,"context_line":"        pod_name \u003d os.environ.get(\"AGENT_POD_NAME\")"},{"line_number":117,"context_line":"        pod_namespace \u003d os.environ.get(\"AGENT_POD_NAMESPACE\")"},{"line_number":118,"context_line":"        if not pod_name or not pod_namespace:"},{"line_number":119,"context_line":"            raise Exception(\"pod_name and pod_namespace is not set as environment variables cannot derive host\")"},{"line_number":120,"context_line":"        pod_url \u003d \"/api/v1/namespaces/{}/pods/{}\".format(pod_namespace, pod_name)"},{"line_number":121,"context_line":"        try:"},{"line_number":122,"context_line":"            agent_pod \u003d self.get_request(pod_url, connection_timeout)"}],"source_content_type":"text/x-python","patch_set":7,"id":"1a430d35_883f3dd5","line":119,"range":{"start_line":119,"start_character":18,"end_line":119,"end_character":27},"in_reply_to":"1a430d35_68277164","updated":"2017-02-07 15:34:53.000000000","message":"I think so for specific exception will change not sure about two","commit_id":"9490c4ca025793e089c7f094fb4cedb08fd5f346"},{"author":{"_account_id":18179,"name":"Kaiyan Sheng","email":"kaiyan.sheng@hpe.com","username":"kaiyan-sheng"},"change_message_id":"2c5b55cb3c7ed2310e7b2bb42e1b98ebfcaed721","unresolved":false,"context_lines":[{"line_number":116,"context_line":"        pod_name \u003d os.environ.get(\"AGENT_POD_NAME\")"},{"line_number":117,"context_line":"        pod_namespace \u003d os.environ.get(\"AGENT_POD_NAMESPACE\")"},{"line_number":118,"context_line":"        if not pod_name or not pod_namespace:"},{"line_number":119,"context_line":"            raise Exception(\"pod_name and pod_namespace is not set as environment variables cannot derive host\")"},{"line_number":120,"context_line":"        pod_url \u003d \"/api/v1/namespaces/{}/pods/{}\".format(pod_namespace, pod_name)"},{"line_number":121,"context_line":"        try:"},{"line_number":122,"context_line":"            agent_pod \u003d self.get_request(pod_url, connection_timeout)"}],"source_content_type":"text/x-python","patch_set":7,"id":"9a30ddce_3f18ff74","line":119,"range":{"start_line":119,"start_character":18,"end_line":119,"end_character":27},"in_reply_to":"1a430d35_7f1b7b73","updated":"2017-03-10 17:37:54.000000000","message":"Done","commit_id":"9490c4ca025793e089c7f094fb4cedb08fd5f346"},{"author":{"_account_id":14273,"name":"Joe Keen","email":"joe.keen@hpe.com","username":"jkeen"},"change_message_id":"118b8ac378fcb40225db1fdcbe9316b9b2024a98","unresolved":false,"context_lines":[{"line_number":116,"context_line":"        pod_name \u003d os.environ.get(\"AGENT_POD_NAME\")"},{"line_number":117,"context_line":"        pod_namespace \u003d os.environ.get(\"AGENT_POD_NAMESPACE\")"},{"line_number":118,"context_line":"        if not pod_name or not pod_namespace:"},{"line_number":119,"context_line":"            raise Exception(\"pod_name and pod_namespace is not set as environment variables cannot derive host\")"},{"line_number":120,"context_line":"        pod_url \u003d \"/api/v1/namespaces/{}/pods/{}\".format(pod_namespace, pod_name)"},{"line_number":121,"context_line":"        try:"},{"line_number":122,"context_line":"            agent_pod \u003d self.get_request(pod_url, connection_timeout)"}],"source_content_type":"text/x-python","patch_set":7,"id":"1a430d35_7f1b7b73","line":119,"range":{"start_line":119,"start_character":18,"end_line":119,"end_character":27},"in_reply_to":"1a430d35_883f3dd5","updated":"2017-02-07 17:31:11.000000000","message":"Either way I think we want the log to indicate which of the two isn\u0027t set so I\u0027d want to test them independently.","commit_id":"9490c4ca025793e089c7f094fb4cedb08fd5f346"},{"author":{"_account_id":14273,"name":"Joe Keen","email":"joe.keen@hpe.com","username":"jkeen"},"change_message_id":"4916418251284850811ecac4263367683ce16ca2","unresolved":false,"context_lines":[{"line_number":123,"context_line":"        except Exception as e:"},{"line_number":124,"context_line":"            exception_message \u003d \"Could not get agent pod from Kubernetes api to get host IP with error - {}\".format(e)"},{"line_number":125,"context_line":"            log.exception(exception_message)"},{"line_number":126,"context_line":"            raise Exception(exception_message)"},{"line_number":127,"context_line":"        if not return_host_name:"},{"line_number":128,"context_line":"            return agent_pod[\u0027status\u0027][\u0027hostIP\u0027]"},{"line_number":129,"context_line":"        else:"}],"source_content_type":"text/x-python","patch_set":7,"id":"1a430d35_e8c9a179","line":126,"range":{"start_line":126,"start_character":18,"end_line":126,"end_character":27},"updated":"2017-02-06 21:37:37.000000000","message":"Specific exception type here too?","commit_id":"9490c4ca025793e089c7f094fb4cedb08fd5f346"},{"author":{"_account_id":14273,"name":"Joe Keen","email":"joe.keen@hpe.com","username":"jkeen"},"change_message_id":"118b8ac378fcb40225db1fdcbe9316b9b2024a98","unresolved":false,"context_lines":[{"line_number":123,"context_line":"        except Exception as e:"},{"line_number":124,"context_line":"            exception_message \u003d \"Could not get agent pod from Kubernetes api to get host IP with error - {}\".format(e)"},{"line_number":125,"context_line":"            log.exception(exception_message)"},{"line_number":126,"context_line":"            raise Exception(exception_message)"},{"line_number":127,"context_line":"        if not return_host_name:"},{"line_number":128,"context_line":"            return agent_pod[\u0027status\u0027][\u0027hostIP\u0027]"},{"line_number":129,"context_line":"        else:"}],"source_content_type":"text/x-python","patch_set":7,"id":"1a430d35_bf4ec36c","line":126,"range":{"start_line":126,"start_character":18,"end_line":126,"end_character":27},"in_reply_to":"1a430d35_964c9b9f","updated":"2017-02-07 17:31:11.000000000","message":"That\u0027s true but it means that anyone using this library has to catch an Exception type which will catch anything.  I\u0027d like to see this raise something Kubernetes specific so that it doesn\u0027t fall into the \"I have no idea what happened but something broke\" exception handler.","commit_id":"9490c4ca025793e089c7f094fb4cedb08fd5f346"},{"author":{"_account_id":18179,"name":"Kaiyan Sheng","email":"kaiyan.sheng@hpe.com","username":"kaiyan-sheng"},"change_message_id":"2c5b55cb3c7ed2310e7b2bb42e1b98ebfcaed721","unresolved":false,"context_lines":[{"line_number":123,"context_line":"        except Exception as e:"},{"line_number":124,"context_line":"            exception_message \u003d \"Could not get agent pod from Kubernetes api to get host IP with error - {}\".format(e)"},{"line_number":125,"context_line":"            log.exception(exception_message)"},{"line_number":126,"context_line":"            raise Exception(exception_message)"},{"line_number":127,"context_line":"        if not return_host_name:"},{"line_number":128,"context_line":"            return agent_pod[\u0027status\u0027][\u0027hostIP\u0027]"},{"line_number":129,"context_line":"        else:"}],"source_content_type":"text/x-python","patch_set":7,"id":"9a30ddce_df752364","line":126,"range":{"start_line":126,"start_character":18,"end_line":126,"end_character":27},"in_reply_to":"1a430d35_bf4ec36c","updated":"2017-03-10 17:37:54.000000000","message":"Done","commit_id":"9490c4ca025793e089c7f094fb4cedb08fd5f346"},{"author":{"_account_id":15027,"name":"Michael Hoppal","email":"michael.jam.hoppal@hpe.com","username":"michael-hoppal"},"change_message_id":"7e90a3979d41acc99582a4e5affbd5426d3a147e","unresolved":false,"context_lines":[{"line_number":123,"context_line":"        except Exception as e:"},{"line_number":124,"context_line":"            exception_message \u003d \"Could not get agent pod from Kubernetes api to get host IP with error - {}\".format(e)"},{"line_number":125,"context_line":"            log.exception(exception_message)"},{"line_number":126,"context_line":"            raise Exception(exception_message)"},{"line_number":127,"context_line":"        if not return_host_name:"},{"line_number":128,"context_line":"            return agent_pod[\u0027status\u0027][\u0027hostIP\u0027]"},{"line_number":129,"context_line":"        else:"}],"source_content_type":"text/x-python","patch_set":7,"id":"1a430d35_964c9b9f","line":126,"range":{"start_line":126,"start_character":18,"end_line":126,"end_character":27},"in_reply_to":"1a430d35_e8c9a179","updated":"2017-02-07 15:34:53.000000000","message":"probably not just because this is a pretty board catch of any problem with connecting to the API","commit_id":"9490c4ca025793e089c7f094fb4cedb08fd5f346"},{"author":{"_account_id":14273,"name":"Joe Keen","email":"joe.keen@hpe.com","username":"jkeen"},"change_message_id":"4916418251284850811ecac4263367683ce16ca2","unresolved":false,"context_lines":[{"line_number":129,"context_line":"        else:"},{"line_number":130,"context_line":"            return agent_pod[\u0027spec\u0027][\u0027nodeName\u0027]"},{"line_number":131,"context_line":""},{"line_number":132,"context_line":"    def get_request(self, request_endpoint, connection_timeout, as_json\u003dTrue, retried\u003dFalse):"},{"line_number":133,"context_line":"        \"\"\"Sends request to Kubernetes API with given endpoint."},{"line_number":134,"context_line":"        Will retry the request once, with updated token/cert, if unauthorized."},{"line_number":135,"context_line":"        \"\"\""}],"source_content_type":"text/x-python","patch_set":7,"id":"1a430d35_089c2d68","line":132,"range":{"start_line":132,"start_character":44,"end_line":132,"end_character":62},"updated":"2017-02-06 21:37:37.000000000","message":"We should validate what connection_timeout is at some point.  It\u0027s possible to pass a connection_timeout which would cause this to block indefinitely.","commit_id":"9490c4ca025793e089c7f094fb4cedb08fd5f346"},{"author":{"_account_id":15027,"name":"Michael Hoppal","email":"michael.jam.hoppal@hpe.com","username":"michael-hoppal"},"change_message_id":"7e90a3979d41acc99582a4e5affbd5426d3a147e","unresolved":false,"context_lines":[{"line_number":129,"context_line":"        else:"},{"line_number":130,"context_line":"            return agent_pod[\u0027spec\u0027][\u0027nodeName\u0027]"},{"line_number":131,"context_line":""},{"line_number":132,"context_line":"    def get_request(self, request_endpoint, connection_timeout, as_json\u003dTrue, retried\u003dFalse):"},{"line_number":133,"context_line":"        \"\"\"Sends request to Kubernetes API with given endpoint."},{"line_number":134,"context_line":"        Will retry the request once, with updated token/cert, if unauthorized."},{"line_number":135,"context_line":"        \"\"\""}],"source_content_type":"text/x-python","patch_set":7,"id":"1a430d35_930dae39","line":132,"range":{"start_line":132,"start_character":44,"end_line":132,"end_character":62},"in_reply_to":"1a430d35_089c2d68","updated":"2017-02-07 15:34:53.000000000","message":"if the caller is evil :) what do you have in mind like a top connection time we allow or something?","commit_id":"9490c4ca025793e089c7f094fb4cedb08fd5f346"},{"author":{"_account_id":14273,"name":"Joe Keen","email":"joe.keen@hpe.com","username":"jkeen"},"change_message_id":"118b8ac378fcb40225db1fdcbe9316b9b2024a98","unresolved":false,"context_lines":[{"line_number":129,"context_line":"        else:"},{"line_number":130,"context_line":"            return agent_pod[\u0027spec\u0027][\u0027nodeName\u0027]"},{"line_number":131,"context_line":""},{"line_number":132,"context_line":"    def get_request(self, request_endpoint, connection_timeout, as_json\u003dTrue, retried\u003dFalse):"},{"line_number":133,"context_line":"        \"\"\"Sends request to Kubernetes API with given endpoint."},{"line_number":134,"context_line":"        Will retry the request once, with updated token/cert, if unauthorized."},{"line_number":135,"context_line":"        \"\"\""}],"source_content_type":"text/x-python","patch_set":7,"id":"1a430d35_dfa1cff9","line":132,"range":{"start_line":132,"start_character":44,"end_line":132,"end_character":62},"in_reply_to":"1a430d35_930dae39","updated":"2017-02-07 17:31:11.000000000","message":"First pass I\u0027d trap on None and not allow that.  Maybe a ~20 second max time so we stay within the agent collection cycle?","commit_id":"9490c4ca025793e089c7f094fb4cedb08fd5f346"},{"author":{"_account_id":14273,"name":"Joe Keen","email":"joe.keen@hpe.com","username":"jkeen"},"change_message_id":"4916418251284850811ecac4263367683ce16ca2","unresolved":false,"context_lines":[{"line_number":139,"context_line":"                              headers\u003dself.api_request_header,"},{"line_number":140,"context_line":"                              verify\u003dself.api_verify)"},{"line_number":141,"context_line":"        if result.status_code \u003e\u003d 300:"},{"line_number":142,"context_line":"            if result.status_code \u003d\u003d 401:"},{"line_number":143,"context_line":"                log.warn(\"Could not authenticate with Kubernetes API.\")"},{"line_number":144,"context_line":"                if not retried:"},{"line_number":145,"context_line":"                    log.warn(\"Rereading in cert and token.\")"}],"source_content_type":"text/x-python","patch_set":7,"id":"1a430d35_88b49dd1","line":142,"range":{"start_line":142,"start_character":37,"end_line":142,"end_character":40},"updated":"2017-02-06 21:37:37.000000000","message":"Are there other 400 type errors we want to handle specifically?  Would we want to deal with 300 vs 400 vs 500 and report different errors for them?","commit_id":"9490c4ca025793e089c7f094fb4cedb08fd5f346"},{"author":{"_account_id":14273,"name":"Joe Keen","email":"joe.keen@hpe.com","username":"jkeen"},"change_message_id":"118b8ac378fcb40225db1fdcbe9316b9b2024a98","unresolved":false,"context_lines":[{"line_number":139,"context_line":"                              headers\u003dself.api_request_header,"},{"line_number":140,"context_line":"                              verify\u003dself.api_verify)"},{"line_number":141,"context_line":"        if result.status_code \u003e\u003d 300:"},{"line_number":142,"context_line":"            if result.status_code \u003d\u003d 401:"},{"line_number":143,"context_line":"                log.warn(\"Could not authenticate with Kubernetes API.\")"},{"line_number":144,"context_line":"                if not retried:"},{"line_number":145,"context_line":"                    log.warn(\"Rereading in cert and token.\")"}],"source_content_type":"text/x-python","patch_set":7,"id":"1a430d35_9f8bc767","line":142,"range":{"start_line":142,"start_character":37,"end_line":142,"end_character":40},"in_reply_to":"1a430d35_7972c04a","updated":"2017-02-07 17:31:11.000000000","message":"I think you want to make a distinction between errors that we caused, 400ish things, that we can fix and 500 level errors which is an error in Kubernetes itself.","commit_id":"9490c4ca025793e089c7f094fb4cedb08fd5f346"},{"author":{"_account_id":15027,"name":"Michael Hoppal","email":"michael.jam.hoppal@hpe.com","username":"michael-hoppal"},"change_message_id":"7e90a3979d41acc99582a4e5affbd5426d3a147e","unresolved":false,"context_lines":[{"line_number":139,"context_line":"                              headers\u003dself.api_request_header,"},{"line_number":140,"context_line":"                              verify\u003dself.api_verify)"},{"line_number":141,"context_line":"        if result.status_code \u003e\u003d 300:"},{"line_number":142,"context_line":"            if result.status_code \u003d\u003d 401:"},{"line_number":143,"context_line":"                log.warn(\"Could not authenticate with Kubernetes API.\")"},{"line_number":144,"context_line":"                if not retried:"},{"line_number":145,"context_line":"                    log.warn(\"Rereading in cert and token.\")"}],"source_content_type":"text/x-python","patch_set":7,"id":"1a430d35_d610e35b","line":142,"range":{"start_line":142,"start_character":37,"end_line":142,"end_character":40},"in_reply_to":"1a430d35_88b49dd1","updated":"2017-02-07 15:34:53.000000000","message":"not sure about the different 400s - would have to look into the API more. and yes i think handling the 300/400 and 500 would be nice","commit_id":"9490c4ca025793e089c7f094fb4cedb08fd5f346"},{"author":{"_account_id":15027,"name":"Michael Hoppal","email":"michael.jam.hoppal@hpe.com","username":"michael-hoppal"},"change_message_id":"299af96bf21658bd18191790e1bb916f971c785b","unresolved":false,"context_lines":[{"line_number":139,"context_line":"                              headers\u003dself.api_request_header,"},{"line_number":140,"context_line":"                              verify\u003dself.api_verify)"},{"line_number":141,"context_line":"        if result.status_code \u003e\u003d 300:"},{"line_number":142,"context_line":"            if result.status_code \u003d\u003d 401:"},{"line_number":143,"context_line":"                log.warn(\"Could not authenticate with Kubernetes API.\")"},{"line_number":144,"context_line":"                if not retried:"},{"line_number":145,"context_line":"                    log.warn(\"Rereading in cert and token.\")"}],"source_content_type":"text/x-python","patch_set":7,"id":"1a430d35_7972c04a","line":142,"range":{"start_line":142,"start_character":37,"end_line":142,"end_character":40},"in_reply_to":"1a430d35_d610e35b","updated":"2017-02-07 15:39:41.000000000","message":"actually would you want to have different errors? Regardless you could not get the data you were looking for. The returned error message has the return code, return text and url. I believe that is enough to give back to the user.","commit_id":"9490c4ca025793e089c7f094fb4cedb08fd5f346"},{"author":{"_account_id":14273,"name":"Joe Keen","email":"joe.keen@hpe.com","username":"jkeen"},"change_message_id":"4916418251284850811ecac4263367683ce16ca2","unresolved":false,"context_lines":[{"line_number":140,"context_line":"                              verify\u003dself.api_verify)"},{"line_number":141,"context_line":"        if result.status_code \u003e\u003d 300:"},{"line_number":142,"context_line":"            if result.status_code \u003d\u003d 401:"},{"line_number":143,"context_line":"                log.warn(\"Could not authenticate with Kubernetes API.\")"},{"line_number":144,"context_line":"                if not retried:"},{"line_number":145,"context_line":"                    log.warn(\"Rereading in cert and token.\")"},{"line_number":146,"context_line":"                    self._set_kubernetes_service_account_info()"}],"source_content_type":"text/x-python","patch_set":7,"id":"1a430d35_a87dd91d","line":143,"range":{"start_line":143,"start_character":20,"end_line":143,"end_character":24},"updated":"2017-02-06 21:37:37.000000000","message":"Warning or error?","commit_id":"9490c4ca025793e089c7f094fb4cedb08fd5f346"},{"author":{"_account_id":15027,"name":"Michael Hoppal","email":"michael.jam.hoppal@hpe.com","username":"michael-hoppal"},"change_message_id":"7e90a3979d41acc99582a4e5affbd5426d3a147e","unresolved":false,"context_lines":[{"line_number":140,"context_line":"                              verify\u003dself.api_verify)"},{"line_number":141,"context_line":"        if result.status_code \u003e\u003d 300:"},{"line_number":142,"context_line":"            if result.status_code \u003d\u003d 401:"},{"line_number":143,"context_line":"                log.warn(\"Could not authenticate with Kubernetes API.\")"},{"line_number":144,"context_line":"                if not retried:"},{"line_number":145,"context_line":"                    log.warn(\"Rereading in cert and token.\")"},{"line_number":146,"context_line":"                    self._set_kubernetes_service_account_info()"}],"source_content_type":"text/x-python","patch_set":7,"id":"1a430d35_b3146a44","line":143,"range":{"start_line":143,"start_character":20,"end_line":143,"end_character":24},"in_reply_to":"1a430d35_a87dd91d","updated":"2017-02-07 15:34:53.000000000","message":"warning because we are going to try again and havent failed yet. we will error if we fail the second time below","commit_id":"9490c4ca025793e089c7f094fb4cedb08fd5f346"},{"author":{"_account_id":14273,"name":"Joe Keen","email":"joe.keen@hpe.com","username":"jkeen"},"change_message_id":"118b8ac378fcb40225db1fdcbe9316b9b2024a98","unresolved":false,"context_lines":[{"line_number":140,"context_line":"                              verify\u003dself.api_verify)"},{"line_number":141,"context_line":"        if result.status_code \u003e\u003d 300:"},{"line_number":142,"context_line":"            if result.status_code \u003d\u003d 401:"},{"line_number":143,"context_line":"                log.warn(\"Could not authenticate with Kubernetes API.\")"},{"line_number":144,"context_line":"                if not retried:"},{"line_number":145,"context_line":"                    log.warn(\"Rereading in cert and token.\")"},{"line_number":146,"context_line":"                    self._set_kubernetes_service_account_info()"}],"source_content_type":"text/x-python","patch_set":7,"id":"1a430d35_ff792b83","line":143,"range":{"start_line":143,"start_character":20,"end_line":143,"end_character":24},"in_reply_to":"1a430d35_b3146a44","updated":"2017-02-07 17:31:11.000000000","message":"If we\u0027re going to try again I\u0027m not sure I\u0027d say anything at all then.","commit_id":"9490c4ca025793e089c7f094fb4cedb08fd5f346"},{"author":{"_account_id":18179,"name":"Kaiyan Sheng","email":"kaiyan.sheng@hpe.com","username":"kaiyan-sheng"},"change_message_id":"2c5b55cb3c7ed2310e7b2bb42e1b98ebfcaed721","unresolved":false,"context_lines":[{"line_number":140,"context_line":"                              verify\u003dself.api_verify)"},{"line_number":141,"context_line":"        if result.status_code \u003e\u003d 300:"},{"line_number":142,"context_line":"            if result.status_code \u003d\u003d 401:"},{"line_number":143,"context_line":"                log.warn(\"Could not authenticate with Kubernetes API.\")"},{"line_number":144,"context_line":"                if not retried:"},{"line_number":145,"context_line":"                    log.warn(\"Rereading in cert and token.\")"},{"line_number":146,"context_line":"                    self._set_kubernetes_service_account_info()"}],"source_content_type":"text/x-python","patch_set":7,"id":"9a30ddce_c20b8c22","line":143,"range":{"start_line":143,"start_character":20,"end_line":143,"end_character":24},"in_reply_to":"1a430d35_ff792b83","updated":"2017-03-10 17:37:54.000000000","message":"Done","commit_id":"9490c4ca025793e089c7f094fb4cedb08fd5f346"},{"author":{"_account_id":14273,"name":"Joe Keen","email":"joe.keen@hpe.com","username":"jkeen"},"change_message_id":"4916418251284850811ecac4263367683ce16ca2","unresolved":false,"context_lines":[{"line_number":147,"context_line":"                    return self.get_request(request_endpoint, connection_timeout, as_json\u003das_json, retried\u003dTrue)"},{"line_number":148,"context_line":"            exception \u003d \"Could not obtain data from {} with the given \" \\"},{"line_number":149,"context_line":"                        \"status code {} and return text {}\".format(request_url, result.status_code, result.text)"},{"line_number":150,"context_line":"            raise Exception(exception)"},{"line_number":151,"context_line":"        return result.json() if as_json else result"}],"source_content_type":"text/x-python","patch_set":7,"id":"1a430d35_a8a4f9a5","line":150,"range":{"start_line":150,"start_character":18,"end_line":150,"end_character":27},"updated":"2017-02-06 21:37:37.000000000","message":"Specific exception type here?","commit_id":"9490c4ca025793e089c7f094fb4cedb08fd5f346"},{"author":{"_account_id":18179,"name":"Kaiyan Sheng","email":"kaiyan.sheng@hpe.com","username":"kaiyan-sheng"},"change_message_id":"2c5b55cb3c7ed2310e7b2bb42e1b98ebfcaed721","unresolved":false,"context_lines":[{"line_number":147,"context_line":"                    return self.get_request(request_endpoint, connection_timeout, as_json\u003das_json, retried\u003dTrue)"},{"line_number":148,"context_line":"            exception \u003d \"Could not obtain data from {} with the given \" \\"},{"line_number":149,"context_line":"                        \"status code {} and return text {}\".format(request_url, result.status_code, result.text)"},{"line_number":150,"context_line":"            raise Exception(exception)"},{"line_number":151,"context_line":"        return result.json() if as_json else result"}],"source_content_type":"text/x-python","patch_set":7,"id":"9a30ddce_dffb6377","line":150,"range":{"start_line":150,"start_character":18,"end_line":150,"end_character":27},"in_reply_to":"1a430d35_1ff6f7f8","updated":"2017-03-10 17:37:54.000000000","message":"Done","commit_id":"9490c4ca025793e089c7f094fb4cedb08fd5f346"},{"author":{"_account_id":14273,"name":"Joe Keen","email":"joe.keen@hpe.com","username":"jkeen"},"change_message_id":"118b8ac378fcb40225db1fdcbe9316b9b2024a98","unresolved":false,"context_lines":[{"line_number":147,"context_line":"                    return self.get_request(request_endpoint, connection_timeout, as_json\u003das_json, retried\u003dTrue)"},{"line_number":148,"context_line":"            exception \u003d \"Could not obtain data from {} with the given \" \\"},{"line_number":149,"context_line":"                        \"status code {} and return text {}\".format(request_url, result.status_code, result.text)"},{"line_number":150,"context_line":"            raise Exception(exception)"},{"line_number":151,"context_line":"        return result.json() if as_json else result"}],"source_content_type":"text/x-python","patch_set":7,"id":"1a430d35_1ff6f7f8","line":150,"range":{"start_line":150,"start_character":18,"end_line":150,"end_character":27},"in_reply_to":"1a430d35_39411839","updated":"2017-02-07 17:31:11.000000000","message":"Like above I think it makes the exception handling from the caller easier so they don\u0027t have to trap really broad exceptions.","commit_id":"9490c4ca025793e089c7f094fb4cedb08fd5f346"},{"author":{"_account_id":15027,"name":"Michael Hoppal","email":"michael.jam.hoppal@hpe.com","username":"michael-hoppal"},"change_message_id":"7e90a3979d41acc99582a4e5affbd5426d3a147e","unresolved":false,"context_lines":[{"line_number":147,"context_line":"                    return self.get_request(request_endpoint, connection_timeout, as_json\u003das_json, retried\u003dTrue)"},{"line_number":148,"context_line":"            exception \u003d \"Could not obtain data from {} with the given \" \\"},{"line_number":149,"context_line":"                        \"status code {} and return text {}\".format(request_url, result.status_code, result.text)"},{"line_number":150,"context_line":"            raise Exception(exception)"},{"line_number":151,"context_line":"        return result.json() if as_json else result"}],"source_content_type":"text/x-python","patch_set":7,"id":"1a430d35_39411839","line":150,"range":{"start_line":150,"start_character":18,"end_line":150,"end_character":27},"in_reply_to":"1a430d35_a8a4f9a5","updated":"2017-02-07 15:34:53.000000000","message":"again pretty board exception i dont think so . I mean i could put like KubernetesAPIFailedCall but I am not sure if that provides any telling reason. the exception message will contain what they need","commit_id":"9490c4ca025793e089c7f094fb4cedb08fd5f346"},{"author":{"_account_id":16168,"name":"Tomasz Trębski","email":"kornicameister@gmail.com","username":"trebskit"},"change_message_id":"a9446dea4ee7aaa7657ba36aacceab47ec1edcb8","unresolved":false,"context_lines":[{"line_number":84,"context_line":"    return memory * math.pow(1000, power)"},{"line_number":85,"context_line":""},{"line_number":86,"context_line":""},{"line_number":87,"context_line":"class KubernetesConnector(object):"},{"line_number":88,"context_line":"    \"\"\"Class for connecting to Kubernetes API from within a container running in a Kubernetes environment\"\"\""},{"line_number":89,"context_line":"    CACERT_PATH \u003d \u0027/run/secrets/kubernetes.io/serviceaccount/ca.crt\u0027"},{"line_number":90,"context_line":"    TOKEN_PATH \u003d \u0027/var/run/secrets/kubernetes.io/serviceaccount/token\u0027"}],"source_content_type":"text/x-python","patch_set":11,"id":"9a30ddce_115ffe0e","line":87,"updated":"2017-03-09 05:13:49.000000000","message":"Just a thought, wouldn\u0027t it be better to have this connector in seperate package, or at least module ?","commit_id":"2f195fbf18b1a36eb9c60d5a5302d1120db74322"},{"author":{"_account_id":18179,"name":"Kaiyan Sheng","email":"kaiyan.sheng@hpe.com","username":"kaiyan-sheng"},"change_message_id":"f6b1b41e260572cb922d5c1e137c82e1221319cf","unresolved":false,"context_lines":[{"line_number":84,"context_line":"    return memory * math.pow(1000, power)"},{"line_number":85,"context_line":""},{"line_number":86,"context_line":""},{"line_number":87,"context_line":"class KubernetesConnector(object):"},{"line_number":88,"context_line":"    \"\"\"Class for connecting to Kubernetes API from within a container running in a Kubernetes environment\"\"\""},{"line_number":89,"context_line":"    CACERT_PATH \u003d \u0027/run/secrets/kubernetes.io/serviceaccount/ca.crt\u0027"},{"line_number":90,"context_line":"    TOKEN_PATH \u003d \u0027/var/run/secrets/kubernetes.io/serviceaccount/token\u0027"}],"source_content_type":"text/x-python","patch_set":11,"id":"9a30ddce_08df7ed9","line":87,"in_reply_to":"9a30ddce_02af642a","updated":"2017-03-10 18:52:46.000000000","message":"Sorry Tomasz for the wrong \"Done\" there. I think right now since we only have one connector, we can put it here for now. If in the future we end up with more than this one, we will definitely move this out then.\nThanks!","commit_id":"2f195fbf18b1a36eb9c60d5a5302d1120db74322"},{"author":{"_account_id":18179,"name":"Kaiyan Sheng","email":"kaiyan.sheng@hpe.com","username":"kaiyan-sheng"},"change_message_id":"29959dd0e7609be2f9c14bd1f23b5ddc4f873f41","unresolved":false,"context_lines":[{"line_number":84,"context_line":"    return memory * math.pow(1000, power)"},{"line_number":85,"context_line":""},{"line_number":86,"context_line":""},{"line_number":87,"context_line":"class KubernetesConnector(object):"},{"line_number":88,"context_line":"    \"\"\"Class for connecting to Kubernetes API from within a container running in a Kubernetes environment\"\"\""},{"line_number":89,"context_line":"    CACERT_PATH \u003d \u0027/run/secrets/kubernetes.io/serviceaccount/ca.crt\u0027"},{"line_number":90,"context_line":"    TOKEN_PATH \u003d \u0027/var/run/secrets/kubernetes.io/serviceaccount/token\u0027"}],"source_content_type":"text/x-python","patch_set":11,"id":"9a30ddce_3ccd6085","line":87,"in_reply_to":"9a30ddce_08df7ed9","updated":"2017-03-10 20:45:55.000000000","message":"We just had a little discussion about this and we decided to separate this connector from utils. But we want to get all the related reviews  merged in first and then do the change. That way we don\u0027t have to deal with the rebase issue with every single review. Thank you for your comments!","commit_id":"2f195fbf18b1a36eb9c60d5a5302d1120db74322"},{"author":{"_account_id":18179,"name":"Kaiyan Sheng","email":"kaiyan.sheng@hpe.com","username":"kaiyan-sheng"},"change_message_id":"f288960130767cb80ade36a059fcbd1d1696ca53","unresolved":false,"context_lines":[{"line_number":84,"context_line":"    return memory * math.pow(1000, power)"},{"line_number":85,"context_line":""},{"line_number":86,"context_line":""},{"line_number":87,"context_line":"class KubernetesConnector(object):"},{"line_number":88,"context_line":"    \"\"\"Class for connecting to Kubernetes API from within a container running in a Kubernetes environment\"\"\""},{"line_number":89,"context_line":"    CACERT_PATH \u003d \u0027/run/secrets/kubernetes.io/serviceaccount/ca.crt\u0027"},{"line_number":90,"context_line":"    TOKEN_PATH \u003d \u0027/var/run/secrets/kubernetes.io/serviceaccount/token\u0027"}],"source_content_type":"text/x-python","patch_set":11,"id":"9a30ddce_02af642a","line":87,"in_reply_to":"9a30ddce_115ffe0e","updated":"2017-03-10 17:37:49.000000000","message":"Done","commit_id":"2f195fbf18b1a36eb9c60d5a5302d1120db74322"},{"author":{"_account_id":16168,"name":"Tomasz Trębski","email":"kornicameister@gmail.com","username":"trebskit"},"change_message_id":"a9446dea4ee7aaa7657ba36aacceab47ec1edcb8","unresolved":false,"context_lines":[{"line_number":89,"context_line":"    CACERT_PATH \u003d \u0027/run/secrets/kubernetes.io/serviceaccount/ca.crt\u0027"},{"line_number":90,"context_line":"    TOKEN_PATH \u003d \u0027/var/run/secrets/kubernetes.io/serviceaccount/token\u0027"},{"line_number":91,"context_line":""},{"line_number":92,"context_line":"    def __init__(self, connection_timeout):"},{"line_number":93,"context_line":"        self.api_url \u003d None"},{"line_number":94,"context_line":"        self.api_verify \u003d None"},{"line_number":95,"context_line":"        self.api_request_header \u003d None"}],"source_content_type":"text/x-python","patch_set":11,"id":"9a30ddce_b1b0f244","line":92,"updated":"2017-03-09 05:13:49.000000000","message":"Would there be any benefit of having sensible default here ?","commit_id":"2f195fbf18b1a36eb9c60d5a5302d1120db74322"},{"author":{"_account_id":18179,"name":"Kaiyan Sheng","email":"kaiyan.sheng@hpe.com","username":"kaiyan-sheng"},"change_message_id":"f288960130767cb80ade36a059fcbd1d1696ca53","unresolved":false,"context_lines":[{"line_number":89,"context_line":"    CACERT_PATH \u003d \u0027/run/secrets/kubernetes.io/serviceaccount/ca.crt\u0027"},{"line_number":90,"context_line":"    TOKEN_PATH \u003d \u0027/var/run/secrets/kubernetes.io/serviceaccount/token\u0027"},{"line_number":91,"context_line":""},{"line_number":92,"context_line":"    def __init__(self, connection_timeout):"},{"line_number":93,"context_line":"        self.api_url \u003d None"},{"line_number":94,"context_line":"        self.api_verify \u003d None"},{"line_number":95,"context_line":"        self.api_request_header \u003d None"}],"source_content_type":"text/x-python","patch_set":11,"id":"9a30ddce_22aaa819","line":92,"in_reply_to":"9a30ddce_b1b0f244","updated":"2017-03-10 17:37:49.000000000","message":"Done","commit_id":"2f195fbf18b1a36eb9c60d5a5302d1120db74322"},{"author":{"_account_id":16168,"name":"Tomasz Trębski","email":"kornicameister@gmail.com","username":"trebskit"},"change_message_id":"35a8409fdf62b9b838af6f5b79c4524458cc0f9b","unresolved":false,"context_lines":[{"line_number":84,"context_line":"    return memory * math.pow(1000, power)"},{"line_number":85,"context_line":""},{"line_number":86,"context_line":""},{"line_number":87,"context_line":"class KubernetesConnector(object):"},{"line_number":88,"context_line":"    \"\"\"Class for connecting to Kubernetes API from within a container running"},{"line_number":89,"context_line":"    in a Kubernetes environment\"\"\""},{"line_number":90,"context_line":"    CACERT_PATH \u003d \u0027/var/run/secrets/kubernetes.io/serviceaccount/ca.crt\u0027"}],"source_content_type":"text/x-python","patch_set":13,"id":"9a30ddce_54a59244","line":87,"updated":"2017-03-10 18:29:29.000000000","message":"In PS#11 you replied Done for two my comments, but I see no changes in here ?","commit_id":"7c724546d0e69d424fe97c681b3807d239538d3d"},{"author":{"_account_id":18179,"name":"Kaiyan Sheng","email":"kaiyan.sheng@hpe.com","username":"kaiyan-sheng"},"change_message_id":"aa37d63ffe441937d23c2575d3405e91e1509b4b","unresolved":false,"context_lines":[{"line_number":84,"context_line":"    return memory * math.pow(1000, power)"},{"line_number":85,"context_line":""},{"line_number":86,"context_line":""},{"line_number":87,"context_line":"class KubernetesConnector(object):"},{"line_number":88,"context_line":"    \"\"\"Class for connecting to Kubernetes API from within a container running"},{"line_number":89,"context_line":"    in a Kubernetes environment\"\"\""},{"line_number":90,"context_line":"    CACERT_PATH \u003d \u0027/var/run/secrets/kubernetes.io/serviceaccount/ca.crt\u0027"}],"source_content_type":"text/x-python","patch_set":13,"id":"9a30ddce_941e2a6e","line":87,"in_reply_to":"9a30ddce_54a59244","updated":"2017-03-10 18:31:26.000000000","message":"Sorry my bad!! Thats my mistake!","commit_id":"7c724546d0e69d424fe97c681b3807d239538d3d"},{"author":{"_account_id":14517,"name":"Ryan Brandt","email":"ryan.brandt@hpe.com","username":"ryan-brandt"},"change_message_id":"8c8add11d47dfdf19a89f4e5e8e16e3bde5acde5","unresolved":false,"context_lines":[{"line_number":59,"context_line":"    return tenants"},{"line_number":60,"context_line":""},{"line_number":61,"context_line":""},{"line_number":62,"context_line":"def convert_memory_string_to_bytes(memory_string):"},{"line_number":63,"context_line":"    \"\"\"Conversion from memory represented in string format to bytes\"\"\""},{"line_number":64,"context_line":"    if \"m\" in memory_string:"},{"line_number":65,"context_line":"        memory \u003d float(memory_string.split(\u0027m\u0027)[0])"},{"line_number":66,"context_line":"        return memory / 1000"},{"line_number":67,"context_line":"    elif \"K\" in memory_string:"},{"line_number":68,"context_line":"        memory \u003d float(memory_string.split(\u0027K\u0027)[0])"},{"line_number":69,"context_line":"        return _compute_memory_bytes(memory_string, memory, 1)"},{"line_number":70,"context_line":"    elif \"M\" in memory_string:"},{"line_number":71,"context_line":"        memory \u003d float(memory_string.split(\u0027M\u0027)[0])"},{"line_number":72,"context_line":"        return _compute_memory_bytes(memory_string, memory, 2)"},{"line_number":73,"context_line":"    elif \"G\" in memory_string:"},{"line_number":74,"context_line":"        memory \u003d float(memory_string.split(\u0027G\u0027)[0])"},{"line_number":75,"context_line":"        return _compute_memory_bytes(memory_string, memory, 3)"},{"line_number":76,"context_line":"    elif \"T\" in memory_string:"},{"line_number":77,"context_line":"        memory \u003d float(memory_string.split(\u0027T\u0027)[0])"},{"line_number":78,"context_line":"        return _compute_memory_bytes(memory_string, memory, 4)"},{"line_number":79,"context_line":"    else:"},{"line_number":80,"context_line":"        return float(memory_string)"},{"line_number":81,"context_line":""},{"line_number":82,"context_line":""},{"line_number":83,"context_line":"def _compute_memory_bytes(memory_string, memory, power):"},{"line_number":84,"context_line":"    if \"i\" in memory_string:"},{"line_number":85,"context_line":"        return memory * math.pow(1024, power)"},{"line_number":86,"context_line":"    return memory * math.pow(1000, power)"},{"line_number":87,"context_line":""},{"line_number":88,"context_line":""},{"line_number":89,"context_line":"class KubernetesConnector(object):"}],"source_content_type":"text/x-python","patch_set":16,"id":"9a30ddce_fc37484a","line":86,"range":{"start_line":62,"start_character":0,"end_line":86,"end_character":41},"updated":"2017-03-10 20:58:56.000000000","message":"Relatively minor nit, but it seems like this could be one method","commit_id":"17f16ae55d899fe60976a7baf3aa02410c506972"},{"author":{"_account_id":14517,"name":"Ryan Brandt","email":"ryan.brandt@hpe.com","username":"ryan-brandt"},"change_message_id":"8c8add11d47dfdf19a89f4e5e8e16e3bde5acde5","unresolved":false,"context_lines":[{"line_number":98,"context_line":"        self.api_verify \u003d None"},{"line_number":99,"context_line":"        self.api_request_header \u003d None"},{"line_number":100,"context_line":"        if connection_timeout is None:"},{"line_number":101,"context_line":"            log.info(\"connection_timeout cannot be none. Set it to default instead.\")"},{"line_number":102,"context_line":"            self.connection_timeout \u003d DEFAULT_TIMEOUT"},{"line_number":103,"context_line":"        else:"},{"line_number":104,"context_line":"            self.connection_timeout \u003d connection_timeout"}],"source_content_type":"text/x-python","patch_set":16,"id":"9a30ddce_5c4e94c1","line":101,"range":{"start_line":101,"start_character":16,"end_line":101,"end_character":20},"updated":"2017-03-10 20:58:56.000000000","message":"is this log really necessary? Everywhere else we simply apply the default without a message","commit_id":"17f16ae55d899fe60976a7baf3aa02410c506972"}]}
