OPNsense Forum

Archive => 18.1 Legacy Series => Topic started by: guest15389 on January 29, 2018, 04:44:41 pm

Title: CLI Backup
Post by: guest15389 on January 29, 2018, 04:44:41 pm
I was using this:

https://forum.opnsense.org/index.php?topic=4690.msg18194#msg18194

I'm not sure if something changed with my Linux box as I made a move from Debian to Fedora, but I just noticed I'm getting an error when using your script:

Code: [Select]
/home/felix/scripts/router/opn_backup.rb:42:in `<main>': undefined method `scan' for nil:NilClass (NoMethodError)
Does it need an update or am I just missing something that needs to be installed?

Code: [Select]
ruby -v
ruby 2.4.3p205 (2017-12-14 revision 61247) [x86_64-linux]
Title: Re: CLI Backup
Post by: fabian on January 29, 2018, 05:35:43 pm
This is not an issue with your box - it seems like the XSRF protection has changed and the script was not aware of it - I updated the script so it should work again but it will need an XML parser (nokogiri) to work.

You can install this dependency using
Code: [Select]
gem install nokogiri. It might be in your package manager as well because it is a very common package.
Title: Re: CLI Backup
Post by: guest15389 on January 29, 2018, 05:50:49 pm
I was able to get that installed but still generates the same error.
Code: [Select]
[felix@plex router]$ gem install nokogiri
Building native extensions.  This could take a while...
Successfully installed nokogiri-1.8.2
Parsing documentation for nokogiri-1.8.2
Installing ri documentation for nokogiri-1.8.2
Done installing documentation for nokogiri after 7 seconds
1 gem installed
[felix@plex router]$ ls
ppn_backup  opn_backup.rb
[felix@plex router]$ ./opn_backup
/home/felix/scripts/router/opn_backup.rb:42:in `<main>': undefined method `scan' for nil:NilClass (NoMethodError)
Title: Re: CLI Backup
Post by: fabian on January 29, 2018, 06:02:34 pm
did you download the new version of the script?
Title: Re: CLI Backup
Post by: guest15389 on January 29, 2018, 06:05:33 pm
I did, but didn't update my main script to use the new one. Fixed and working now.

Thanks!