Skip to content

Commit

Permalink
Merge pull request #734 from skalenetwork/add-pull-config-option
Browse files Browse the repository at this point in the history
Add --pull--config option to skale node update
  • Loading branch information
badrogger authored Sep 14, 2023
2 parents 5e2e480 + 05a2b40 commit 418c957
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 20 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ubuntu:18.04
FROM ubuntu:20.04

ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && apt-get install -y software-properties-common
Expand Down
2 changes: 1 addition & 1 deletion lvmpy
5 changes: 3 additions & 2 deletions node_cli/cli/node.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,10 +108,11 @@ def init_node(env_file):
@click.option('--yes', is_flag=True, callback=abort_if_false,
expose_value=False,
prompt='Are you sure you want to update SKALE node software?')
@click.option('--pull-config', 'pull_config_for_schain', hidden=True, type=str)
@click.argument('env_file')
@streamed_cmd
def update_node(env_file):
update(env_file)
def update_node(env_file, pull_config_for_schain):
update(env_file, pull_config_for_schain)


@node.command('signature', help='Get node signature for given validator id')
Expand Down
18 changes: 15 additions & 3 deletions node_cli/core/node.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,12 @@ def restore(backup_path, env_filepath, no_snapshot=False):
print('Node is restored from backup')


def get_node_env(env_filepath, inited_node=False, sync_schains=None):
def get_node_env(
env_filepath,
inited_node=False,
sync_schains=None,
pull_config_for_schain=None
):
if env_filepath is not None:
env_params = extract_env_params(env_filepath)
if env_params is None:
Expand All @@ -186,15 +191,22 @@ def get_node_env(env_filepath, inited_node=False, sync_schains=None):
env['FLASK_SECRET_KEY'] = flask_secret_key
if sync_schains:
env['BACKUP_RUN'] = 'True'
if pull_config_for_schain:
env['PULL_CONFIG_FOR_SCHAIN'] = pull_config_for_schain
return {k: v for k, v in env.items() if v != ''}


@check_inited
@check_user
def update(env_filepath):
def update(env_filepath, pull_config_for_schain):
logger.info('Node update started')
configure_firewall_rules()
env = get_node_env(env_filepath, inited_node=True, sync_schains=False)
env = get_node_env(
env_filepath,
inited_node=True,
sync_schains=False,
pull_config_for_schain=pull_config_for_schain
)
update_ok = update_op(env_filepath, env)
if update_ok:
logger.info('Waiting for containers initialization')
Expand Down
24 changes: 12 additions & 12 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@ def find_version(*file_paths):

extras_require = {
'linter': [
"flake8==5.0.4",
"flake8==6.0.0",
"isort>=4.2.15,<5.10.2",
],
'dev': [
"bumpversion==0.6.0",
"pytest==7.1.2",
"pytest-cov==3.0.0",
"twine==4.0.1",
"pytest==7.2.2",
"pytest-cov==4.0.0",
"twine==4.0.2",
"mock==4.0.3",
"freezegun==1.2.2"
]
Expand All @@ -51,24 +51,24 @@ def find_version(*file_paths):
url='https://github.com/skalenetwork/node-cli',
install_requires=[
"click==8.1.3",
"PyInstaller==5.6.2",
"PyInstaller==5.12.0",
"distro==1.4.0",
"docker==6.0.1",
"texttable==1.6.4",
"texttable==1.6.7",
"python-dateutil==2.8.2",
"Jinja2==3.1.2",
"psutil==5.9.1",
"psutil==5.9.4",
"python-dotenv==0.21.0",
"terminaltables==3.1.10",
"requests==2.28.1",
"GitPython==3.1.30",
"packaging==21.3",
"python-debian==0.1.48",
"GitPython==3.1.31",
"packaging==23.0",
"python-debian==0.1.49",
"python-iptables==1.0.1",
"PyYAML==6.0",
"MarkupSafe==2.1.1",
'Flask==2.2.2',
'itsdangerous==2.0.1',
'Flask==2.3.3',
'itsdangerous==2.1.2',
'sh==1.14.2',
'python-crontab==2.6.0'
],
Expand Down
2 changes: 1 addition & 1 deletion tests/core_node_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,4 +185,4 @@ def test_update_node(mocked_g_config, resource_file):
mock.patch('node_cli.core.resources.get_disk_size',
return_value=BIG_DISK_SIZE), \
mock.patch('node_cli.core.host.init_data_dir'):
update(env_filepath)
update(env_filepath, pull_config_for_schain=None)

0 comments on commit 418c957

Please sign in to comment.