modulecore.py

changeset 149
1759c15cd0ca
parent 146
c17b82b1f573
child 154
df862cca1773
equal deleted inserted replaced
148:7e225c2659b8 149:1759c15cd0ca
178 and comm1['host'] == comm2['host'] 178 and comm1['host'] == comm2['host']
179 179
180 def exec_command (commandObject): 180 def exec_command (commandObject):
181 global g_lastConfirm 181 global g_lastConfirm
182 global g_confirmCommand 182 global g_confirmCommand
183 cmdname = commandObject['cmdname'] 183
184 184 if 'function' in commandObject:
185 try: 185 func = commandObject['function']
186 func = getattr (commandObject['module'], 'cmd_' + cmdname) 186 else:
187 except AttributeError: 187 cmdname = commandObject['cmdname']
188 command_error ('''command '%s' does not have a definition''' % cmdname) 188
189 try:
190 func = getattr (commandObject['module'], 'cmd_' + cmdname)
191 except AttributeError:
192 command_error ('''command '%s' does not have a definition''' % cmdname)
189 193
190 try: 194 try:
191 func (**commandObject) 195 func (**commandObject)
192 except Confirmxeption as e: 196 except Confirmxeption as e:
193 if time.time() - g_lastConfirm < 15 and g_confirmCommand != None: 197 if time.time() - g_lastConfirm < 15 and g_confirmCommand != None:

mercurial