summaryrefslogtreecommitdiff
path: root/lib/oxidized/model/airos.rb
blob: 7d829569cf282a3831c027303bd644c13b054ac7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
class Airos < Oxidized::Model
  # Ubiquiti AirOS circa 5.x

  prompt /^[^#]+# /
  comment '# '

  cmd 'cat /etc/board.info' do |cfg|
    cfg.split("\n").map { |line| "# #{line}" }.join("\n") + "\n"
  end

  cmd 'cat /etc/version' do |cfg|
    comment "airos version: #{cfg}"
  end

  cmd 'sort /tmp/system.cfg'

  cmd :secret do |cfg|
    cfg.gsub! /^(users\.\d+\.password|snmp\.community)=.+/, "# \\1=<hidden>"
    cfg
  end

  cfg :ssh do
    exec true
  end
end