Make docker optional
This commit is contained in:
parent
2f2dbb1902
commit
9c0360e2e8
@ -1,7 +1,11 @@
|
|||||||
from typing import Optional
|
from typing import Optional
|
||||||
|
|
||||||
import attr
|
import attr
|
||||||
import docker.errors
|
|
||||||
|
try:
|
||||||
|
import docker.errors
|
||||||
|
except ImportError:
|
||||||
|
docker = None
|
||||||
|
|
||||||
from scone.common.chanpro import Channel
|
from scone.common.chanpro import Channel
|
||||||
from scone.sous import Utensil
|
from scone.sous import Utensil
|
||||||
@ -67,7 +71,7 @@ class DockerImagePull(Utensil):
|
|||||||
@attr.s(auto_attribs=True)
|
@attr.s(auto_attribs=True)
|
||||||
class DockerVolumeCreate(Utensil):
|
class DockerVolumeCreate(Utensil):
|
||||||
name: str
|
name: str
|
||||||
|
|
||||||
@attr.s(auto_attribs=True)
|
@attr.s(auto_attribs=True)
|
||||||
class Result:
|
class Result:
|
||||||
name: str
|
name: str
|
||||||
@ -79,7 +83,7 @@ class DockerVolumeCreate(Utensil):
|
|||||||
# the docker server returned an error
|
# the docker server returned an error
|
||||||
await channel.send(None)
|
await channel.send(None)
|
||||||
return
|
return
|
||||||
|
|
||||||
await channel.send(DockerVolumeCreate.Result(name=volume.name))
|
await channel.send(DockerVolumeCreate.Result(name=volume.name))
|
||||||
|
|
||||||
|
|
||||||
@ -91,7 +95,7 @@ class DockerNetworkCreate(Utensil):
|
|||||||
enable_ipv6: Optional[bool]
|
enable_ipv6: Optional[bool]
|
||||||
attachable: Optional[bool]
|
attachable: Optional[bool]
|
||||||
ingress: Optional[bool]
|
ingress: Optional[bool]
|
||||||
|
|
||||||
@attr.s(auto_attribs=True)
|
@attr.s(auto_attribs=True)
|
||||||
class Result:
|
class Result:
|
||||||
name: str
|
name: str
|
||||||
@ -110,5 +114,5 @@ class DockerNetworkCreate(Utensil):
|
|||||||
# the docker server returned an error
|
# the docker server returned an error
|
||||||
await channel.send(None)
|
await channel.send(None)
|
||||||
return
|
return
|
||||||
|
|
||||||
await channel.send(DockerContainerRun.Result(name=network.name))
|
await channel.send(DockerContainerRun.Result(name=network.name))
|
||||||
|
4
setup.py
4
setup.py
@ -53,7 +53,9 @@ EXTRAS = {
|
|||||||
],
|
],
|
||||||
"sous": EX_SOUS_ALL,
|
"sous": EX_SOUS_ALL,
|
||||||
"sous-core": EX_SOUS_BASE,
|
"sous-core": EX_SOUS_BASE,
|
||||||
"sous-pg": EX_SOUS_PG
|
"sous-pg": EX_SOUS_PG,
|
||||||
|
|
||||||
|
"docker": ["docker"] # TODO do this more properly if we can...
|
||||||
}
|
}
|
||||||
|
|
||||||
# The rest you shouldn't have to touch too much :)
|
# The rest you shouldn't have to touch too much :)
|
||||||
|
Loading…
Reference in New Issue
Block a user