[CalendarServer-changes] [11436] CalendarServer/branches/users/glyph/launchd-wrapper-bis/ calendarserver/tools/agent.py

source_changes at macosforge.org source_changes at macosforge.org
Wed Jun 26 01:22:25 PDT 2013


Revision: 11436
          http://trac.calendarserver.org//changeset/11436
Author:   glyph at apple.com
Date:     2013-06-26 01:22:25 -0700 (Wed, 26 Jun 2013)
Log Message:
-----------
TODO→TO-DONE

Modified Paths:
--------------
    CalendarServer/branches/users/glyph/launchd-wrapper-bis/calendarserver/tools/agent.py

Modified: CalendarServer/branches/users/glyph/launchd-wrapper-bis/calendarserver/tools/agent.py
===================================================================
--- CalendarServer/branches/users/glyph/launchd-wrapper-bis/calendarserver/tools/agent.py	2013-06-26 08:22:19 UTC (rev 11435)
+++ CalendarServer/branches/users/glyph/launchd-wrapper-bis/calendarserver/tools/agent.py	2013-06-26 08:22:25 UTC (rev 11436)
@@ -1,5 +1,5 @@
 #!/usr/bin/env python
-
+# -*- test-case-name: calendarserver.tools.test.test_agent -*-
 ##
 # Copyright (c) 2013 Apple Inc. All rights reserved.
 #
@@ -45,17 +45,7 @@
 from twisted.web.server import Site, NOT_DONE_YET
 from zope.interface import implements
 
-
-# TODO, implement this:
-# from launchd import getLaunchdSocketFds
-
-def getLaunchdSocketFds():
-    pass
-
-# For the sample client, below:
-from twisted.internet import reactor
-from twisted.internet.protocol import ClientCreator
-
+from twext.python.launchd import getLaunchDSocketFDs
 from twext.python.log import Logger
 log = Logger()
 
@@ -234,7 +224,7 @@
     """
     from twisted.internet import reactor
 
-    sockets = getLaunchdSocketFds() 
+    sockets = getLaunchDSocketFDs() 
     fd = sockets["AgentSocket"][0]
     
     family = socket.AF_INET
@@ -355,8 +345,16 @@
 </plist>"""
 
 def getList():
+    # For the sample client, below:
+    from twisted.internet import reactor
+    from twisted.internet.protocol import ClientCreator
+
     creator = ClientCreator(reactor, amp.AMP)
-    d = creator.connectTCP('sagen.apple.com', 62308)
+    host = '127.0.0.1'
+    import sys
+    if len(sys.argv) > 1:
+        host = sys.argv[1]
+    d = creator.connectTCP(host, 62308)
 
     def connected(ampProto):
         return ampProto.callRemote(GatewayAMPCommand, command=command)
@@ -370,7 +368,7 @@
         print('Done: %s' % (result,))
         reactor.stop()
     d.addCallback(done)
+    reactor.run()
 
 if __name__ == '__main__':
     getList()
-    reactor.run()
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20130626/9ab1c234/attachment.html>


More information about the calendarserver-changes mailing list