Class: OsCtl::Cli::Send
Instance Method Summary
collapse
#format_str, #json_progress, #terminal_progress, #with_progress
Methods inherited from Command
#cli_opt, #format_output, #osctld_call, #osctld_fmt, #osctld_open, #osctld_resp, run
Instance Method Details
#cancel ⇒ Object
109
110
111
112
113
114
115
116
117
118
119
|
# File 'lib/osctl/cli/send.rb', line 109
def cancel
require_args!('id')
with_progress(
:ct_send_cancel,
pool: gopts[:pool],
id: args[0],
force: opts[:force],
local: opts[:local]
)
end
|
#cleanup ⇒ Object
99
100
101
102
103
104
105
106
107
|
# File 'lib/osctl/cli/send.rb', line 99
def cleanup
require_args!('id')
with_progress(
:ct_send_cleanup,
pool: gopts[:pool],
id: args[0]
)
end
|
#config ⇒ Object
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
|
# File 'lib/osctl/cli/send.rb', line 44
def config
require_args!('id', 'dst')
with_progress(
:ct_send_config,
pool: gopts[:pool],
id: args[0],
dst: args[1],
port: opts[:port],
passphrase: opts[:passphrase],
as_id: opts['as-id'],
as_user: opts['as-user'],
as_group: opts['as-group'],
to_pool: opts['to-pool'],
network_interfaces: opts['network-interfaces'],
snapshots: opts[:snapshots],
from_snapshot: opts['from-snapshot'],
preexisting_datasets: opts['preexisting-datasets']
)
end
|
#key_gen ⇒ Object
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
# File 'lib/osctl/cli/send.rb', line 8
def key_gen
c = osctld_open
unless opts[:force]
ret = c.cmd_data!(:send_key_path, pool: gopts[:pool])
%i[public_key private_key].each do |v|
if File.exist?(ret[v])
raise "File #{ret[v]} already exists, use -f, --force to overwrite"
end
end
end
c.cmd_data!(
:send_key_gen,
pool: gopts[:pool],
type: opts[:type],
bits: opts[:bits]
)
end
|
#key_path ⇒ Object
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
# File 'lib/osctl/cli/send.rb', line 29
def key_path
if args[0] && !%w[public private].include?(args[0])
raise GLI::BadCommandLine, "expected public/private, got '#{args[0]}'"
end
ret = osctld_call(:send_key_path, pool: gopts[:pool])
if !args[0] || args[0] == 'public'
puts ret[:public_key]
else
puts ret[:private_key]
end
end
|
#now ⇒ Object
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
|
# File 'lib/osctl/cli/send.rb', line 121
def now
require_args!('id', 'dst')
with_progress(
:ct_send_now,
pool: gopts[:pool],
id: args[0],
dst: args[1],
port: opts[:port],
passphrase: opts[:passphrase],
as_id: opts['as-id'],
as_user: opts['as-user'],
as_group: opts['as-group'],
to_pool: opts['to-pool'],
clone: opts[:clone],
consistent: opts[:consistent],
restart: opts[:restart],
start: opts[:start],
network_interfaces: opts['network-interfaces'],
snapshots: opts[:snapshots],
from_snapshot: opts['from-snapshot'],
preexisting_datasets: opts['preexisting-datasets']
)
end
|
#rootfs ⇒ Object
65
66
67
68
69
70
71
72
73
|
# File 'lib/osctl/cli/send.rb', line 65
def rootfs
require_args!('id')
with_progress(
:ct_send_rootfs,
pool: gopts[:pool],
id: args[0]
)
end
|
#state ⇒ Object
85
86
87
88
89
90
91
92
93
94
95
96
97
|
# File 'lib/osctl/cli/send.rb', line 85
def state
require_args!('id')
with_progress(
:ct_send_state,
pool: gopts[:pool],
id: args[0],
clone: opts[:clone],
consistent: opts[:consistent],
restart: opts[:restart],
start: opts[:start]
)
end
|
#sync ⇒ Object
75
76
77
78
79
80
81
82
83
|
# File 'lib/osctl/cli/send.rb', line 75
def sync
require_args!('id')
with_progress(
:ct_send_sync,
pool: gopts[:pool],
id: args[0]
)
end
|