git://git.onelab.eu
/
plcapi.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
- fix log message
[plcapi.git]
/
PLC
/
Methods
/
BootNotifyOwners.py
diff --git
a/PLC/Methods/BootNotifyOwners.py
b/PLC/Methods/BootNotifyOwners.py
index
c467617
..
958bf9f
100644
(file)
--- a/
PLC/Methods/BootNotifyOwners.py
+++ b/
PLC/Methods/BootNotifyOwners.py
@@
-1,3
+1,4
@@
+from PLC.Debug import log
from PLC.Faults import *
from PLC.Method import Method
from PLC.Parameter import Parameter, Mixed
from PLC.Faults import *
from PLC.Method import Method
from PLC.Parameter import Parameter, Mixed
@@
-29,14
+30,17
@@
class BootNotifyOwners(Method):
def call(self, auth, message_id, include_pis, include_techs, include_support):
messages = Messages(self.api, [message_id], enabled = True)
if not messages:
def call(self, auth, message_id, include_pis, include_techs, include_support):
messages = Messages(self.api, [message_id], enabled = True)
if not messages:
- # raise PLCInvalidArgument, "No such message template"
-
return 1
+ print >> log, "No such message template '%s'" % message_id
+ return 1
message = messages[0]
message = messages[0]
-
+
if not self.api.config.PLC_MAIL_ENABLED:
return 1
if not self.api.config.PLC_MAIL_ENABLED:
return 1
- recipients = {}
+ from_addr = {}
+ from_addr[self.api.config.PLC_MAIL_SUPPORT_ADDRESS] = \
+ "%s %s" % ('Planetlab', 'Support')
+ recipients = {}
if self.api.config.PLC_MAIL_BOOT_ADDRESS:
recipients[self.api.config.PLC_MAIL_BOOT_ADDRESS] = "Boot Messages"
if self.api.config.PLC_MAIL_BOOT_ADDRESS:
recipients[self.api.config.PLC_MAIL_BOOT_ADDRESS] = "Boot Messages"
@@
-56,6
+60,13
@@
class BootNotifyOwners(Method):
include_techs and 'tech' in person['roles']:
recipients[person['email']] = person['first_name'] + " " + person['last_name']
include_techs and 'tech' in person['roles']:
recipients[person['email']] = person['first_name'] + " " + person['last_name']
- # XXX Send mail
+ subject = message['subject']
+ template = message['template']
+
+ # Send email
+ self.api.mailer.mail(recipients, None, from_addr, subject, template)
+
+ # Logging variables
+ self.message = "Node sent message %s to contacts"
return 1
return 1