Skip to content
This repository has been archived by the owner on Feb 3, 2023. It is now read-only.

Instantiate instance when adding through admin interface #1067

Merged
merged 37 commits into from
Mar 17, 2019
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
a0f4341
Start instance when adding through admin interface
maackle Feb 28, 2019
2c92d8f
Instantiate new instance when adding
maackle Feb 28, 2019
24510c6
Merge branch 'develop' into auto-start-instance
zippy Mar 1, 2019
9ad07fc
Merge branch 'develop' into auto-start-instance
zippy Mar 1, 2019
792e2b5
Merge branch 'develop' into auto-start-instance
zippy Mar 1, 2019
a5251a2
Merge branch 'develop' into auto-start-instance
Mar 1, 2019
0876202
Add extra integrity check
maackle Mar 2, 2019
8b28b9f
Use JSON content-type for wormhole request
maackle Mar 2, 2019
45e3d5c
More thorough duplicate ID check
maackle Mar 3, 2019
824793c
Merge remote-tracking branch 'origin/develop' into auto-start-instance
maackle Mar 6, 2019
0df19bd
Merge branch 'develop' into auto-start-instance
maackle Mar 7, 2019
d4af81b
Merge branch 'agent-state-snapshot-option' into auto-start-instance
maackle Mar 7, 2019
762b76d
Merge remote-tracking branch 'origin/develop' into auto-start-instance
maackle Mar 7, 2019
9129e54
AgentStateSnapshot::try_from -> ::from
maackle Mar 8, 2019
529db4a
Merge branch 'agent-state-snapshot-option' into auto-start-instance
maackle Mar 8, 2019
6900808
Better error
maackle Mar 8, 2019
a6c70f3
Add sleep as last resort
maackle Mar 8, 2019
6949787
Merge branch 'develop' into auto-start-instance
Mar 12, 2019
bda4519
In get_entry_with_meta, treat entry without CRUD status as non-existant
lucksus Mar 12, 2019
490c30f
Merge remote-tracking branch 'origin/auto-start-instance' into auto-s…
lucksus Mar 12, 2019
7a4e2f9
Merge branch 'develop' into auto-start-instance
Mar 12, 2019
3aa542d
rustfmt
lucksus Mar 12, 2019
b424f59
Make instance name unique in conductor test
lucksus Mar 12, 2019
e5eb26c
Remove unnecessary sleep in test
lucksus Mar 12, 2019
f5658a2
Merge branch 'develop' into auto-start-instance
zippy Mar 13, 2019
d14190a
Remove unnecessary sleep in test
lucksus Mar 13, 2019
54fc544
Make sure storage directory is clean in failing test
lucksus Mar 13, 2019
3149a10
Merge remote-tracking branch 'origin/auto-start-instance' into auto-s…
lucksus Mar 13, 2019
1557c21
Merge branch 'develop' into auto-start-instance
Mar 13, 2019
137feee
Make sure storage directory is clean in failing test
lucksus Mar 13, 2019
722f94a
Ignore errors when cleaning test storage
lucksus Mar 13, 2019
6e38f0c
Make test_add_instance_to_interface match test_add_instance by adding…
lucksus Mar 13, 2019
81dfb09
Testing to see if not starting interfaces fixes failing windows test
lucksus Mar 13, 2019
8b7ca6a
skip problem test on windows
willemolding Mar 14, 2019
55dbecf
Merge branch 'develop' into auto-start-instance
Connoropolous Mar 14, 2019
bb05e5a
Update admin.rs
willemolding Mar 16, 2019
3625b86
Merge branch 'develop' into auto-start-instance
thedavidmeister Mar 17, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions conductor_api/src/conductor/admin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,11 @@ use crate::{
};
use holochain_core_types::{cas::content::AddressableContent, error::HolochainError};
use json_patch;
use std::{fs, path::PathBuf, sync::Arc};
use std::{
fs,
path::PathBuf,
sync::{Arc, RwLock},
};

pub trait ConductorAdmin {
fn install_dna_from_file(
willemolding marked this conversation as resolved.
Show resolved Hide resolved
Expand Down Expand Up @@ -164,7 +168,7 @@ impl ConductorAdmin for Conductor {
let mut new_config = self.config.clone();
let storage_path = self.instance_storage_dir_path().join(id.clone());
fs::create_dir_all(&storage_path)?;
let new_instance = InstanceConfiguration {
let new_instance_config = InstanceConfiguration {
id: id.to_string(),
dna: dna_id.to_string(),
agent: agent_id.to_string(),
Expand All @@ -177,8 +181,11 @@ impl ConductorAdmin for Conductor {
.into(),
},
};
new_config.instances.push(new_instance);
new_config.instances.push(new_instance_config);
new_config.check_consistency()?;
let instance = self.instantiate_from_config(id, &new_config, None)?;
self.instances
.insert(id.clone(), Arc::new(RwLock::new(instance)));
self.config = new_config;
self.save_config()?;
Ok(())
Expand Down
6 changes: 6 additions & 0 deletions conductor_api/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,12 @@ impl From<HolochainError> for HolochainInstanceError {
}
}

impl From<HolochainInstanceError> for HolochainError {
fn from(error: HolochainInstanceError) -> Self {
HolochainError::new(&error.to_string())
}
}

impl From<NoneError> for HolochainInstanceError {
fn from(_: NoneError) -> Self {
HolochainInstanceError::NoSuchInstance
Expand Down