Antilint
This commit is contained in:
parent
dd848d0bf9
commit
5c716db2b6
@ -1,8 +1,10 @@
|
|||||||
from scone.default.utensils.docker_utensils import (
|
from scone.default.utensils.docker_utensils import (
|
||||||
|
ContainerState,
|
||||||
DockerContainerRun,
|
DockerContainerRun,
|
||||||
|
DockerContainerState,
|
||||||
DockerImagePull,
|
DockerImagePull,
|
||||||
DockerNetworkCreate,
|
DockerNetworkCreate,
|
||||||
DockerVolumeCreate, DockerContainerState, ContainerState,
|
DockerVolumeCreate,
|
||||||
)
|
)
|
||||||
from scone.head.kitchen import Kitchen
|
from scone.head.kitchen import Kitchen
|
||||||
from scone.head.recipe import Recipe, RecipeContext
|
from scone.head.recipe import Recipe, RecipeContext
|
||||||
@ -26,7 +28,8 @@ class DockerContainer(Recipe):
|
|||||||
|
|
||||||
if current_state == ContainerState.NOTFOUND:
|
if current_state == ContainerState.NOTFOUND:
|
||||||
await kitchen.ut1areq(
|
await kitchen.ut1areq(
|
||||||
DockerContainerRun(self.image, self.command, self.name), DockerContainerRun.Result
|
DockerContainerRun(self.image, self.command, self.name),
|
||||||
|
DockerContainerRun.Result,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@ -15,7 +15,6 @@
|
|||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with Scone. If not, see <https://www.gnu.org/licenses/>.
|
# along with Scone. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
from scone.default.utensils.basic_utensils import HashFile
|
|
||||||
from scone.head.kitchen import Kitchen
|
from scone.head.kitchen import Kitchen
|
||||||
|
|
||||||
|
|
||||||
|
@ -21,7 +21,9 @@ def _docker_client():
|
|||||||
if not docker:
|
if not docker:
|
||||||
# check docker is actually installed and give a message with the resolution
|
# check docker is actually installed and give a message with the resolution
|
||||||
# when it isn't.
|
# when it isn't.
|
||||||
raise RuntimeError("You need to install docker from PyPI to use these utensils!")
|
raise RuntimeError(
|
||||||
|
"You need to install docker from PyPI to use these utensils!"
|
||||||
|
)
|
||||||
|
|
||||||
global _docker_client_instance
|
global _docker_client_instance
|
||||||
if not _docker_client_instance:
|
if not _docker_client_instance:
|
||||||
@ -48,11 +50,11 @@ class DockerContainerState(Utensil):
|
|||||||
for container in client.containers.list(all=True):
|
for container in client.containers.list(all=True):
|
||||||
container: Container
|
container: Container
|
||||||
if self.name == container.name:
|
if self.name == container.name:
|
||||||
if container.status == 'running':
|
if container.status == "running":
|
||||||
await channel.send(ContainerState.RUNNING)
|
await channel.send(ContainerState.RUNNING)
|
||||||
elif container.status == 'exited':
|
elif container.status == "exited":
|
||||||
await channel.send(ContainerState.EXITED)
|
await channel.send(ContainerState.EXITED)
|
||||||
elif container.status == 'restarting':
|
elif container.status == "restarting":
|
||||||
await channel.send(ContainerState.RESTARTING)
|
await channel.send(ContainerState.RESTARTING)
|
||||||
else:
|
else:
|
||||||
raise ValueError(f"Unknown container status: {container.status}")
|
raise ValueError(f"Unknown container status: {container.status}")
|
||||||
|
Loading…
Reference in New Issue
Block a user