Skip to content
This repository was archived by the owner on Dec 21, 2022. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 0 additions & 11 deletions Vagrantfile

This file was deleted.

33 changes: 0 additions & 33 deletions contrib/archlinux/PKGBUILD

This file was deleted.

33 changes: 0 additions & 33 deletions contrib/bash-completion/README.md

This file was deleted.

68 changes: 0 additions & 68 deletions contrib/bash-completion/stormssh

This file was deleted.

58 changes: 0 additions & 58 deletions contrib/suse/stormssh.spec

This file was deleted.

20 changes: 0 additions & 20 deletions scripts/setup.sh

This file was deleted.

2 changes: 1 addition & 1 deletion storm/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import re
from shutil import copyfile

from .parsers.ssh_config_parser import ConfigParser
from .parsers import ConfigParser
from .defaults import get_default


Expand Down
2 changes: 1 addition & 1 deletion storm/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import builtins

from storm import Storm
from storm.parsers.ssh_uri_parser import parse
from storm.parsers import parse
from storm.utils import (get_formatted_message, colored)
from storm.kommandr import *
from storm.defaults import get_default
Expand Down
10 changes: 10 additions & 0 deletions storm/parsers/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
from ssh_config_parser import StormConfig, ConfigParser
from ssh_uri_parser import parse
from storm_config_parser import get_storm_config

__all__ = [
"StormConfig",
"ConfigParser",
"parse",
"get_storm_config"
]
8 changes: 4 additions & 4 deletions storm/static/js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ function Storm($scope, $http) {
}

function fetch(callback) {
$http.get("/list").success(function (data) {
$http.get("/servers").success(function (data) {
$scope.servers = data.map(function (host) {
var port = host.options.port;
var hostname = host.options.hostname;
Expand Down Expand Up @@ -59,7 +59,7 @@ function Storm($scope, $http) {

if ($scope.state.editIndex > -1) {
$scope.isDisabled = false;
$http.put('/edit', JSON.stringify({name: $scope.title, connection_uri: $scope.uri, id_file: $scope.id_file})).
$http.put('/servers/' + $scope.title, JSON.stringify({connection_uri: $scope.uri, id_file: $scope.id_file})).
success(function(data, status) {
if (status == 200) {
$scope.servers[$scope.state.editIndex] = {
Expand All @@ -81,7 +81,7 @@ function Storm($scope, $http) {
});

} else {
$http.post('/add', JSON.stringify({name: $scope.title, connection_uri: $scope.uri, id_file: $scope.id_file})).
$http.post('/servers/'+$scope.title, JSON.stringify({connection_uri: $scope.uri, id_file: $scope.id_file})).
success(function (data, status) {
if (status == 201) {
$scope.servers.push({
Expand Down Expand Up @@ -137,7 +137,7 @@ function Storm($scope, $http) {
};

$scope.delete = function (serverToDelete) {
$http.post("/delete", JSON.stringify({name: serverToDelete.host})).
$http.delete("/servers/" + serverToDelete.host).
success(function () {
fetch(function () {
plural();
Expand Down
23 changes: 13 additions & 10 deletions storm/web.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
send_from_directory)

from storm import Storm, DELETED_SIGN
from storm.parsers.ssh_uri_parser import parse
from storm.parsers import parse


app = Flask(__name__)
Expand All @@ -28,16 +28,17 @@ def response(resp=None, status=200, content_type='application/json'):


@app.route('/')
@app.route('/index')
def index():
return render('index.html', __THEME__)

@app.route('/list', methods=['GET'])
@app.route('/servers', methods=['GET'])
def list_keys():
storm_ = app.get_storm()
return response(json.dumps(storm_.list_entries(True, only_servers=True)))


@app.route('/add', methods=['POST'])
@app.route('/servers', methods=['POST'])
def add():
storm_ = app.get_storm()

Expand All @@ -60,13 +61,17 @@ def add():
except (KeyError, TypeError):
return response(status=400)

@app.route('/servers/<name>', methods=['GET'])
def list_keys(name):
storm_ = app.get_storm()
return response(json.dumps(storm_.list_entries(True, only_servers=True).get(name)))


@app.route('/edit', methods=['PUT'])
def edit():
@app.route('/servers/<name>', methods=['PUT','POST'])
def edit(name):
storm_ = app.get_storm()

try:
name = request.json['name']
connection_uri = request.json['connection_uri']
id_file = None
if 'id_file' in request.json:
Expand All @@ -82,13 +87,11 @@ def edit():
except (KeyError, TypeError):
return response(status=400)


@app.route('/delete', methods=['POST'])
def delete():
@app.route('/servers/<name>', methods=['DELETE'])
def delete(name):
storm_ = app.get_storm()

try:
name = request.json['name']
storm_.delete_entry(name)
return response()
except ValueError as exc:
Expand Down