Skip to content

Commit 4f45d33

Browse files
authored
Merge pull request #954 from skalenetwork/merge-skale-active-and-passive-pipelines
Merge SKALE active and passive node pipelines
2 parents 9733409 + b8dca65 commit 4f45d33

14 files changed

Lines changed: 81 additions & 109 deletions

File tree

node_cli/cli/passive_node.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,9 @@ def _init_passive(
6666
expose_value=False,
6767
prompt='Are you sure you want to update SKALE node software?',
6868
)
69-
@click.option('--unsafe', 'unsafe_ok', help='Allow unsafe update', hidden=True, is_flag=True)
7069
@click.argument('env_file')
7170
@streamed_cmd
72-
def _update_passive(env_file, unsafe_ok):
71+
def _update_passive(env_file):
7372
update_passive(env_file)
7473

7574

node_cli/configs/__init__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@
5555
SGX_CERTIFICATES_DIR_NAME = 'sgx_certs'
5656

5757
COMPOSE_PATH = os.path.join(CONTAINER_CONFIG_PATH, 'docker-compose.yml')
58-
PASSIVE_COMPOSE_PATH = os.path.join(CONTAINER_CONFIG_PATH, 'docker-compose-passive.yml')
5958
FAIR_COMPOSE_PATH = os.path.join(CONTAINER_CONFIG_PATH, 'docker-compose-fair.yml')
6059
STATIC_PARAMS_FILEPATH = os.path.join(CONTAINER_CONFIG_PATH, 'static_params.yaml')
6160
FAIR_STATIC_PARAMS_FILEPATH = os.path.join(CONTAINER_CONFIG_PATH, 'fair_static_params.yaml')

node_cli/core/checks.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -385,7 +385,6 @@ def docker_compose(self) -> CheckResult:
385385
)
386386
output = v_cmd_result.stdout.decode('utf-8').rstrip()
387387
if v_cmd_result.returncode != 0:
388-
info = f'Checking docker compose version failed with: {output}'
389388
return self._failed(name=name, info=output)
390389

391390
actual_version = output.split(',')[0].split()[-1].strip()

node_cli/core/host.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
import logging
2121
import os
22-
from shutil import copyfile
22+
from shutil import copyfile, chown
2323
from urllib.parse import urlparse
2424

2525
from node_cli.core.resources import update_resource_allocation
@@ -94,6 +94,7 @@ def prepare_host(env_filepath: str, env_type: str, allocation: bool = False) ->
9494
try:
9595
logger.info('Preparing host started')
9696
make_dirs()
97+
chown(REDIS_DATA_PATH, user=999, group=1000)
9798
save_env_params(env_filepath)
9899

99100
if allocation:

node_cli/core/logs.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ def create_logs_dump(path, filter_container=None):
4242
if filter_container:
4343
containers = get_containers(filter_container)
4444
else:
45-
containers = get_containers('skale')
45+
containers = get_containers('sk_*')
4646

4747
for container in containers:
4848
log_filepath = os.path.join(containers_logs_path, f'{container.name}.log')

node_cli/core/nftables.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -529,7 +529,6 @@ def add_loopback_rule(self, chain) -> None:
529529

530530
def get_base_ruleset(self) -> str:
531531
self.nft.set_json_output(False)
532-
output = ''
533532
try:
534533
cmd = f'list chain {self.family} {self.table} {self.chain}'
535534
rc, output, error = self.nft.cmd(cmd)
@@ -539,7 +538,6 @@ def get_base_ruleset(self) -> str:
539538
finally:
540539
self.nft.set_json_output(True)
541540

542-
return output
543541

544542
def setup_firewall(self, enable_monitoring: bool = False) -> None:
545543
"""Setup firewall rules."""

node_cli/core/node.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,6 @@
9494
logger = logging.getLogger(__name__)
9595
TEXTS = safe_load_texts()
9696

97-
BASE_CONTAINERS_AMOUNT = 5
9897
BLUEPRINT_NAME = 'node'
9998

10099

@@ -207,7 +206,7 @@ def init_passive(
207206

208207
@check_inited
209208
@check_user
210-
def update_passive(env_filepath: str, unsafe_ok: bool = False) -> None:
209+
def update_passive(env_filepath: str) -> None:
211210
logger.info('Node update started')
212211
prev_version = CliMetaManager().get_meta_info().version
213212
if (__version__ == 'test' or __version__.startswith('2.6')) and prev_version == '2.5.0':
@@ -263,6 +262,7 @@ def compose_node_env(
263262
else:
264263
user_config = get_validated_user_config(
265264
node_type=node_type,
265+
node_mode=node_mode,
266266
env_filepath=INIT_ENV_FILEPATH,
267267
is_fair_boot=is_fair_boot,
268268
skip_user_conf_validation=skip_user_conf_validation,

node_cli/core/resources.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -151,13 +151,10 @@ def get_cpu_alloc(common_config: Dict) -> ResourceAlloc:
151151
cpu_proportions = common_config['schain']['cpu']
152152
schain_max_cpu_shares = int(cpu_proportions['skaled'] * MAX_CPU_SHARES)
153153
ima_max_cpu_shares = int(cpu_proportions['ima'] * MAX_CPU_SHARES)
154-
return (ResourceAlloc(schain_max_cpu_shares), ResourceAlloc(ima_max_cpu_shares))
154+
return ResourceAlloc(schain_max_cpu_shares), ResourceAlloc(ima_max_cpu_shares)
155155

156156

157-
def verify_disk_size(
158-
disk_device: str,
159-
env_configs: dict,
160-
) -> Dict:
157+
def verify_disk_size(disk_device: str, env_configs: dict):
161158
disk_size = get_disk_size(disk_device)
162159
env_disk_size = env_configs['server']['disk']
163160
check_disk_size(disk_size, env_disk_size)

node_cli/fair/staking.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,6 @@ def get_exit_requests(raw: bool = False) -> None:
109109
exit_requests = payload.get('exit_requests')
110110
if not isinstance(exit_requests, list):
111111
error_exit(payload, exit_code=CLIExitCodes.BAD_API_RESPONSE)
112-
return
113112
if raw:
114113
print(json.dumps(exit_requests, indent=2))
115114
return

node_cli/operations/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,6 @@
2121
update as update_op,
2222
init as init_op,
2323
init_passive as init_passive_op,
24-
init_fair_boot as init_fair_boot_op,
25-
update_fair_boot as update_fair_boot_op,
2624
update_passive as update_passive_op,
2725
turn_off as turn_off_op,
2826
turn_on as turn_on_op,
@@ -31,7 +29,9 @@
3129
configure_nftables,
3230
)
3331
from node_cli.operations.fair import ( # noqa
32+
init_fair_boot as init_fair_boot_op,
3433
init as init_fair_op,
34+
update_fair_boot as update_fair_boot_op,
3535
update as update_fair_op,
3636
FairUpdateType,
3737
restore as restore_fair_op,

0 commit comments

Comments
 (0)