Example #1
0
    def _vnc(self, argv):
        if len(argv) != 3:
            raise MissingException("This action takes 3 arguments")

        host = self._get_entity(argv)
        vnc_params = host.instance().get().vnc

        # Get VNC viewer call string
        config = Config()
        viewer_call_template = config.get_vnc_viewer_call(self._config.options.profile_name)
        if viewer_call_template is None or viewer_call_template == "":
            raise ControllerException("VNC viewer is not configured")

        # Call viewer
        hostname = vnc_params.hostname
        port = vnc_params.port
        if hostname != None and port != None:
            call = viewer_call_template.replace("%h", hostname).replace("%p", port)
            subprocess.call(call, shell = True)
        else:
            raise ControllerException("Could not retrieve VNC server host and/or port")
Example #2
0
    def _vnc(self, argv):
        if len(argv) != 3:
            raise MissingException("This action takes 3 arguments")

        host = self._get_entity(argv)
        vnc_params = host.instance().get().vnc

        # Get VNC viewer call string
        config = Config()
        viewer_call_template = config.get_vnc_viewer_call(self._config.options.profile_name)
        if viewer_call_template is None or viewer_call_template == "":
            raise ControllerException("VNC viewer is not configured")

        # Call viewer
        hostname = vnc_params.hostname
        port = vnc_params.port
        if hostname != None and port != None:
            call = viewer_call_template.replace("%h", hostname).replace("%p", port)
            subprocess.call(call, shell = True)
        else:
            raise ControllerException("Could not retrieve VNC server host and/or port")