@@ -100,13 +100,14 @@ def sync_with_appwrite_config(
100
100
model = AppwriteSyncProject (sync_type ),
101
101
args = addn_args ,
102
102
)
103
+ key_name = f"{ proj_name } -key"
103
104
key = self .create_api_key (
104
- lab = lab , expiration = expiration , project_name = proj_name
105
+ lab = lab , expiration = expiration , project_name = proj_name , key_name = key_name
105
106
)
106
107
lab .projects [proj_name ] = Project (
107
108
project_id = proj_id ,
108
109
project_name = proj_name ,
109
- api_key = key ,
110
+ api_key = key . data ,
110
111
)
111
112
labs = self .state .get ("labs" )
112
113
labs [name ] = lab .to_dict ()
@@ -115,6 +116,7 @@ def sync_with_appwrite_config(
115
116
def create_api_key (
116
117
self ,
117
118
project_name : str ,
119
+ key_name : str ,
118
120
expiration : Expiration = "30 days" ,
119
121
lab_name : str | None = None ,
120
122
lab : Lab | None = None ,
@@ -135,7 +137,7 @@ def create_api_key(
135
137
automation = Automation .CREATE_API_KEY ,
136
138
model = AppwriteAPIKeyCreation (
137
139
project_name = project_name ,
138
- key_name = project_name ,
140
+ key_name = key_name ,
139
141
key_expiry = str (expiration .value ),
140
142
),
141
143
print_data = True ,
@@ -144,9 +146,11 @@ def create_api_key(
144
146
return Response (
145
147
message = f"Failed to create API key: { api_key .message } " , error = True
146
148
)
147
- # create another Response to print key
148
- # return Response(message=api_key.data, data=api_key.data)
149
- return api_key
149
+ return Response (
150
+ message = f"API key created for { project_name } " ,
151
+ data = api_key .data ,
152
+ _print_data = True ,
153
+ )
150
154
151
155
def stop (self , name : str ):
152
156
return self .orchestrator .teardown_service (name )
@@ -177,8 +181,9 @@ def create_project(
177
181
project_name = project_name ,
178
182
project_id = project_id ,
179
183
)
180
- self .orchestrator .deploy_playwright_automation (
184
+ return self .orchestrator .deploy_playwright_automation (
181
185
lab = lab ,
182
186
automation = Automation .CREATE_PROJECT ,
187
+ project = Project (project_id = project_id , project_name = project_name ),
183
188
model = apc ,
184
189
)
0 commit comments