you can't "zero deploy" to any service other than the slave service. that's mostly due to technical limitations -- you have to send the service code to the other side first, which makes life more complicated. if you want to add a patch, e.g., implement CustomDeployServer(files_to_copy) please do so and send me a pull request
-tomer ----------------------------------------------------------------- *Tomer Filiba* tomerfiliba.com <http://www.facebook.com/tomerfiliba> <http://il.linkedin.com/in/tomerfiliba> On Mon, Oct 14, 2013 at 6:40 PM, <[email protected]> wrote: > Hi, > I would like to use RPyC service model while deploying new server via > zerodeploy, > however I don't see any API available for this. Tried to add my service > TestService to DeployedServer.connect() but it doesn't work. > Am I missing something? > Appreciate your help. > > class TestService(Service): > def on_connect(self): > pass > def on_disconnect(self): > pass > > def exposed_GetHostName(self): # this is an exposed method > with open("/etc/hostname","r") as hostnameFile: > return "Remote hostname is: "%hostnameFile.read().strip() > > def get_question(self): # while this method is not exposed > return "what is the airspeed velocity of an unladen swallow?" > > def connectToServer(hostName, userName): > print "Connecting to '%s' with user name '%s' ..."%(hostName, userName) > mach = SshMachine(hostName, user=userName) > print "Connected!" > print "Remote date and time: [ %s ]"%( mach["date"]().strip() ) > print "Deploying RPyC..." > server = DeployedServer(mach) > print "RPyC server deployed and started. Connecting to local RPyC..." > conn1 = server.connect(TestService) > print "SSH tunnel to local RPyC server on '%s' created " % (hostName) > return server, conn1 > > def run(): > serverConn, rpyc_conn = connectToServer(hostName="server-name", > userName="user") > print "server returned:"+rpyc_conn.root.GetHostName() > if __name__ == "__main__": > run() > > Error: > .... > File "/tmp/tmp.LpfT7Bf2m4/rpyc/core/protocol.py", line 501, in > _access_attr > return accessor(obj, name, *args) > File "/tmp/tmp.LpfT7Bf2m4/rpyc/core/service.py", line 69, in > _rpyc_getattr > return getattr(self, name) > AttributeError: 'SlaveService' object has no attribute > 'exposed_GetHostName' -- --- You received this message because you are subscribed to the Google Groups "rpyc" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/groups/opt_out.
