Skip to content

Commit

Permalink
Merge pull request #267 from skalenetwork/hotfix/add-git-pull-to-update
Browse files Browse the repository at this point in the history
Hotfix/add git pull to update
  • Loading branch information
badrogger authored Aug 3, 2020
2 parents 98989cf + c68f1d8 commit 6c53da8
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 4 deletions.
2 changes: 1 addition & 1 deletion cli/containers.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,6 @@ def schains(all):
def ls(all):
status, payload = get_request('skale_containers', {'all': all})
if status == 'ok':
print_containers(payload)
print_containers(payload.get('containers', []))
else:
print_err_response(payload)
2 changes: 1 addition & 1 deletion cli/ssl.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def ssl():
def status():
status, payload = get_request('ssl_status')
if status == 'ok':
if payload['status']:
if payload.get('is_empty'):
print(TEXTS['ssl']['no_cert'])
else:
table_data = [
Expand Down
2 changes: 2 additions & 0 deletions datafiles/update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ docker_lvmpy_update

cd $CONFIG_DIR
if [[ -z $CONTAINER_CONFIGS_DIR ]]; then
echo "Fetching new branches and tags..."
git fetch
echo "Checkouting to container configs branch $CONTAINER_CONFIGS_STREAM ..."
git checkout $CONTAINER_CONFIGS_STREAM
echo "Pulling changes ..."
Expand Down
30 changes: 28 additions & 2 deletions tests/cli/containers_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,32 @@
]}


OK_LS_RESPONSE_DATA = {
'status': 'ok',
'payload':
{'containers': [{'image': 'skalenetwork/schain:1.46-develop.21',
'name': 'skale_schain_shapely-alfecca-meridiana',
'state': {
'Status': 'running', 'Running': True,
'Paused': False, 'Restarting': False,
'OOMKilled': False, 'Dead': False,
'Pid': 232, 'ExitCode': 0,
'Error': '',
'StartedAt': '2020-07-31T11:56:35.732888232Z',
'FinishedAt': '0001-01-01T00:00:00Z'}
},
{'image': 'skale-admin:latest', 'name': 'skale_api',
'state': {
'Status': 'running',
'Running': True, 'Paused': False,
'Restarting': False, 'OOMKilled': False,
'Dead': False, 'Pid': 6710, 'ExitCode': 0,
'Error': '',
'StartedAt': '2020-07-31T11:55:17.28700307Z',
'FinishedAt': '0001-01-01T00:00:00Z'}}]
}}


def test_schains_ok_response(config):
resp_mock = response_mock(
requests.codes.ok,
Expand Down Expand Up @@ -99,9 +125,9 @@ def test_schain_multi_error_response(config):
def test_ls():
resp_mock = response_mock(
requests.codes.ok,
json_data=OK_RESPONSE_DATA
json_data=OK_LS_RESPONSE_DATA
)
result = run_command_mock('core.helper.requests.get',
resp_mock, ls)
assert result.exit_code == 0
assert result.output == ' Name Status Started At Image \n-------------------------------------------------------------------------------------\nskale_schain_test Running Oct 08 2019 13:59:54 image-skale\nskale_schain_test2 Running (Jan 01 1 00:00:00) Oct 08 2019 13:59:54 image-skale\n' # noqa
assert result.output == ' Name Status Started At Image \n-------------------------------------------------------------------------------------------------------------\nskale_schain_shapely-alfecca-meridiana Running Jul 31 2020 11:56:35 skalenetwork/schain:1.46-develop.21\nskale_api Running Jul 31 2020 11:55:17 skale-admin:latest \n' # noqa

0 comments on commit 6c53da8

Please sign in to comment.