triton-ops 0.18.4.pre → 0.18.6.pre
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- metadata +2 -2
- data/tests/exercise +0 -70
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 71ebba1a3fed80be5162324714511bb3c03a274289efbc012bb78db08e8ea2ff
|
4
|
+
data.tar.gz: 2e6b04ff9ddf95cf815fdafdd89219dc3e3ef14b985d1d58a8d4ae1f6c38bd75
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5955846f6a6d8ef9cf7e9fdc5f4a0fb88079124a7ce8539376792c4f7b837b8fa29411d168b2b6137083f22c517ebd33251dfad46b176d0f4b05ec881398fc48
|
7
|
+
data.tar.gz: ae284fa7c98b48dc5449f0377d9efe77f85be57c0c236ab0131d9cc70a2c1e17d6117ffa16d0d193708d6db8535e8c5223e83c6c50fa2548cb92f63009a9fa00
|
data/.gitignore
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
*.gem
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: triton-ops
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.18.
|
4
|
+
version: 0.18.6.pre
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris Olstrom
|
@@ -138,6 +138,7 @@ executables:
|
|
138
138
|
extensions: []
|
139
139
|
extra_rdoc_files: []
|
140
140
|
files:
|
141
|
+
- ".gitignore"
|
141
142
|
- Gemfile
|
142
143
|
- LICENSE.txt
|
143
144
|
- README.org
|
@@ -162,7 +163,6 @@ files:
|
|
162
163
|
- lib/triton-ops/support/feature/hash_from_initialization_contract.rb
|
163
164
|
- lib/triton-ops/support/type_coercion.rb
|
164
165
|
- lib/triton-ops/support/types.rb
|
165
|
-
- tests/exercise
|
166
166
|
- tests/run
|
167
167
|
- triton-ops.gemspec
|
168
168
|
homepage: https://github.com/colstrom/triton-ops
|
data/tests/exercise
DELETED
@@ -1,70 +0,0 @@
|
|
1
|
-
#! /usr/bin/env ruby
|
2
|
-
# -*- ruby -*-
|
3
|
-
|
4
|
-
require_relative '../lib/triton-ops/snapshot/explorer'
|
5
|
-
|
6
|
-
#############
|
7
|
-
# Constants #
|
8
|
-
#############
|
9
|
-
|
10
|
-
SUCCESS = 0
|
11
|
-
|
12
|
-
########################
|
13
|
-
# Environment Handling #
|
14
|
-
########################
|
15
|
-
|
16
|
-
feature = {
|
17
|
-
interactive: ENV.fetch('INTERACTIVE') { STDIN.tty? } != 'false',
|
18
|
-
namespace: ENV.fetch('NAMESPACE') { '' },
|
19
|
-
}
|
20
|
-
|
21
|
-
#####################
|
22
|
-
# Argument Handling #
|
23
|
-
#####################
|
24
|
-
|
25
|
-
begin
|
26
|
-
interactive = ::TritonOps::Snapshot::Explorer.new namespace: feature[:namespace]
|
27
|
-
headnode = ARGV.shift || (interactive.headnode if feature[:interactive])
|
28
|
-
timestamp = ARGV.shift || (interactive.snapshot headnode if feature[:interactive])
|
29
|
-
rescue Interrupt, TTY::Reader::InputInterrupt
|
30
|
-
exit Errno::EINTR::Errno
|
31
|
-
end
|
32
|
-
|
33
|
-
#################
|
34
|
-
# Sanity Checks #
|
35
|
-
#################
|
36
|
-
|
37
|
-
exit Errno::EINVAL::Errno if [headnode, timestamp].any?(&:nil?)
|
38
|
-
|
39
|
-
################
|
40
|
-
# Main Program #
|
41
|
-
################
|
42
|
-
|
43
|
-
# Where possible, the library provides Contracts for public interfaces. If a
|
44
|
-
# suitable Contract cannot be provided, then devising a sensible test is likely
|
45
|
-
# difficult.
|
46
|
-
|
47
|
-
# First, we begin with a Snapshot:
|
48
|
-
|
49
|
-
SNAPSHOT = TritonOps::Snapshot.new headnode, timestamp
|
50
|
-
|
51
|
-
# Then, for each major property of the snapshot, we convert each instance of a
|
52
|
-
# given type into a Hash, which implicitly validates all return Contracts.
|
53
|
-
#
|
54
|
-
# Each Hash is then used to instantiate a new Object of the original type,
|
55
|
-
# implicitly validating the initialization Contract.
|
56
|
-
|
57
|
-
SNAPSHOT.images.map(&:to_h).map { |image| ::TritonOps::Resource::Image.new image }
|
58
|
-
SNAPSHOT.platforms.map(&:to_h).map { |platform| ::TritonOps::Resource::Platform.new platform }
|
59
|
-
SNAPSHOT.servers.map(&:to_h).map { |server| ::TritonOps::Resource::Server.new server }
|
60
|
-
SNAPSHOT.users.map(&:to_h).map { |user| ::TritonOps::Resource::User.new user }
|
61
|
-
SNAPSHOT.vms.map(&:to_h).map { |vm| ::TritonOps::Resource::VirtualMachine.new vm }
|
62
|
-
|
63
|
-
# In a few cases, retrieval is slightly difference, but the concept is the same.
|
64
|
-
|
65
|
-
SNAPSHOT.vms.flat_map(&:disks).map(&:to_h).map { |disk| ::TritonOps::Resource::VirtualMachine::Disk.new disk }
|
66
|
-
SNAPSHOT.vms.flat_map(&:nics).map(&:to_h).map { |nic| ::TritonOps::Resource::VirtualMachine::NetworkInterface.new nic }
|
67
|
-
|
68
|
-
# If we've made it this far, all Contracts have passed.
|
69
|
-
|
70
|
-
exit SUCCESS
|