1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
|
From 3f1a992889c858b400d84a5583fd144d93ea23f3 Mon Sep 17 00:00:00 2001
From: Hongxu Jia <hongxu.jia@windriver.com>
Date: Tue, 24 Jul 2018 16:49:09 +0800
Subject: [PATCH 34/65] text repository setting: support http proxy
For text mode, it supports:
- http repo + http proxy;
- https repo + http proxy;
- ftp repo + http proxy;
Upstream-Status: Pending
Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
---
pyanaconda/ui/helpers.py | 8 +++++++-
pyanaconda/ui/tui/spokes/installation_source.py | 17 ++++++++++++++++-
2 files changed, 23 insertions(+), 2 deletions(-)
diff --git a/pyanaconda/ui/helpers.py b/pyanaconda/ui/helpers.py
index d980983..e9cdcab 100644
--- a/pyanaconda/ui/helpers.py
+++ b/pyanaconda/ui/helpers.py
@@ -109,6 +109,7 @@ class SourceSwitchHandler(object, metaclass=ABCMeta):
It will correctly switch to the new method
and cleanup any previous method set.
"""
+ log = get_module_logger(__name__)
@abstractproperty
def data(self):
@@ -177,7 +178,7 @@ class SourceSwitchHandler(object, metaclass=ABCMeta):
# as we already made the device protected when
# switching to it, we don't need to protect it here
- def set_source_url(self, url=None):
+ def set_source_url(self, url=None, proxy=None):
""" Switch to install source specified by URL """
# clean any old HDD ISO sources
self._clean_hdd_iso()
@@ -185,6 +186,11 @@ class SourceSwitchHandler(object, metaclass=ABCMeta):
self.data.method.method = "url"
if url is not None:
self.data.method.url = url
+ self.log.info("url: %s" % url)
+
+ if proxy is not None:
+ self.data.method.proxy = proxy
+ self.log.info("proxy: %s" % proxy)
def set_source_nfs(self, opts=None):
""" Switch to NFS install source """
diff --git a/pyanaconda/ui/tui/spokes/installation_source.py b/pyanaconda/ui/tui/spokes/installation_source.py
index ab44ecc..da65437 100644
--- a/pyanaconda/ui/tui/spokes/installation_source.py
+++ b/pyanaconda/ui/tui/spokes/installation_source.py
@@ -263,6 +263,7 @@ class SpecifyRepoSpoke(NormalTUISpoke, SourceSwitchHandler):
self._container = None
self._url = self.data.url.url
+ self._proxy = self.data.method.proxy
def refresh(self, args=None):
""" Refresh window. """
@@ -273,11 +274,17 @@ class SpecifyRepoSpoke(NormalTUISpoke, SourceSwitchHandler):
dialog = Dialog(_("Repo URL"))
self._container.add(EntryWidget(dialog.title, self._url), self._set_repo_url, dialog)
+ dialog = Dialog(_("Repo Proxy"))
+ self._container.add(EntryWidget(dialog.title, self._proxy), self._set_repo_proxy, dialog)
+
self.window.add_with_separator(self._container)
def _set_repo_url(self, dialog):
self._url = dialog.run()
+ def _set_repo_proxy(self, dialog):
+ self._proxy = dialog.run()
+
def input(self, args, key):
if self._container.process_user_input(key):
self.apply()
@@ -302,7 +309,15 @@ class SpecifyRepoSpoke(NormalTUISpoke, SourceSwitchHandler):
# protocol either unknown or entry already starts with a protocol
# specification
url = self._url
- self.set_source_url(url)
+
+ # Proxy only support http protocal
+ proxy = None
+ if self._proxy is not None:
+ if not self._proxy.startswith("http://"):
+ proxy = "http://" + self._proxy
+ else:
+ proxy = self._proxy
+ self.set_source_url(url, proxy)
class SpecifyNFSRepoSpoke(NormalTUISpoke, SourceSwitchHandler):
--
2.7.4
|