@@ -102,6 +102,23 @@ class Computer(MutableBaseModel):
102
102
def __init__ (self , cb , model_unique_id , initial_data = None ):
103
103
super (Computer , self ).__init__ (cb , model_unique_id , initial_data )
104
104
105
+ def _build_api_request_uri (self , http_method = "GET" ):
106
+ base_uri = super (Computer , self )._build_api_request_uri (http_method = http_method )
107
+ args = []
108
+
109
+ if http_method == "PUT" :
110
+ if any (n in self ._dirty_attributes
111
+ for n in ["debugLevel" , "kernelDebugLevel" , "debugFlags" , "debugDuration" , "ccLevel" , "ccFlags" ]):
112
+ args .append ("changeDiagnostics=true" )
113
+ if any (n in self ._dirty_attributes
114
+ for n in ["template" , "templateCloneCleanupMode" , "templateCloneCleanupTime" , "templateCloneCleanupTimeScale" , "templateTrackModsOnly" ]):
115
+ args .append ("changeTemplate=true" )
116
+
117
+ if args :
118
+ base_uri += "?{0}" .format ("&" .join (args ))
119
+
120
+ return base_uri
121
+
105
122
@property
106
123
def policy (self ):
107
124
return self ._join (Policy , "policyId" )
@@ -115,13 +132,14 @@ def fileInstances(self):
115
132
return self ._cb .select (FileInstance ).where ("computerId:{0:d}" .format (self .id ))
116
133
117
134
@property
118
- def template (self ):
135
+ def templateComputer (self ):
119
136
return self ._join (Computer , "templateComputerId" )
120
137
121
138
def resetCLIPassword (self ):
122
- self ._build_api_request_uri ()
139
+ url = self ._build_api_request_uri () + "?resetCLIPassword=true"
140
+ self ._cb .put_object (url , {})
123
141
self .refresh ()
124
- return getattr (self , "cliPassword " )
142
+ return getattr (self , "CLIPassword " )
125
143
126
144
127
145
class Connector (MutableBaseModel , CreatableModelMixin ):
0 commit comments