| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 6779616 commit 9c19e06
4 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -34,3 +34,7 @@ Delete an environment for a project:: | |||
| 34 | 34 | environment = project.environments.delete(environment_id) | |
| 35 | 35 | # or | |
| 36 | 36 | environment.delete() | |
| 37 | + | ||
| 38 | + Stop an environments:: | ||
| 39 | + | ||
| 40 | + environment.stop() | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -201,6 +201,10 @@ class GitlabSearchError(GitlabOperationError): | |||
| 201 | 201 | pass | |
| 202 | 202 | ||
| 203 | 203 | ||
| 204 | + class GitlabStopError(GitlabOperationError): | ||
| 205 | + pass | ||
| 206 | + | ||
| 207 | + | ||
| 204 | 208 | def on_http_error(error): | |
| 205 | 209 | """Manage GitlabHttpError exceptions. | |
| 206 | 210 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1278,7 +1278,20 @@ class ProjectCommitManager(RetrieveMixin, CreateMixin, RESTManager): | |||
| 1278 | 1278 | ||
| 1279 | 1279 | ||
| 1280 | 1280 | class ProjectEnvironment(SaveMixin, ObjectDeleteMixin, RESTObject): | |
| 1281 | - pass | ||
| 1281 | + @cli.register_custom_action('ProjectEnvironment') | ||
| 1282 | + @exc.on_http_error(exc.GitlabStopError) | ||
| 1283 | + def stop(self, **kwargs): | ||
| 1284 | + """Stop the environment. | ||
| 1285 | + | ||
| 1286 | + Args: | ||
| 1287 | + **kwargs: Extra options to send to the server (e.g. sudo) | ||
| 1288 | + | ||
| 1289 | + Raises: | ||
| 1290 | + GitlabAuthenticationError: If authentication is not correct | ||
| 1291 | + GitlabStopError: If the operation failed | ||
| 1292 | + """ | ||
| 1293 | + path = '%s/%s/stop' % (self.manager.path, self.get_id()) | ||
| 1294 | + self.manager.gitlab.http_post(path, **kwargs) | ||
| 1282 | 1295 | ||
| 1283 | 1296 | ||
| 1284 | 1297 | class ProjectEnvironmentManager(ListMixin, CreateMixin, UpdateMixin, | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -432,6 +432,7 @@ | |||
| 432 | 432 | env.save() | |
| 433 | 433 | env = admin_project.environments.list()[0] | |
| 434 | 434 | assert(env.external_url == 'http://new.env/whatever') | |
| 435 | + env.stop() | ||
| 435 | 436 | env.delete() | |
| 436 | 437 | assert(len(admin_project.environments.list()) == 0) | |
| 437 | 438 | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments