File tree Expand file tree Collapse file tree 1 file changed +18
-3
lines changed
Expand file tree Collapse file tree 1 file changed +18
-3
lines changed Original file line number Diff line number Diff line change @@ -38,8 +38,23 @@ def with_setup_actions(self, setup_actions):
3838 self .data ["setupActions" ] = setup_actions
3939 return self
4040
41- def with_license (self , license ):
42- self .data ["license" ] = license
41+ def with_license (self , license_file_path = None , license_string = None ):
42+ """
43+ Override global license
44+
45+ :param str license_file_path: Optional, load the license from a json file
46+ :param str license_string: Optional, load the license from a json string
47+ """
48+ if license_file_path is not None :
49+ with open (license_file_path ) as json_file :
50+ license = json .load (json_file )
51+ elif license_string is not None :
52+ license = json .loads (license_string )
53+ else :
54+ raise ValueError (
55+ "a valid license_file_path or license_string needs to be provided"
56+ )
57+ self .data ["license" ] = json .dumps (license , indent = 2 )
4358 return self
4459
4560
@@ -211,7 +226,7 @@ def add_setup_action(self, setup_action):
211226 :param object setup_action: a :class:`dataikuapi.fm.instancesettingstemplates.FMSetupAction`
212227 """
213228 self .ist_data ["setupActions" ].append (setup_action )
214- self . save ()
229+ return self
215230
216231
217232class FMSetupAction (dict ):
You can’t perform that action at this time.
0 commit comments