aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCara Salter <cara@devcara.com>2022-06-10 14:29:48 -0400
committerCara Salter <cara@devcara.com>2022-06-10 14:29:48 -0400
commitccf03a25db6c31cf8d8f3b54348004c1ee933f3e (patch)
tree14a3d5abade84bc2e41eae81425b28dd9a1b6dca /src
parent26940cde1e363a5454ef0f06381c85afdd1c85d3 (diff)
downloadsolarlib-ccf03a25db6c31cf8d8f3b54348004c1ee933f3e.tar.gz
solarlib-ccf03a25db6c31cf8d8f3b54348004c1ee933f3e.zip
planet: Fix template for VMs
Still to-do: Automatically add the installation `Ship` to the VM
Diffstat (limited to 'src')
-rw-r--r--src/planet.rs14
-rw-r--r--src/ship.rs3
-rw-r--r--src/star.rs6
3 files changed, 18 insertions, 5 deletions
diff --git a/src/planet.rs b/src/planet.rs
index be81e7e..8775f15 100644
--- a/src/planet.rs
+++ b/src/planet.rs
@@ -296,6 +296,20 @@ impl Planet {
Ok(())
}
+
+ pub fn deathstar(&self) -> Result<(), Error> {
+ let d = match &self.domain {
+ Some(d) => d,
+ None => {
+ return Err(Error::Other(String::from("No domain connection found")));
+ }
+ };
+
+ self.shutdown()?;
+ d.undefine()?;
+
+ Ok(())
+ }
}
#[cfg(test)]
diff --git a/src/ship.rs b/src/ship.rs
index 6466a5f..7b684b3 100644
--- a/src/ship.rs
+++ b/src/ship.rs
@@ -94,6 +94,7 @@ impl Ship {
])
.output()?;
} else {
+ println!("Not remote");
output = Command::new("wget")
.args([
"-O",
@@ -112,7 +113,7 @@ impl Ship {
pub fn make_pretty_name(&self) -> String {
let safe_name = self.name.clone().to_lowercase().replace(" ", "-");
- let file_name = format!("{}-{}-{}.van", safe_name, self.version.clone(), self.shasum.0.clone());
+ let file_name = format!("{}-{}-{}.ship", safe_name, self.version.clone(), self.shasum.0.clone());
file_name
}
diff --git a/src/star.rs b/src/star.rs
index 7d3c21d..75368cd 100644
--- a/src/star.rs
+++ b/src/star.rs
@@ -67,9 +67,9 @@ impl Star {
let c = Connect::open(&url.clone())?;
let remote = if url.contains("qemu:///") || url.contains("localhost") || url.contains("127.0.0.1") {
- true
- } else {
false
+ } else {
+ true
};
// If the connection succeeds, we've got one!
@@ -203,8 +203,6 @@ impl Star {
let buf = String::from_utf8(buf).unwrap();
- println!("{}", buf);
-
let dom: Domain = match &self.con {
Some(c) => {
let dom = Domain::define_xml(&c, &buf)?;