diff --git a/api/python/provisioner/commands/cluster_id.py b/api/python/provisioner/commands/cluster_id.py index cbfd374b3..95a82c2af 100644 --- a/api/python/provisioner/commands/cluster_id.py +++ b/api/python/provisioner/commands/cluster_id.py @@ -218,7 +218,9 @@ def run(self, targets=ALL_MINIONS): # Ensure cluster-id file is created in all nodes StatesApplier.apply( - ['components.provisioner.config.cluster_id'], + ['components.provisioner.config.cluster_id', + 'components.system.config.sync_salt' + ], targets=ALL_MINIONS ) diff --git a/api/python/provisioner/commands/confstore_export.py b/api/python/provisioner/commands/confstore_export.py index a1c667b0a..c8342c61e 100644 --- a/api/python/provisioner/commands/confstore_export.py +++ b/api/python/provisioner/commands/confstore_export.py @@ -114,12 +114,17 @@ def run(self, **kwargs): template_file_path = str( CORTX_CONFIG_DIR / 'provisioner_confstore_template') + + # TODO + # Not a good way to call primary node with hardcoded value + # need to remove it for hostname bug for cortx_setup API + node= 'srvnode-1' StateFunExecuter.execute( 'file.managed', fun_kwargs=dict( name=template_file_path, source='salt://components/system/files/confstore_template.j2', - template='jinja')) + template='jinja'),targets=node) logger.info("Pillar confstore template is created at " f"{template_file_path}" ) diff --git a/lr-cli/cortx_setup/commands/cluster/create.py b/lr-cli/cortx_setup/commands/cluster/create.py index 9b645689a..3ac4c5ebe 100644 --- a/lr-cli/cortx_setup/commands/cluster/create.py +++ b/lr-cli/cortx_setup/commands/cluster/create.py @@ -58,7 +58,12 @@ local_minion_id, cmd_run ) +from provisioner import salt from provisioner.api import grains_get +from cortx_setup.config import ( + ALL_MINIONS +) +from provisioner.salt import StatesApplier class ClusterCreate(Command): @@ -133,6 +138,7 @@ def run(self, **kwargs): """ try: index = 'node_info_index' + local_minion = None local_fqdn = socket.gethostname() cluster_args = ['name', 'site_count', 'storageset_count'] @@ -148,6 +154,7 @@ def run(self, **kwargs): for idx, node in enumerate(nodes): if node == local_fqdn: nodes[idx] = f"srvnode-1:{node}" + local_minion = 'srvnode-1' else: nodes[idx] = f"srvnode-{idx+1}:{node}" @@ -182,7 +189,7 @@ def run(self, **kwargs): f"Starting bootstrap process now with args: {kwargs}" ) bootstrap_provisioner.BootstrapProvisioner()._run(**kwargs) - + salt._local_minion_id = local_minion if SOURCE_PATH.exists(): self.logger.debug("Cleanup existing storage config on all nodes") cmd_run(f"mv {SOURCE_PATH} {DEST_PATH}") @@ -201,8 +208,9 @@ def run(self, **kwargs): self.logger.debug("Creating service user") create_service_user.CreateServiceUser.run(user="cortxub") + node_id = 'srvnode-1' self.logger.debug("Setting up Cluster ID on the system") - cluster_id.ClusterId().run() + cmd_run('provisioner cluster_id', targets=node_id) self.logger.debug("Encrypting config data") EncryptSecrets().run() @@ -214,7 +222,7 @@ def run(self, **kwargs): # TODO: move this to time.py after encryption issue self.logger.debug("Setting time on node with server & timezone") - node_id = local_minion_id() + # node_id = local_minion_id() NodePrepareTime().set_server_time() machine_id = get_machine_id(node_id) enclosure_id = grains_get("enclosure_id")[node_id]["enclosure_id"] @@ -222,7 +230,7 @@ def run(self, **kwargs): if not machine_id in enclosure_id: # check if the system is VM or HW self.logger.debug(f"Setting time on enclosure with server & timezone") NodePrepareTime().set_enclosure_time() - + StatesApplier.apply( ['components.system.config.sync_salt'] ,targets=ALL_MINIONS) self.logger.debug("Exporting to Confstore") confstore_export.ConfStoreExport().run() diff --git a/lr-cli/cortx_setup/commands/cluster/generate.py b/lr-cli/cortx_setup/commands/cluster/generate.py index 639c6b82a..0453b79f5 100644 --- a/lr-cli/cortx_setup/commands/cluster/generate.py +++ b/lr-cli/cortx_setup/commands/cluster/generate.py @@ -36,7 +36,9 @@ def run(self, targets=ALL_MINIONS): self.logger.debug("Generating cluster pillar") StatesApplier.apply( - ['components.provisioner.config.generate_cluster_pillar'], + ['components.provisioner.config.generate_cluster_pillar', + 'components.system.config.sync_salt' + ], targets=ALL_MINIONS )