clinode 1.0.1 → 1.0.2
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.
- data/lib/clinode/version.rb +1 -1
- data/lib/commands/avail.rb +42 -0
- data/lib/commands/dns.rb +35 -0
- data/lib/commands/echo.rb +7 -0
- data/lib/commands/helpers.rb +12 -0
- data/lib/commands/job.rb +13 -0
- data/lib/commands/nodebalancer.rb +10 -0
- data/lib/commands/stackscript.rb +18 -0
- metadata +8 -3
data/lib/clinode/version.rb
CHANGED
@@ -0,0 +1,42 @@
|
|
1
|
+
command :avail do |args|
|
2
|
+
helper.linode_config
|
3
|
+
ls = helper.linode
|
4
|
+
return if !ls
|
5
|
+
|
6
|
+
params = {}
|
7
|
+
|
8
|
+
case args
|
9
|
+
when "plans"
|
10
|
+
if options.has_key?(:planid)
|
11
|
+
params[:planid] = options[:planid]
|
12
|
+
end
|
13
|
+
puts ls.avail.linodeplans(params)
|
14
|
+
when "datacenters"
|
15
|
+
puts ls.avail.datacenters
|
16
|
+
when "distributions"
|
17
|
+
if options.has_key?(:distributionid)
|
18
|
+
params[:distributionid] = options[:distributionid]
|
19
|
+
end
|
20
|
+
puts ls.avail.distributions(params)
|
21
|
+
when "kernels"
|
22
|
+
if options.has_key?(:kernelid)
|
23
|
+
params[:kernelid] = options[:kernelid]
|
24
|
+
end
|
25
|
+
if options.has_key?(:isxen)
|
26
|
+
params[:isxen] = options[:isxen]
|
27
|
+
end
|
28
|
+
puts ls.avail.kernels(params)
|
29
|
+
when "stackscripts"
|
30
|
+
if options.has_key?(:distributionid)
|
31
|
+
params[:distributionid] = options[:distributionid]
|
32
|
+
end
|
33
|
+
if options.has_key?(:distributionvendor)
|
34
|
+
params[:distributionvendor] = options[:distributionvendor]
|
35
|
+
end
|
36
|
+
if options.has_key?(:keywords)
|
37
|
+
params[:keywords] = options[:keywords]
|
38
|
+
end
|
39
|
+
puts ls.avail.stackscripts(params)
|
40
|
+
end
|
41
|
+
|
42
|
+
end
|
data/lib/commands/dns.rb
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
command :dns do |args|
|
2
|
+
helper.linode_config
|
3
|
+
ls = helper.stackscript_linode
|
4
|
+
return if !ls
|
5
|
+
|
6
|
+
params = {}
|
7
|
+
|
8
|
+
case args
|
9
|
+
when "list"
|
10
|
+
if options.has_key?(:domainid)
|
11
|
+
params[:domainid] = options[:domainid]
|
12
|
+
end
|
13
|
+
puts ls.domain.list(params)
|
14
|
+
end
|
15
|
+
|
16
|
+
end
|
17
|
+
|
18
|
+
command :dns_resource do |args|
|
19
|
+
helper.linode_config
|
20
|
+
ls = helper.stackscript_linode
|
21
|
+
return if !ls
|
22
|
+
|
23
|
+
return if !options.has_key?(:domainid)
|
24
|
+
|
25
|
+
params = {:domainid => options[:domainid]}
|
26
|
+
|
27
|
+
case args
|
28
|
+
when "list"
|
29
|
+
if options.has_key?(:resourceid)
|
30
|
+
params[:resourceid] = options[:resourceid]
|
31
|
+
end
|
32
|
+
puts ls.domain.resource.list(params)
|
33
|
+
end
|
34
|
+
|
35
|
+
end
|
data/lib/commands/helpers.rb
CHANGED
data/lib/commands/job.rb
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
flags :pending => "Only Pending"
|
2
|
+
command :job do |args|
|
3
|
+
ls = helper.get_linode
|
4
|
+
|
5
|
+
params = {:linodeid => args, :pendingonly => options[:pending]}
|
6
|
+
|
7
|
+
if options.has_key?(:jobid)
|
8
|
+
params[:jobid] = options[:jobid]
|
9
|
+
end
|
10
|
+
|
11
|
+
puts ls.job.list(params)
|
12
|
+
|
13
|
+
end
|
data/lib/commands/stackscript.rb
CHANGED
@@ -25,6 +25,18 @@ helper :stackscript_meta_update do |ls,stackscript_id,opts|
|
|
25
25
|
ls.update(params)
|
26
26
|
end
|
27
27
|
|
28
|
+
helper :stackscript_create do |ls,opts|
|
29
|
+
VALID_KEYS = [:label,:ispublic,:rev_note,:description]
|
30
|
+
params = opts.reject{|key,value| !VALID_KEYS.include?(key)}
|
31
|
+
params[:script] = File.read(Clinode.options[:file])
|
32
|
+
ls.create(params)
|
33
|
+
end
|
34
|
+
|
35
|
+
helper :stackscript_delete do |ls,stackscript_id|
|
36
|
+
ls.delete(:stackscriptid => stackscript_id)
|
37
|
+
puts "Stack Script #{stackscript_id} deleted."
|
38
|
+
end
|
39
|
+
|
28
40
|
helper :stackscript_update do |ls,stackscript_id,filename|
|
29
41
|
if File.exists?(filename)
|
30
42
|
script = File.read(filename)
|
@@ -57,6 +69,7 @@ helper :stackscript_process do |ls,stackscript_id|
|
|
57
69
|
end
|
58
70
|
|
59
71
|
desc "List your stackscripts"
|
72
|
+
usage "commands allowed: list, upload, download, create"
|
60
73
|
usage "--dir=<directory> stackscript directory to upload from/download to"
|
61
74
|
usage "--label=<new label>"
|
62
75
|
usage "--ispublic=true/false"
|
@@ -65,6 +78,7 @@ usage "--rev_note=<revision note>"
|
|
65
78
|
flags :output => "Output the content of the stackscript only"
|
66
79
|
flags :update => "Update the content of the stackscript"
|
67
80
|
flags :meta_update => "Update the meta data of the stackscript"
|
81
|
+
flags :delete => "Delete the given stack script"
|
68
82
|
command :stackscript do |arg|
|
69
83
|
helper.linode_config
|
70
84
|
ls = helper.stackscript_linode
|
@@ -79,12 +93,16 @@ command :stackscript do |arg|
|
|
79
93
|
helper.stackscript_upload(ls)
|
80
94
|
when "download"
|
81
95
|
helper.stackscript_download(ls)
|
96
|
+
when "create"
|
97
|
+
helper.stackscript_create(ls,options)
|
82
98
|
when /^\d+$/
|
83
99
|
if options[:update]
|
84
100
|
filename = "#{options[:dir]}/#{arg}_stack.sh"
|
85
101
|
helper.stackscript_update(ls,arg,filename)
|
86
102
|
elsif options[:meta_update]
|
87
103
|
helper.stackscript_meta_update(ls,arg,options)
|
104
|
+
elsif options[:delete]
|
105
|
+
helper.stackscript_delete(ls,arg)
|
88
106
|
else
|
89
107
|
helper.stackscript_process(ls,arg)
|
90
108
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: clinode
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 19
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 1
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 1.0.
|
9
|
+
- 2
|
10
|
+
version: 1.0.2
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Aditya Sanghi
|
@@ -131,7 +131,12 @@ files:
|
|
131
131
|
- lib/clinode/helper.rb
|
132
132
|
- lib/clinode/ui.rb
|
133
133
|
- lib/clinode/version.rb
|
134
|
+
- lib/commands/avail.rb
|
135
|
+
- lib/commands/dns.rb
|
136
|
+
- lib/commands/echo.rb
|
134
137
|
- lib/commands/helpers.rb
|
138
|
+
- lib/commands/job.rb
|
139
|
+
- lib/commands/nodebalancer.rb
|
135
140
|
- lib/commands/stackscript.rb
|
136
141
|
homepage: http://me.adityasanghi.com
|
137
142
|
licenses: []
|