parent
a9ac5a5fb2
commit
eff558c8ad
|
@ -42,6 +42,13 @@ def make_server_args_parser():
|
||||||
parser.add_argument('--output-base', action='store', dest='output_base',
|
parser.add_argument('--output-base', action='store', dest='output_base',
|
||||||
default='.subiquity',
|
default='.subiquity',
|
||||||
help='in dryrun, control basedir of files')
|
help='in dryrun, control basedir of files')
|
||||||
|
parser.add_argument('--tcp-port',
|
||||||
|
dest='tcp_port',
|
||||||
|
type=int,
|
||||||
|
choices=range(49152, 60999),
|
||||||
|
help='The TCP port Subiquity must listen to. It means '
|
||||||
|
'TCP will be used instead of Unix domain sockets. '
|
||||||
|
'Only localhost connections are accepted.')
|
||||||
return parser
|
return parser
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -13,6 +13,8 @@
|
||||||
# You should have received a copy of the GNU Affero General Public License
|
# You should have received a copy of the GNU Affero General Public License
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
from aiohttp import web
|
||||||
|
|
||||||
from system_setup.common.wsl_utils import is_reconfigure
|
from system_setup.common.wsl_utils import is_reconfigure
|
||||||
from subiquity.server.server import SubiquityServer
|
from subiquity.server.server import SubiquityServer
|
||||||
from system_setup.models.system_setup import SystemSetupModel
|
from system_setup.models.system_setup import SystemSetupModel
|
||||||
|
@ -37,6 +39,7 @@ INSTALL_MODEL_NAMES = ModelNames({
|
||||||
|
|
||||||
POSTINSTALL_MODEL_NAMES = ModelNames(set())
|
POSTINSTALL_MODEL_NAMES = ModelNames(set())
|
||||||
|
|
||||||
|
LOCALHOST_ADDR="127.0.0.1"
|
||||||
|
|
||||||
class SystemSetupServer(SubiquityServer):
|
class SystemSetupServer(SubiquityServer):
|
||||||
prefillInfo = None
|
prefillInfo = None
|
||||||
|
@ -88,3 +91,13 @@ class SystemSetupServer(SubiquityServer):
|
||||||
async def wait_for_cloudinit(self):
|
async def wait_for_cloudinit(self):
|
||||||
self.cloud_init_ok = True
|
self.cloud_init_ok = True
|
||||||
return
|
return
|
||||||
|
|
||||||
|
async def start_site(self, runner: web.AppRunner):
|
||||||
|
port = self.opts.tcp_port
|
||||||
|
if port is None:
|
||||||
|
return await super().start_site(runner)
|
||||||
|
|
||||||
|
# Subiquity runs with root privileges. We don't wont outsiders to
|
||||||
|
# connect to it.
|
||||||
|
site = web.TCPSite(runner, host=LOCALHOST_ADDR, port=port)
|
||||||
|
await site.start()
|
||||||
|
|
Loading…
Reference in New Issue