RedHatInsights/bonfire

Namespace `refresh` function should be reworked

Opened this issue · 0 comments

The way the refresh function is written is confusing since it is used as both an initializer function AND a refresh function.

Looking at the name of the function, one would usually assume that new JSON is going to be fetched every time but actually if namespace_data is passed to it, it does not call get_json.

https://github.com/RedHatInsights/bonfire/blob/master/bonfire/namespaces.py#L124

Also, we are

  1. inefficiently calling deepcopy even in instances where namespace_data is already None, and
  2. throwing away the deepcopy accidentally on this line: https://github.com/RedHatInsights/bonfire/blob/master/bonfire/namespaces.py#L124

This should be:

self._data = self._data or get_json(...)