Incorrect recovery password for 3Bot name {self.name}
"
+ self.password = self.secret_ask(error, required=True, max_length=32, md=True)
+
+ def _ask_for_continent(self):
+ self.continent = self.drop_down_choice(
+ "Please select the continent you would like to deploy your 3Bot in.",
+ list(self.farms_by_continent.keys()),
+ required=True,
+ )
+ self.available_farms = self.farms_by_continent[self.continent]
+ self.selected_node = None
+
+ def _ask_for_farm(self):
+ farm_name_dict = {farm.name: farm for farm in self.available_farms}
+ farm_name = self.drop_down_choice(
+ "Please select the farm you would like to deploy your 3Bot in.", list(farm_name_dict.keys()), required=True
+ )
+ self.available_farms = [farm_name_dict[farm_name]]
+ self.selected_node = None
+
+ def _ask_for_node(self):
+ nodes = deployer.get_all_farms_nodes(self.available_farms, **self.query)
+ node_id_dict = {node.node_id: node for node in nodes}
+ node_id = self.drop_down_choice(
+ "Please select the node you would like to deploy your 3Bot on.", list(node_id_dict.keys()), required=True
+ )
+ self.selected_node = node_id_dict[node_id]
+ self.available_farms = [farm for farm in self.available_farms if farm.id == self.selected_node.farm_id]
+
+ @chatflow_step("Reserving a new pool")
+ def create_pool(self):
+ owner = self.threebot_name
+ threebot = get_threebot_config_instance(owner, self.threebot_info["solution_uuid"])
+ zos = get_threebot_zos(threebot)
+ identity = generate_user_identity(threebot, self.password, zos)
+ zos = j.sals.zos.get(identity.instance_name)
+ farm = random.choice(self.available_farms)
+ farm_name = farm.name
+ self.pool_info = deployer.create_3bot_pool(
+ farm_name, self.expiration, currency=self.currency, identity_name=identity.instance_name, **self.query,
+ )
+ if self.pool_info.escrow_information.address.strip() == "":
+ raise StopChatFlow(
+ f"provisioning the pool, invalid escrow information probably caused by a misconfigured, pool creation request was {self.pool_info}"
+ )
+ msg, qr_code = deployer.get_qr_code_payment_info(self.pool_info)
+ deployer.msg_payment_info = msg
+ result = deployer.wait_pool_payment(self, self.pool_info.reservation_id, qr_code=qr_code)
+ if not result:
+ raise StopChatFlow(f"provisioning the pool timed out. pool_id: {self.pool_info.reservation_id}")
+ self.pool_id = self.pool_info.reservation_id
+
+ @chatflow_step(title="Deployment location policy")
+ def choose_location(self):
+ self._get_available_farms()
+ self.farms_by_continent = deployer.group_farms_by_continent(self.available_farms)
+ choices = ["Automatic", "Farm", "Specific node"]
+ if self.farms_by_continent:
+ choices.insert(1, "Continent")
+ self.node_policy = self.single_choice(
+ "Please select the deployment location policy.", choices, required=True, default="Automatic"
+ )
+
+ @chatflow_step(title="Deployment location")
+ def choose_deployment_location(self):
+ if self.node_policy == "Continent":
+ self._ask_for_continent()
+ elif self.node_policy == "Farm":
+ self._ask_for_farm()
+ elif self.node_policy == "Specific node":
+ self._ask_for_node()
+
+ @chatflow_step(title="Deploying", disable_previous=True)
+ def deploy(self):
+ self.md_show_update("Starting your 3Bot...")
+ node_id = self.selected_node.node_id if self.selected_node else None
+ redeploy_threebot_solution(
+ self.username,
+ self.threebot_info["solution_uuid"],
+ self.password,
+ compute_pool_id=self.pool_id,
+ node_id=node_id,
+ solution_info={"flist": self.FLIST_URL, "branch": self.branch},
+ )
+
+ @chatflow_step(title="Initializing", disable_previous=True)
+ def initializing(self):
+ self.md_show_update("Initializing your 3Bot ...")
+ self.domain = self.threebot_info["domain"]
+ self.threebot_url = f"https://{self.domain}/admin"
+ if not j.sals.reservation_chatflow.wait_http_test(
+ self.threebot_url, timeout=600, verify=not j.config.get("TEST_CERT")
+ ):
+ self.stop(f"Failed to initialize 3Bot on {self.threebot_url} , please contact support")
+ self.domain = f"{self.domain}/admin"
+
+ @chatflow_step(title="Success", disable_previous=True, final_step=True)
+ def success(self):
+ display_name = self.threebot_info["name"]
+ message = f"""\
+ # Your 3Bot instance {display_name} has started
+ Incorrect recovery password for 3Bot name {self.name}
"
+ self.password = self.secret_ask(error, required=True, max_length=32, md=True)
+
+ @chatflow_step(title="Deploying", disable_previous=True)
+ def deploy(self):
+ self.md_show_update("Starting your 3Bot...")
+ solution_info = {
+ "cpu": self.cpu,
+ "memory": self.memory,
+ "disk_size": self.disk_size,
+ "flist": self.FLIST_URL,
+ "branch": self.branch,
+ }
+ redeploy_threebot_solution(
+ self.username, self.threebot_info["solution_uuid"], self.password, solution_info=solution_info
+ )
+
+ @chatflow_step(title="Initializing", disable_previous=True)
+ def initializing(self):
+ self.md_show_update("Initializing your 3Bot ...")
+ self.domain = self.threebot_info["domain"]
+ self.threebot_url = f"https://{self.domain}/admin"
+ if not j.sals.reservation_chatflow.wait_http_test(
+ self.threebot_url, timeout=600, verify=not j.config.get("TEST_CERT")
+ ):
+ self.stop(f"Failed to initialize 3Bot on {self.threebot_url} , please contact support")
+ self.domain = f"{self.domain}/admin"
+
+ @chatflow_step(title="Success", disable_previous=True, final_step=True)
+ def success(self):
+ display_name = self.threebot_info["name"]
+ message = f"""\
+ # Your 3Bot instance {display_name} has started
+ Incorrect recovery password for 3Bot name {self.name}
"
+ self.password = self.secret_ask(error, required=True, max_length=32, md=True)
+
+ @chatflow_step(title="Deploying", disable_previous=True)
+ def deploy(self):
+ self.md_show_update("Starting your 3Bot...")
+ redeploy_threebot_solution(
+ self.username,
+ self.threebot_info["solution_uuid"],
+ self.password,
+ solution_info={"flist": self.FLIST_URL, "branch": self.branch},
+ )
+
+ @chatflow_step(title="Initializing", disable_previous=True)
+ def initializing(self):
+ self.md_show_update("Initializing your 3Bot ...")
+ self.domain = self.threebot_info["domain"]
+ self.threebot_url = f"https://{self.domain}/admin"
+ if not j.sals.reservation_chatflow.wait_http_test(
+ self.threebot_url, timeout=600, verify=not j.config.get("TEST_CERT")
+ ):
+ self.stop(f"Failed to initialize 3Bot on {self.threebot_url} , please contact support")
+ self.domain = f"{self.domain}/admin"
+
+ @chatflow_step(title="Success", disable_previous=True, final_step=True)
+ def success(self):
+ display_name = self.threebot_info["name"]
+ message = f"""\
+ # Your 3Bot instance {display_name} has started
+ Incorrect recovery password for 3Bot name {self.solution_name}
"
self.backup_password = self.secret_ask(error, required=True, max_length=32, md=True)
@@ -144,121 +294,146 @@ def payment_currency(self):
required=True,
)
- @deployment_context()
def _deploy(self):
- # 1- add node to network
- metadata = {"form_info": {"Solution name": self.solution_name, "chatflow": "threebot"}}
- self.solution_metadata.update(metadata)
- self.workload_ids = []
- deploying_message = f"""\
- # Deploying your 3Bot...\n\n
-