Skip to content

Commit 3f3a5f0

Browse files
committed
Remove loading of active tools from the web proxy
This relies on Grid features which is not wanted.
1 parent c545eb7 commit 3f3a5f0

3 files changed

Lines changed: 0 additions & 45 deletions

File tree

data/templates/tools.html

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,6 @@ <h1>{{ 'tools-header'|message }}</h1>
3737
<h4 class="card-title">
3838
{% if info.url %}
3939
<a href="{{ info.url }}">{{ info.title|default(tool.name) }}</a>
40-
{% elseif tool.toolinfo|length == 1 and active[tool.name] %}
41-
<a href="https://{{ tool.name }}.toolforge.org/">{{ tool.name }}</a>
4240
{% else %}
4341
{{ info.title|default(tool.name) }}
4442
{% endif %}

src/Pages/Tools.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,9 @@ public function setLabsDao( $dao ) {
5050
}
5151

5252
protected function handleGet() {
53-
$active = $this->tools->getActiveWebservices();
5453
$users = $this->labsDao->getAllUsers();
5554
$tools = $this->labsDao->getAllTools();
5655

57-
$this->view->set( 'active', $active );
5856
$this->view->set( 'users', $users );
5957
$this->view->set( 'tools', $tools );
6058
$this->render( 'tools.html' );

src/Tools.php

Lines changed: 0 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -90,45 +90,4 @@ protected function getMemberInfo( array $members ) {
9090
}
9191
return $ret;
9292
}
93-
94-
/**
95-
* Get list of currently active webservices.
96-
* @return array
97-
*/
98-
public function getActiveWebservices() {
99-
$key = 'tools:active';
100-
$services = $this->cache->load( $key );
101-
if ( !$services ) {
102-
// FIXME: /etc/active-proxy is not exposed to Kubernetes
103-
// containers.
104-
// $active_proxy = file_get_contents( '/etc/active-proxy' );
105-
// Split horizon DNS should take us where we need to go
106-
$active_proxy = 'admin.toolforge.org';
107-
$proxy_uri = "http://{$active_proxy}:8081/list";
108-
$client = new Client();
109-
$response = $client->get( $proxy_uri );
110-
$body = $response->getBody();
111-
$json = json_decode( $body, true );
112-
if ( $json ) {
113-
$proxies = json_decode( $body, true );
114-
foreach ( $proxies as $key => $value ) {
115-
if (
116-
array_key_exists( 'status', $value ) &&
117-
$value['status'] == 'active'
118-
) {
119-
$services[$key] = 1;
120-
}
121-
}
122-
$this->cache->save( $key, $services, 600 );
123-
} else {
124-
$this->logger->error( 'Error fetching webproxy status data', [
125-
'method' => __METHOD__,
126-
'status' => $response->getStatusCode(),
127-
'body' => $body,
128-
] );
129-
$services = [];
130-
}
131-
}
132-
return $services;
133-
}
13493
}

0 commit comments

Comments
 (0)