Implement image configuration in bollard layer
This commit is contained in:
@@ -4,6 +4,7 @@ use crate::deploy;
|
||||
use crate::deploy::container::Container;
|
||||
use crate::database::exposer::MemStorage;
|
||||
use crate::database::instance::Instance;
|
||||
use crate::deploy::container_options::Options;
|
||||
use std::sync::Mutex;
|
||||
use log::error;
|
||||
|
||||
@@ -26,7 +27,7 @@ impl Controller {
|
||||
Ok(cont)
|
||||
}
|
||||
|
||||
pub async fn create_container(&self, domain: String, ip: String, image: String) -> String {
|
||||
pub async fn create_container(&self, domain: String, ip: String, image: String, ops: Options) -> String {
|
||||
let is_stored = self.storage.lock().unwrap().search_instance(domain.clone());
|
||||
match is_stored {
|
||||
Some(c) => match c.docker_id {
|
||||
@@ -34,7 +35,7 @@ impl Controller {
|
||||
None => "Container without docker_id".to_string()
|
||||
},
|
||||
None => {
|
||||
match self.load_container(None,domain.clone(),ip.clone(),image.clone()).await {
|
||||
match self.load_container(None,domain.clone(),ip.clone(),image.clone(),ops).await {
|
||||
Ok(c) => {
|
||||
log::debug!("poisoned: {}",self.storage.is_poisoned());
|
||||
self.storage.try_lock().unwrap().new_instance(c.clone()).unwrap();
|
||||
@@ -58,7 +59,8 @@ impl Controller {
|
||||
Some(instance.docker_id.clone()),
|
||||
instance.domain.clone(),
|
||||
instance.ip.clone(),
|
||||
image).await {
|
||||
image,
|
||||
Options::new(None, None)).await {
|
||||
Ok(c) => {
|
||||
self.storage.lock().unwrap().loaded_instance(instance, c);
|
||||
},
|
||||
@@ -69,7 +71,8 @@ impl Controller {
|
||||
async fn load_container(&self, docker_id: Option<String>,
|
||||
domain: String,
|
||||
ip: String,
|
||||
image: String) -> Result<deploy::container::Container,
|
||||
image: String,
|
||||
ops: Options) -> Result<deploy::container::Container,
|
||||
bollard::errors::Error>
|
||||
{
|
||||
deploy::container::Container::new(self.driver.clone(),
|
||||
@@ -77,7 +80,8 @@ impl Controller {
|
||||
domain,
|
||||
ip,
|
||||
image,
|
||||
self.network.clone()).await
|
||||
self.network.clone(),
|
||||
ops).await
|
||||
}
|
||||
|
||||
pub async fn is_started(&self) -> bool {
|
||||
@@ -141,3 +145,4 @@ impl Controller {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user