Method: WifiWand::MacOsModel#os_level_preferred_network_password
- Defined in:
- lib/wifi-wand/models/mac_os_model.rb
#os_level_preferred_network_password(preferred_network_name) ⇒ Object
@return:
If the network is in the preferred networks list
If a password is associated w/this network, return the password
If not, return nil
else
raise an error
229 230 231 232 233 234 235 236 237 238 239 240 |
# File 'lib/wifi-wand/models/mac_os_model.rb', line 229 def os_level_preferred_network_password(preferred_network_name) command = %Q{security find-generic-password -D "AirPort network password" -a "#{preferred_network_name}" -w 2>&1} begin return run_os_command(command).chomp rescue OsCommandError => error if error.exitstatus == 44 # network has no password stored nil else raise end end end |