Skip to content

Commit c069d29

Browse files
author
Roey Darwish Dror
committed
Merge branch 'hotfix/0.26.1'
2 parents dba2be7 + 1fbe9ac commit c069d29

File tree

4 files changed

+18
-4
lines changed

4 files changed

+18
-4
lines changed

flask_app/app.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
app_name: scotty
2-
APP_VERSION: 0.26.0
2+
APP_VERSION: 0.26.1
33
SECURITY_PASSWORD_HASH: sha512_crypt
44
SQLALCHEMY_TRACK_MODIFICATIONS: false

flask_app/blueprints/beams.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,11 +96,15 @@ def create(user):
9696
if not is_valid_hostname(request.json['beam']['host']):
9797
return 'Invalid hostname', http.client.CONFLICT
9898

99+
directory = request.json['beam']['directory']
100+
if directory == '/':
101+
return 'Invalid beam directory', http.client.CONFLICT
102+
99103
beam = Beam(
100104
start=current_timeline.datetime.utcnow(), size=0,
101105
host=request.json['beam']['host'],
102106
comment=request.json['beam'].get('comment'),
103-
directory=request.json['beam']['directory'],
107+
directory=directory,
104108
initiator=user.id,
105109
error=None,
106110
combadge_contacted=False,
@@ -164,7 +168,7 @@ def update(beam_id):
164168
else:
165169
json = request.json
166170

167-
if 'completed' in request.json:
171+
if 'completed' in json:
168172
beam.completed = json['completed']
169173
beam.error = json.get('error', None)
170174

tests/slashconf.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,7 @@ def download_dir(tempdir):
207207
@slash.fixture
208208
def beam(scotty, local_beam_dir):
209209
beam = scotty.get_beam(scotty.beam_up(local_beam_dir))
210+
assert beam.completed
210211
return BeamInfo(beam, None)
211212

212213

tests/test_deployment/test__sanity.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,19 @@
11
import subprocess
2-
2+
import http.client
3+
import slash
4+
from requests.exceptions import HTTPError
35

46
def test_sanity(scotty):
57
scotty.sanity_check()
68

79

10+
def test_forbid_root_beam(scotty):
11+
with slash.assert_raises(HTTPError) as e:
12+
scotty.beam_up("/")
13+
14+
assert e.exception.response.status_code == http.client.CONFLICT
15+
16+
817
def test_independent_beam(beam, local_beam_dir, download_dir):
918
for file_ in beam.beam.iter_files():
1019
file_.download(download_dir)

0 commit comments

Comments
 (0)