Upgrade from 1.32.0 to 1.33.0
With changes introduced in Genvid MILE SDK 1.33.0, we’ve deprecated a number of APIs, classes, and methods. In cases where it’s possible, we include additional instructions for projects that need to rely on prior functionality.
Note
To check if any of your scripts are affected by these changes, run them with
the -W default::DeprecationWarning
option and look for the warnings.
(For example, py -W default::DeprecationWarning myscript.py
.)
See the Python warnings
module for more info.
/consultemplate
replaced by /template_renderer
.
We deprecated the Cluster API POST /consultemplate
and its
associated interfaces in favor of the POST /template_renderer
API.
To upgrade:
#. Replace direct calls to POST /consultemplate
with the
following code:
POST /v1/template_renderer HTTP/1.1
Content-Type: application/json
{"content":"template-to-render"}
Replace the command genvid-sdk consul-template template.txt with:
genvid-sdk render-template -c template.txt
Replace the method
clusterApi.do_consul_template("template-to-render")
with:self.clusterAPI.render_template(content="template-to-render")
genvid.toolbox.EventsTool
replaced with methods from other classes.
We replaced the genvid.toolbox.EventsTool
API with the
ClusterAPI
events defs
methods and
the higher level SDK
config
methods.
For example, the equivalent of calling the method
eventsTool.load_map_reduce('events.json')
is:
sdkTool.load_config('events.json')
This change also affects RuntimeTool
and its
descendants.
genvid.toolbox.ConfigTool
replaced with methods from other classes.
We replaced the genvid.toolbox.ConfigTool
API with the
ClusterAPI
config
and log defs
methods, and
the higher level SDK
config
and logs
methods. You can also directly use
consul_kv
for doing the lower-level work.
In addition to the SDK class mentioned above, this change also affects
RuntimeTool
and its descendants.
genvid.toolbox.ProjectTool
replaced by ~genvid.toolbox.ConfigurationLoader
.
We replaced the genvid.toolbox.ProjectTool
API with
ConfigurationLoader
, a simpler utility class with
fewer dependencies. To replace the old class, derive it from
ConsulTemplateTool
instead and do the following:
class MyClass(ConsulTemplateTool):
...
def load_project_configuration(self, project_config_folder):
loader = ConfigurationLoader(self, self.load_config_template)
configuration = loader.load_config_folder(project_config_folder)
loader.update_config(configuration)
...
The change also affects the classes SDK
and
BastionTool
(through its ancestors). If you need
the old functionality, use the method above or derive a new class
from ProjectTool
. For example, a class MyScript
that originally derived
from the SDK
class is converted to:
class MyScript(SDK, ProjectTool):
...
It will work just like it did before.
~genvid.toolbox.ConsulTemplateTool
replaced by ~genvid.toolbox.ClusterAPI.render_template
.
Methods like load_config_template()
,
consul_template_once()
, and
consul_template
won’t be
part of its interface once the deprecation is applied. We recommended you
switch to the new render_template()
and
render_template()
methods instead.
If your scripts depend on it, you can add
ConsulTemplateTool
directly to your hierarchy.
class MyClass(ConsulTemplateTool):
...
def load_project_configuration(self, project_config_folder):
loader = ConfigurationLoader(self, self.load_config_template)
configuration = loader.load_config_folder(project_config_folder)
loader.update_config(configuration)
...
genvid-sdk
and genvid-bastion
now use the new template_renderer
API when available.
This should work transparently unless you are using consul-template
functions or plugins that depend on the local context of execution not present
for cluster-api
or bastion-api
. If you need to fall back on the old
behavior, you can reproduce it by deriving it from
ConsulTemplateTool
instead and doing the
following:
class MyClass(ConsulTemplateTool):
...
def load_project_configuration(self, project_config_folder):
loader = ConfigurationLoader(self, self.load_config_template)
configuration = loader.load_config_folder(project_config_folder)
loader.update_config(configuration)
...
AWS and Azure support in genvid-toolbox
is now optional.
You can now install genvid-toolbox
without the support of Azure or AWS,
or with only one of them.
To install without any cloud support, run the following command:
py ./install-toolbox.py --no-extra
To install with only AWS support, run the following command:
py ./install-toolbox.py --extra aws
To install with only Azure support, run the following command:
py ./install-toolbox.py --extra azure
Note that Azure support also now requires that you install the Azure CLI package globally, which can be done through the installer.
See also
Installing the Toolbox, The AWS Cloud Environment and The Azure Cloud Environment for more details.