junos-ez-stdlib 0.0.16 → 0.0.17

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -78,7 +78,7 @@ puts "OK!"
78
78
  Junos::Ez::Provider( ndev )
79
79
  Junos::Ez::L1ports::Provider( ndev, :l1_ports )
80
80
  Junos::Ez::IPports::Provider( ndev, :ip_ports )
81
- Junoz::Ez::Config::Utils( ndev, :cu )
81
+ Junos::Ez::Config::Utils( ndev, :cu )
82
82
 
83
83
  # -----------------------------------------------------------
84
84
  # Facts ...
data/docs/Utils/Config.md CHANGED
@@ -1,8 +1,17 @@
1
- # Junos::Ez::Config::Utils
1
+ # `Junos::Ez::Config::Utils`
2
2
 
3
- A collection of methods to perform file / template based configuration, and configuration control functions, like "commit", "show | compare", "rollback", etc.
3
+ A collection of methods to perform file / template based configuration, and configuration control functions, like "commit", "show | compare", "rollback", etc. These methods return data in Hash / Array structures so the information can be programmatically accessible.
4
4
 
5
- These methods return data in Hash / Array structures so the information can be programmatically accessible, rather than scraping CLI or navigating Junos XML.
5
+ # METHODS
6
+
7
+ - [`lock!`](#lock) - attempt exclusive config, returns true or raises Netconf::LockError
8
+ - [`load!`](#load) - loads configuration snippets or templates (ERB)
9
+ - [`diff?`](#diff) - returns String of "show | compare" as String
10
+ - [`commit?`](#commit_check) - checks the candidate config for validation, returns true or Hash of errors
11
+ - [`commit!`](#commit) - performs commit, returns true or raises Netconf::CommitError
12
+ - [`unlock!`](#unlock) - releases exclusive lock on config
13
+ - [`rollback!`](#rollback) - performs rollback of config
14
+ - [`get_config`](#get_config) - returns text-format of configuration
6
15
 
7
16
  # USAGE
8
17
 
@@ -31,29 +40,19 @@ ndev.cu.commit!
31
40
  ndev.close
32
41
  ```
33
42
 
34
- # METHODS
35
43
 
36
- - `lock!` - attempt exclusive config, returns true or raises Netconf::LockError
37
- - `load!` - loads configuration snippets or templates (ERB)
38
- - `diff?` - returns String of "show | compare" as String
39
- - `commit?` - checks the candidate config for validation, returns true or Hash of errors
40
- - `commit!` - performs commit, returns true or raises Netconf::CommitError
41
- - `unlock!` - releases exclusive lock on config
42
- - `rollback!` - performs rollback of config
43
- - `get_config` - returns text-format of configuration
44
44
 
45
45
  # GORY DETAILS
46
46
 
47
- ## lock!
47
+ ## lock! <a name="lock">
48
48
  Attempt exclusive config, returns `true` if you now have the lock, or raises `Netconf::LockError` exception if the lock is not available
49
49
 
50
- ## load!( opts = {} )
50
+ ## load!( opts = {} ) <a name="load">
51
51
 
52
52
  Loads configuration snippets or templates (ERB). This method does **not** commit the change, only loads the contents into the candidate configuration. If the load was successful, this method will return `true`. Otherwise it will raise a `Netconf::EditError` exception.
53
53
 
54
54
  The options Hash enables the following controls:
55
55
 
56
-
57
56
  ```
58
57
  :filename => String
59
58
  ```
@@ -95,10 +94,10 @@ When `true` the provided configuraiton will **COMPLETELY OVERWRITE** any existin
95
94
  ```
96
95
  When `true` enables the Junos *replace* option. This is required if your configuration changes utilize either the `replace:` statement in text-format style or the `replace="replace"` attribute in XML-format style. You do not need to set this option if you are using the set-format style.
97
96
 
98
- ## diff?
97
+ ## diff? <a name="diff">
99
98
  Returns String of "show | compare" as String. If there is no diff, then this method returns `nil`.
100
99
 
101
- ## commit?
100
+ ## commit? <a name="commit_check">
102
101
 
103
102
  Checks the candidate config for validation, returns `true` or Array of errors.
104
103
 
@@ -113,7 +112,7 @@ ndev.cu.commit?
113
112
  {:severity=>"error", :message=>"configuration check-out failed"}]
114
113
  ```
115
114
 
116
- ## commit!( opts = {} )
115
+ ## commit!( opts = {} ) <a name="commit">
117
116
 
118
117
  Performs commit, returns `true` or raises `Netconf::CommitError`. Available options are:
119
118
 
@@ -123,15 +122,15 @@ A commit log comment that is available when retrieving the commit log.
123
122
  :confirm => Fixnum-Minutes
124
123
  Identifies a timeout in minutes to automatically rollback the configuration unless you explicitly issue another commit action. This is very useful if you think your configuration changes may lock you out of the device.
125
124
 
126
- ## unlock!
125
+ ## unlock! <a name="unlock">
127
126
 
128
127
  Releases exclusive lock on config. If you do not posses the lock, this method will raise an `Netconf::RpcError` exception.
129
128
 
130
- ## rollback!( rollback_id = 0 )
129
+ ## rollback!( rollback_id = 0 ) <a name="rollback">
131
130
 
132
131
  Loads a rollback of config, does not commit.
133
132
 
134
- ## get_config( scope = nil )
133
+ ## get_config( scope = nil ) <a name="get_config">
135
134
 
136
135
  Returns the text-style format of the request config. If `scope` is `nil` then the entire configuration is returned. If the `scope` is invalid (asking for the "foo" stanza for example), then a string with "ERROR!" is returned. If the requested config is non-existant (asking for non-existant interface), then `nil` is returned.
137
136
 
@@ -1,8 +1,21 @@
1
- # Filesystem Utilities
1
+ # `Junos::Ez::FS::Utils`
2
2
 
3
3
  A collection of methods to access filesystem specific functions and information. These methods return data in
4
- Hash / Array structures so the information can be programmatically accessible, rather than scraping CLI or navigating
5
- Junos XML.
4
+ Hash / Array structures so the information can be programmatically accessible.
5
+
6
+ # METHODS
7
+
8
+ - [`cat`](#cat) - returns the String contents of a file
9
+ - [`checksum`](#checksum) - returns the checksum of a file (MD5, SHA1, SHA256 options)
10
+ - [`cleanup?`](#cleanup_check) - returns a Hash of files that *would be* removed from "request system storage cleanup"
11
+ - [`cleanup!`](#cleanup) - "request system storage cleanup" (!! NO CONFIRM !!)
12
+ - [`cp!`](#cp) - copies a file relative on the device filesystem
13
+ - [`cwd`](#cwd) - changes the current working directory
14
+ - [`pwd`](#pwd) - returns a String of the current working directory
15
+ - [`df`](#df) - "show system storage"
16
+ - [`ls`](#ls) - "file list", i.e. get a file / directory listing, returns a Hash
17
+ - [`mv!`](#mv) - "file move", i.e. move / rename files
18
+ - [`rm!`](#rm) - "file delete", i.e. deletes files
6
19
 
7
20
  # USAGE
8
21
  ```ruby
@@ -57,22 +70,291 @@ pp ndev.fs.ls '/var/home/jeremy', :detail => true
57
70
  :date_epoc=>1271441068}}}}
58
71
  ```
59
72
 
60
- # METHODS
61
73
 
62
- - `cat` - returns the String contents of a file
63
- - `checksum` - returns the checksum of a file (MD5, SHA1, SHA256 options)
64
- - `cleanup?` - returns a Hash of files that *would be* removed from "request system storage cleanup"
65
- - `cleanup!` - "request system storage cleanup" (!! NO CONFIRM !!)
66
- - `cp!` - copies a file relative on the device filesystem
67
- - `cwd` - changes the current working directory
68
- - `pwd` - returns a String of the current working directory
69
- - `df` - "show system storage"
70
- - `ls` - "file list", i.e. get a file / directory listing, returns a Hash
71
- - `mv!` - "file move", i.e. move / rename files
72
- - `rm!` - "file delete", i.e. deletes files
73
74
 
74
75
  # GORY DETAILS
75
76
 
76
- ... more docs comming ...
77
+ ## `cat( filename )` <a name="cat">
78
+ Returns the String contents of a file. If the file does not exist, an `IOError` with String error message is raised.
79
+ ```ruby
80
+ puts ndev.fs.cat '/var/log/messages'
81
+ ->
82
+ May 2 18:05:32 firefly newsyslog[1845]: logfile turned over due to -F request
83
+
84
+ puts ndev.fs.cat 'foober'
85
+ exception->
86
+ IOError: "could not resolve file: foober"
87
+ ```
88
+
89
+ ## `checksum( method, path )` <a name="checksum">
90
+ Returns the checksum of a file (MD5, SHA1, SHA256 options) located on the Junos target. The `method` idetifies the checksum method, and is one of `[:md5, :sha256, :sha1]`. The `path` argument specifies the file to run the checksum over. If the `path` file does not exist, then an `IOError` exception with String error-message will be raised.
91
+
92
+ The following runs an MD5 checksum over the file /var/tmp/junos-vsrx-domestic.tgz located on the Junos target:
93
+ ```ruby
94
+ ndev.fs.checksum :md5, "/var/tmp/junos-vsrx-domestic.tgz"
95
+ ->
96
+ "91132caf6030fa88a31c2b9db60ea54d"
97
+
98
+ # try to get a checksum on a non-existant file ...
99
+
100
+ ndev.fs.checksum :md5, "foober"
101
+ exception->
102
+ IOError: "md5: /cf/var/home/jeremy/foober: No such file or directory"
103
+ ```
104
+
105
+ ## `cleanup?` <a name="cleanup_check">
106
+ Returns a Hash of files that *would be* removed as a result of the command "request system storage cleanup".
107
+ ```ruby
108
+ ndev.fs.cleanup?
109
+ ->
110
+ {"/cf/var/crash/flowd_vsrx.log.firefly.0"=>
111
+ {:size_text=>"650B", :size=>650, :date=>"May 3 13:15"},
112
+ "/cf/var/crash/flowd_vsrx.log.firefly.1"=>
113
+ {:size_text=>"650B", :size=>650, :date=>"May 3 13:22"},
114
+ "/cf/var/crash/flowd_vsrx.log.firefly.2"=>
115
+ {:size_text=>"23B", :size=>23, :date=>"May 5 19:20"},
116
+ "/cf/var/crash/flowd_vsrx.log.firefly.3"=>
117
+ {:size_text=>"650B", :size=>650, :date=>"May 5 19:20"},
118
+ "/cf/var/tmp/vpn_tunnel_orig.id"=>
119
+ {:size_text=>"0B", :size=>0, :date=>"May 5 19:20"}}
120
+ ```
121
+
122
+ ## `cleanup!` <a name="cleanup">
123
+ Performs the command "request system storage cleanup" (!! NO CONFIRM !!), and returns a Hash of the files that were removed.
124
+ ```ruby
125
+ ndev.fs.cleanup!
126
+ ->
127
+ {"/cf/var/crash/flowd_vsrx.log.firefly.0"=>
128
+ {:size_text=>"650B", :size=>650, :date=>"May 3 13:15"},
129
+ "/cf/var/crash/flowd_vsrx.log.firefly.1"=>
130
+ {:size_text=>"650B", :size=>650, :date=>"May 3 13:22"},
131
+ "/cf/var/crash/flowd_vsrx.log.firefly.2"=>
132
+ {:size_text=>"23B", :size=>23, :date=>"May 5 19:20"},
133
+ "/cf/var/crash/flowd_vsrx.log.firefly.3"=>
134
+ {:size_text=>"650B", :size=>650, :date=>"May 5 19:20"},
135
+ "/cf/var/tmp/vpn_tunnel_orig.id"=>
136
+ {:size_text=>"0B", :size=>0, :date=>"May 5 19:20"}}
137
+ ```
138
+
139
+ ## `cp!( from_file, to_file )` <a name="cp">
140
+ Copies a file relative on the Junos filesystem. Returns `true` if the operations was successful, raises an `IOError` exceptions with error-message otherwise.
141
+
142
+ ```ruby
143
+ # copy the vsrx.conf file from the temp directory to the current working directory
144
+ ndev.fs.cp! "/var/tmp/vsrx.conf","."
145
+ ->
146
+ true
147
+
148
+ # try to copy a file that doesn't exist
149
+ ndev.fs.cp! "/var/tmp/vsrx.conf-bleck","."
150
+ (exception)->
151
+ IOError: "File does not exist: /var/tmp/vsrx.conf-bleck
152
+ File fetch failed"
153
+ ```
154
+
155
+ ## `cwd( directory )` <a name="cwd">
156
+ Changes the current working directory (String). Returns the working directory name if the operation was succesfful. If the requested `directory` does not exist, then an `IOError` with String error-message is raised.
157
+ ```ruby
158
+ # change to the '/var/tmp' directory. What we see is that this directory is really a symlink to '/cf/var/tmp'
159
+ ndev.fs.cwd "/var/tmp"
160
+ ->
161
+ "/cf/var/tmp"
162
+
163
+ # now try to change to a non-existant directory:
164
+
165
+ ndev.fs.cwd "/foober"
166
+ exception->
167
+ IOError: "invalid directory: /foober"
168
+ ```
169
+
170
+ ## `pwd`
171
+ Returns a String of the current working directory.
172
+ ```ruby
173
+ ndev.fs.pwd
174
+ ->
175
+ "/cf/var/home/jeremy"
176
+ ```
177
+
178
+ # `df( opts = {} )` <a name="df">
179
+ Returns information about the filesystem storage, gathered from "show system storage". The following options are supported:
180
+ ```
181
+ :format => [:hash, :xml, :text]
182
+ ```
183
+ Determines the return format, the default is `:hash`. Format `:xml` returns the Junos XML result, and format `:text` returns the CLI text output.
184
+ ```
185
+ :size_div => Fixnum
186
+ ```
187
+ This option is only valid if `:format => :hash`. When a `:size_div` is provided, this method will change the reported size by dividing it down; handy if you want to covert the size in bytes to something like MB or GB reference. This option will change the values of the `:total_size`, `:used_size`, and `:avail_size` values.
188
+ ```ruby
189
+ ndev.fs.df
190
+ ->
191
+ {"/dev/ad0s1a"=>
192
+ {:mounted_on=>"/",
193
+ :total_blocks=>3313822,
194
+ :total_size=>"1.6G",
195
+ :used_blocks=>1431770,
196
+ :used_size=>"699M",
197
+ :used_percent=>47,
198
+ :avail_blocks=>1616948,
199
+ :avail_size=>"790M"},
200
+ "devfs"=>
201
+ {:mounted_on=>"/jail/dev",
202
+ :total_blocks=>2,
203
+ :total_size=>"1.0K",
204
+ :used_blocks=>2,
205
+ :used_size=>"1.0K",
206
+ :used_percent=>100,
207
+ :avail_blocks=>0,
208
+ :avail_size=>"0B"},
209
+ # <snip>
210
+ "/cf/var/log"=>
211
+ {:mounted_on=>"/jail/var/log",
212
+ :total_blocks=>3313822,
213
+ :total_size=>"1.6G",
214
+ :used_blocks=>1431770,
215
+ :used_size=>"699M",
216
+ :used_percent=>47,
217
+ :avail_blocks=>1616948,
218
+ :avail_size=>"790M"}}
219
+ ```
220
+ Same example but dividing down the size by 1024 to put into MB.
221
+ ```ruby
222
+ [7] pry(main)> ndev.fs.df :size_div => 1024
223
+ => {"/dev/ad0s1a"=>
224
+ {:mounted_on=>"/",
225
+ :total_blocks=>3313822,
226
+ :total_size=>1618,
227
+ :used_blocks=>1431770,
228
+ :used_size=>699,
229
+ :used_percent=>47,
230
+ :avail_blocks=>1616948,
231
+ :avail_size=>789},
232
+ "devfs"=>
233
+ {:mounted_on=>"/jail/dev",
234
+ :total_blocks=>2,
235
+ :total_size=>0,
236
+ :used_blocks=>2,
237
+ :used_size=>0,
238
+ :used_percent=>100,
239
+ :avail_blocks=>0,
240
+ :avail_size=>0},
241
+ # <snip>
242
+ "/cf/var/log"=>
243
+ {:mounted_on=>"/jail/var/log",
244
+ :total_blocks=>3313822,
245
+ :total_size=>1618,
246
+ :used_blocks=>1431770,
247
+ :used_size=>699,
248
+ :used_percent=>47,
249
+ :avail_blocks=>1616948,
250
+ :avail_size=>789}}
251
+ ```
252
+
253
+ ## `ls( *args )` <a name="ls">
254
+ Returns a directory/file listing in a Hash structure. Each primary key is the name of the directory. If the required path is a file, then the key will be an empty string.
255
+ The `*args` determine what information is returned. The general format of use is:
256
+ ```
257
+ ls <path>, <options>
258
+ ```
259
+ Where `path` is a filesystem-path and `options` is a Hash of controls. The following options are supported:
260
+ ```
261
+ :format => [:text, :xml, :hash]
262
+ ```
263
+ Determines what format this method returns. By default this will be `:hash`. The `:xml` option will return the Junos XML result. The `:text` option will return the CLI text output.
264
+ ```
265
+ :recurse => true
266
+ ```
267
+ When this option is set, a complete recursive listing will be performed. This is only valid if the `path` is a directory. This option will return full informational detail on the files/directories as well.
268
+ ```
269
+ :detail => true
270
+ ```
271
+ When this option is set then detailed information, like file size, is provided.
272
+
273
+ If no `*args` are passed, then the file listing of the current working directory is provided:
274
+ ```ruby
275
+ ndev.fs.ls
276
+ ->
277
+ {"/cf/var/home/jeremy/"=>
278
+ {:fileblocks=>7370,
279
+ :files=>
280
+ {"FF-no-security.conf"=>{},
281
+ "key1.pub"=>{},
282
+ "vsrx.conf"=>{}},
283
+ :dirs=>{".ssh"=>{}}}}
284
+
285
+ ```
286
+ Or if you want the details for the current directory listing
287
+ ```ruby
288
+ [23] pry(main)> ndev.fs.ls :detail=>true
289
+ => {"/cf/var/home/jeremy/"=>
290
+ {:fileblocks=>7370,
291
+ :files=>
292
+ {"FF-no-security.conf"=>
293
+ {:owner=>"jeremy",
294
+ :group=>"staff",
295
+ :links=>1,
296
+ :size=>366682,
297
+ :permissions_text=>"-rw-r--r--",
298
+ :permissions=>644,
299
+ :date=>"Apr 13 21:56",
300
+ :date_epoc=>1365890165},
301
+ "key1.pub"=>
302
+ {:owner=>"jeremy",
303
+ :group=>"staff",
304
+ :links=>1,
305
+ :size=>0,
306
+ :permissions_text=>"-rw-r--r--",
307
+ :permissions=>644,
308
+ :date=>"Apr 27 14:59",
309
+ :date_epoc=>1367074764},
310
+ "vsrx.conf"=>
311
+ {:owner=>"jeremy",
312
+ :group=>"staff",
313
+ :links=>1,
314
+ :size=>1559492,
315
+ :permissions_text=>"-rwxr-xr-x",
316
+ :permissions=>755,
317
+ :date=>"Dec 19 16:27",
318
+ :date_epoc=>1355934448}},
319
+ :dirs=>
320
+ {".ssh"=>
321
+ {:owner=>"jeremy",
322
+ :group=>"staff",
323
+ :links=>2,
324
+ :size=>512,
325
+ :permissions_text=>"drwxr-xr-x",
326
+ :permissions=>755,
327
+ :date=>"Apr 3 14:41",
328
+ :date_epoc=>1365000068}}}}
329
+ ```
330
+
331
+ ## `mv!( from_path, to_path )` <a name="mv">
332
+ Move / rename file(s). Returns `true` if the operation was successful, `IOError` exception with String error-message otherwise.
333
+ ```ruby
334
+ # move the file "vsrx.conf" from the current working directory to the temp directory
335
+ ndev.fs.mv! "vsrx.conf","/var/tmp"
336
+ ->
337
+ true
338
+
339
+ # Now do it again to generate an error message[26] pry(main)> ndev.fs.mv! "vsrx.conf","/var/tmp"
340
+ ndev.fs.mv! "vsrx.conf","/var/tmp"
341
+ exception->
342
+ IOError:
343
+ "mv: /cf/var/home/jeremy/vsrx.conf: No such file or directory"
344
+ ```
345
+
346
+ ## `rm!( path )` <a name="rm">
347
+ Removes the file(s) identified by `path`. Returns `true` if the file(s) are removed OK, `IOError` exception with String error-message otherwise.
348
+ ```ruby
349
+ ndev.fs.rm! "/var/tmp/junos-vsrx-domestic.tgz"
350
+ ->
351
+ true
352
+
353
+ # now try to remove the file again to generate an error ..
354
+ ndev.fs.rm! "/var/tmp/junos-vsrx-domestic.tgz"
355
+ exception->
356
+ IOError:
357
+ "rm: /var/tmp/junos-vsrx-domestic.tgz: No such file or directory"
358
+ ```
77
359
 
78
360
 
@@ -1,27 +1,6 @@
1
1
  # `Junos::Ez::RE::Utils`
2
2
 
3
- A collection of methods to access routing-engine specific functions and information. These methods return data in Hash / Array structures so the information can be programmatically accessible, rather than scraping CLI or navigating Junos XML.
4
-
5
- # USAGE
6
-
7
- ```ruby
8
-
9
- # bind :re to access the routing-engine utitities
10
- Junos::Ez::RE::Utils( ndev, :re )
11
-
12
- # show the uptime information on this device
13
- pp ndev.re.uptime
14
- ->
15
- {"re0"=>
16
- {:time_now=>"2013-04-27 22:28:24 UTC",
17
- :active_users=>1,
18
- :load_avg=>[0.08, 0.05, 0.01],
19
- :uptime=>{:at=>"10:28PM", :ago=>"27 days, 2:58"},
20
- :time_boot=>{:at=>"2013-03-31 19:30:47 UTC", :ago=>"3w6d 02:57"},
21
- :protocols_started=>{:at=>"2013-03-31 19:34:53 UTC", :ago=>"3w6d 02:53"},
22
- :last_config=>
23
- {:at=>"2013-04-27 19:48:42 UTC", :ago=>"02:39:42", :by=>"jeremy"}}}
24
- ```
3
+ A collection of methods to access routing-engine specific functions and information. These methods return data in Hash / Array structures so the information can be programmatically accessible.
25
4
 
26
5
  # METHODS
27
6
 
@@ -56,6 +35,28 @@ pp ndev.re.uptime
56
35
 
57
36
  - [`ping`](#ping) - Perform a "ping" command
58
37
 
38
+ # USAGE
39
+ ```ruby
40
+
41
+ # bind :re to access the routing-engine utitities
42
+ Junos::Ez::RE::Utils( ndev, :re )
43
+
44
+ # show the uptime information on this device
45
+ pp ndev.re.uptime
46
+ ->
47
+ {"re0"=>
48
+ {:time_now=>"2013-04-27 22:28:24 UTC",
49
+ :active_users=>1,
50
+ :load_avg=>[0.08, 0.05, 0.01],
51
+ :uptime=>{:at=>"10:28PM", :ago=>"27 days, 2:58"},
52
+ :time_boot=>{:at=>"2013-03-31 19:30:47 UTC", :ago=>"3w6d 02:57"},
53
+ :protocols_started=>{:at=>"2013-03-31 19:34:53 UTC", :ago=>"3w6d 02:53"},
54
+ :last_config=>
55
+ {:at=>"2013-04-27 19:48:42 UTC", :ago=>"02:39:42", :by=>"jeremy"}}}
56
+ ```
57
+
58
+
59
+
59
60
  # GORY DETAILS
60
61
 
61
62
  ## `status`
@@ -0,0 +1,3 @@
1
+ module Junos::Ez
2
+ class NoProvider < StandardError; end
3
+ end
@@ -8,10 +8,13 @@
8
8
  require 'set'
9
9
 
10
10
  module Junos; end
11
+ module Junos::Ez; end
12
+
13
+ require 'junos-ez/exceptions.rb'
11
14
 
12
15
  module Junos::Ez
13
16
 
14
- VERSION = "0.0.16"
17
+ VERSION = "0.0.17"
15
18
 
16
19
  ### ---------------------------------------------------------------
17
20
  ### rpc_errors - decodes the XML into an array of error/Hash
@@ -78,7 +78,7 @@ class Junos::Ez::FS::Provider < Junos::Ez::Provider::Parent
78
78
 
79
79
  f_chk = got.xpath('file-checksum')
80
80
  if (err = f_chk.xpath('rpc-error/error-message')[0])
81
- return err.text.strip
81
+ raise IOError, err.text.strip
82
82
  end
83
83
  f_chk.xpath('checksum').text.strip
84
84
  end
@@ -180,17 +180,7 @@ class Junos::Ez::FS::Provider < Junos::Ez::Provider::Parent
180
180
  ls_hash
181
181
  end # method: ls
182
182
 
183
- ### -------------------------------------------------------------
184
- ### rm! - just like unix, removes files
185
- ### -------------------------------------------------------------
186
-
187
- def rm!( path )
188
- got = @ndev.rpc.file_delete( :path => path )
189
- return true if got.nil? # got no error
190
- # otherwise, there was an error, check output
191
- got.text
192
- end
193
-
183
+
194
184
  ### -------------------------------------------------------------
195
185
  ### cat - is used to obtain the text contents of the file
196
186
  ### -------------------------------------------------------------
@@ -203,15 +193,7 @@ class Junos::Ez::FS::Provider < Junos::Ez::Provider::Parent
203
193
  end
204
194
  end
205
195
 
206
- ### -------------------------------------------------------------
207
- ### 'mv' - just like unix, moves/renames a file
208
- ### -------------------------------------------------------------
209
-
210
- def mv!( from_path, to_path )
211
- got = @ndev.rpc.command( "file rename #{from_path} #{to_path}" )
212
- return true if got.nil? # got no error
213
- got.text
214
- end
196
+
215
197
 
216
198
  ### -------------------------------------------------------------
217
199
  ### df - shows the system storage information
@@ -312,6 +294,28 @@ class Junos::Ez::FS::Provider < Junos::Ez::Provider::Parent
312
294
  end
313
295
  end
314
296
 
297
+ ### -------------------------------------------------------------
298
+ ### 'mv' - just like unix, moves/renames a file
299
+ ### -------------------------------------------------------------
300
+
301
+ def mv!( from_path, to_path )
302
+ got = @ndev.rpc.command( "file rename #{from_path} #{to_path}" )
303
+ return true if got.nil? # got no error
304
+ raise IOError, got.text
305
+ end
306
+
307
+ ### -------------------------------------------------------------
308
+ ### rm! - just like unix, removes files
309
+ ### -------------------------------------------------------------
310
+
311
+ def rm!( path )
312
+ got = @ndev.rpc.file_delete( :path => path )
313
+ return true if got.nil? # got no error
314
+ # otherwise, there was an error, check output
315
+ raise IOError, got.text
316
+ end
317
+
318
+
315
319
  end # class Provider
316
320
 
317
321
  ### -----------------------------------------------------------------
@@ -14,7 +14,9 @@ module Junos::Ez::Vlans
14
14
  when :VLAN, :VLAN_NG
15
15
  Junos::Ez::Vlans::Provider::VLAN.new( ndev )
16
16
  when :BRIDGE_DOMAIN
17
- Junos::Ez::Vlans::Provider::BRIDGE_DOMAIN.new( ndev )
17
+ Junos::Ez::Vlans::Provider::BRIDGE_DOMAIN.new( ndev )
18
+ else
19
+ raise Junos::Ez::NoProvider, "target does not support vlan bridges"
18
20
  end
19
21
  newbie.properties = Junos::Ez::Provider::PROPERTIES + PROPERTIES
20
22
  Junos::Ez::Provider.attach_instance_variable( ndev, varsym, newbie )
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: junos-ez-stdlib
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.16
4
+ version: 0.0.17
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-05-03 00:00:00.000000000 Z
12
+ date: 2013-05-05 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: netconf
@@ -37,6 +37,7 @@ files:
37
37
  - junos-ez-stdlib.gemspec
38
38
  - LICENSE
39
39
  - README.md
40
+ - lib/junos-ez/exceptions.rb
40
41
  - lib/junos-ez/facts/chassis.rb
41
42
  - lib/junos-ez/facts/ifd_style.rb
42
43
  - lib/junos-ez/facts/personality.rb