move proxy controller to new world
This commit is contained in:
parent
7f41803418
commit
c264884c0c
|
@ -5,6 +5,7 @@ subiquity/client/controllers/__init__.py
|
|||
subiquity/client/controllers/keyboard.py
|
||||
subiquity/client/controllers/network.py
|
||||
subiquity/client/controllers/progress.py
|
||||
subiquity/client/controllers/proxy.py
|
||||
subiquity/client/controllers/refresh.py
|
||||
subiquity/client/controllers/welcome.py
|
||||
subiquity/client/controllers/zdev.py
|
||||
|
@ -36,7 +37,6 @@ subiquity/controllers/filesystem.py
|
|||
subiquity/controllers/identity.py
|
||||
subiquity/controllers/__init__.py
|
||||
subiquity/controllers/mirror.py
|
||||
subiquity/controllers/proxy.py
|
||||
subiquity/controllers/reboot.py
|
||||
subiquity/controllers/snaplist.py
|
||||
subiquity/controllers/ssh.py
|
||||
|
@ -124,6 +124,7 @@ subiquity/server/controllers/keyboard.py
|
|||
subiquity/server/controllers/locale.py
|
||||
subiquity/server/controllers/network.py
|
||||
subiquity/server/controllers/package.py
|
||||
subiquity/server/controllers/proxy.py
|
||||
subiquity/server/controllers/refresh.py
|
||||
subiquity/server/controllers/reporting.py
|
||||
subiquity/server/controllers/userdata.py
|
||||
|
|
|
@ -95,6 +95,7 @@ class SubiquityClient(TuiApplication):
|
|||
"Keyboard",
|
||||
"Zdev",
|
||||
"Network",
|
||||
"Proxy",
|
||||
"Progress",
|
||||
]
|
||||
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
from .keyboard import KeyboardController
|
||||
from .network import NetworkController
|
||||
from .progress import ProgressController
|
||||
from .proxy import ProxyController
|
||||
from .refresh import RefreshController
|
||||
from .welcome import WelcomeController
|
||||
from .zdev import ZdevController
|
||||
|
@ -24,6 +25,7 @@ __all__ = [
|
|||
'KeyboardController',
|
||||
'NetworkController',
|
||||
'ProgressController',
|
||||
'ProxyController',
|
||||
'RefreshController',
|
||||
'WelcomeController',
|
||||
'ZdevController',
|
||||
|
|
|
@ -0,0 +1,41 @@
|
|||
# Copyright 2018 Canonical, Ltd.
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Affero General Public License as
|
||||
# published by the Free Software Foundation, either version 3 of the
|
||||
# License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU Affero General Public License for more details.
|
||||
#
|
||||
# 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/>.
|
||||
|
||||
import logging
|
||||
|
||||
from subiquity.client.controller import SubiquityTuiController
|
||||
from subiquity.ui.views.proxy import ProxyView
|
||||
|
||||
log = logging.getLogger('subiquity.client.controllers.proxy')
|
||||
|
||||
|
||||
class ProxyController(SubiquityTuiController):
|
||||
|
||||
endpoint_name = 'proxy'
|
||||
|
||||
async def make_ui(self):
|
||||
proxy = await self.endpoint.GET()
|
||||
return ProxyView(self, proxy)
|
||||
|
||||
def run_answers(self):
|
||||
if 'proxy' in self.answers:
|
||||
self.done(self.answers['proxy'])
|
||||
|
||||
def cancel(self):
|
||||
self.app.prev_screen()
|
||||
|
||||
def done(self, proxy):
|
||||
log.debug("ProxyController.done next_screen proxy=%s", proxy)
|
||||
self.app.next_screen(self.endpoint.POST(proxy))
|
|
@ -40,6 +40,7 @@ class API:
|
|||
"""The API offered by the subiquity installer process."""
|
||||
locale = simple_endpoint(str)
|
||||
keyboard = simple_endpoint(KeyboardSetting)
|
||||
proxy = simple_endpoint(str)
|
||||
|
||||
class meta:
|
||||
class status:
|
||||
|
|
|
@ -17,7 +17,6 @@ from ..controller import RepeatedController
|
|||
from .filesystem import FilesystemController
|
||||
from .identity import IdentityController
|
||||
from .mirror import MirrorController
|
||||
from .proxy import ProxyController
|
||||
from .reboot import RebootController
|
||||
from .snaplist import SnapListController
|
||||
from .ssh import SSHController
|
||||
|
@ -26,7 +25,6 @@ __all__ = [
|
|||
'FilesystemController',
|
||||
'IdentityController',
|
||||
'MirrorController',
|
||||
'ProxyController',
|
||||
'RebootController',
|
||||
'RepeatedController',
|
||||
'SnapListController',
|
||||
|
|
|
@ -20,6 +20,7 @@ from .keyboard import KeyboardController
|
|||
from .locale import LocaleController
|
||||
from .network import NetworkController
|
||||
from .package import PackageController
|
||||
from .proxy import ProxyController
|
||||
from .refresh import RefreshController
|
||||
from .reporting import ReportingController
|
||||
from .userdata import UserdataController
|
||||
|
@ -35,6 +36,7 @@ __all__ = [
|
|||
'LocaleController',
|
||||
'NetworkController',
|
||||
'PackageController',
|
||||
'ProxyController',
|
||||
'RefreshController',
|
||||
'ReportingController',
|
||||
'UserdataController',
|
||||
|
|
|
@ -18,13 +18,15 @@ import os
|
|||
|
||||
from subiquitycore.context import with_context
|
||||
|
||||
from subiquity.controller import SubiquityTuiController
|
||||
from subiquity.ui.views.proxy import ProxyView
|
||||
from subiquity.common.apidef import API
|
||||
from subiquity.server.controller import SubiquityController
|
||||
|
||||
log = logging.getLogger('subiquity.controllers.proxy')
|
||||
log = logging.getLogger('subiquity.server.controllers.proxy')
|
||||
|
||||
|
||||
class ProxyController(SubiquityTuiController):
|
||||
class ProxyController(SubiquityController):
|
||||
|
||||
endpoint = API.proxy
|
||||
|
||||
autoinstall_key = model_name = "proxy"
|
||||
autoinstall_schema = {
|
||||
|
@ -48,30 +50,19 @@ class ProxyController(SubiquityTuiController):
|
|||
# by everything; don't have a way to do that today.
|
||||
pass
|
||||
|
||||
def make_ui(self):
|
||||
return ProxyView(self, self.model.proxy)
|
||||
|
||||
def run_answers(self):
|
||||
if 'proxy' in self.answers:
|
||||
self.done(self.answers['proxy'])
|
||||
|
||||
def cancel(self):
|
||||
self.app.prev_screen()
|
||||
|
||||
def serialize(self):
|
||||
return self.model.proxy
|
||||
|
||||
def deserialize(self, data):
|
||||
self.model.proxy = data
|
||||
|
||||
def done(self, proxy):
|
||||
log.debug("ProxyController.done next_screen proxy=%s", proxy)
|
||||
if proxy != self.model.proxy:
|
||||
self.model.proxy = proxy
|
||||
os.environ['http_proxy'] = os.environ['https_proxy'] = proxy
|
||||
self.signal.emit_signal('network-proxy-set')
|
||||
self.configured()
|
||||
self.app.next_screen()
|
||||
|
||||
def make_autoinstall(self):
|
||||
return self.model.proxy
|
||||
|
||||
async def GET(self) -> str:
|
||||
return self.model.proxy
|
||||
|
||||
async def POST(self, data: str):
|
||||
self.model.proxy = data
|
||||
self.signal.emit_signal('network-proxy-set')
|
||||
self.configured()
|
|
@ -123,6 +123,7 @@ class SubiquityServer(Application):
|
|||
"Keyboard",
|
||||
"Zdev",
|
||||
"Network",
|
||||
"Proxy",
|
||||
"Install",
|
||||
"Late",
|
||||
]
|
||||
|
|
Loading…
Reference in New Issue