`components_enabled': undefined method `map' for nil:NilClass (NoMethodError)
Closed this issue · 4 comments
Bug description
Fails to run.
Reproduction steps
Steps to reproduce the behavior:
- Installed using
sudo gem install panda-motd
- ran:
sudo panda-motd
- Got the error below.
rush@rush-Latitude-E6540:~/ruby_projects/panda-motd$ sudo gem install panda-motd
[sudo] password for rush:
Fetching: colorize-0.8.1.gem (100%)
Successfully installed colorize-0.8.1
Fetching: require_all-2.0.0.gem (100%)
Successfully installed require_all-2.0.0
Fetching: ruby-units-2.3.0.gem (100%)
Successfully installed ruby-units-2.3.0
Fetching: drydock-0.6.9.gem (100%)
Successfully installed drydock-0.6.9
Fetching: storable-0.8.9.gem (100%)
Successfully installed storable-0.8.9
Fetching: sysinfo-0.8.1.gem (100%)
Successfully installed sysinfo-0.8.1
Fetching: panda-motd-0.0.4.gem (100%)
Successfully installed panda-motd-0.0.4
Parsing documentation for colorize-0.8.1
Installing ri documentation for colorize-0.8.1
Parsing documentation for require_all-2.0.0
Installing ri documentation for require_all-2.0.0
Parsing documentation for ruby-units-2.3.0
Installing ri documentation for ruby-units-2.3.0
Parsing documentation for drydock-0.6.9
Installing ri documentation for drydock-0.6.9
Parsing documentation for storable-0.8.9
Installing ri documentation for storable-0.8.9
Parsing documentation for sysinfo-0.8.1
Installing ri documentation for sysinfo-0.8.1
Parsing documentation for panda-motd-0.0.4
Installing ri documentation for panda-motd-0.0.4
Done installing documentation for colorize, require_all, ruby-units, drydock, storable, sysinfo, panda-motd after 0 seconds
7 gems installed
rush@rush-Latitude-E6540:~/ruby_projects/panda-motd$ sudo panda-motd
Traceback (most recent call last):
6: from /usr/local/bin/panda-motd:23:in `<main>'
5: from /usr/local/bin/panda-motd:23:in `load'
4: from /var/lib/gems/2.5.0/gems/panda-motd-0.0.4/bin/panda-motd:5:in `<top (required)>'
3: from /var/lib/gems/2.5.0/gems/panda-motd-0.0.4/lib/panda_motd.rb:6:in `new_motd'
2: from /var/lib/gems/2.5.0/gems/panda-motd-0.0.4/lib/panda_motd.rb:6:in `new'
1: from /var/lib/gems/2.5.0/gems/panda-motd-0.0.4/lib/panda_motd/motd.rb:8:in `initialize'
/var/lib/gems/2.5.0/gems/panda-motd-0.0.4/lib/panda_motd/config.rb:13:in `components_enabled': undefined method `map' for nil:NilClass (NoMethodError)
Expected behavior
Expected the application to create the config file and run.
Screenshots
OS Information
- OS: 18.04 Ubuntu Budgie LTS
Hi, I think this is because I haven't pushed a small fix yet. It crashed because you haven't enabled any components yet. Check out ~/.config/panda-motd.yaml
and enable one of the components. It should work then.
I enabled a couple of them. Here is what I have. Let me know if I'm missing something. Thanks again for quick reply.
# The components section contains an ordered list of components you wish to
# print in the MOTD. They will be printed in the order they are defined in
# this file. Duplicate components will override previous definitions. Every
# component has an "enabled" setting which will turn the component on or off.
components:
#####
# ASCII Text Art
# Generates ASCII pictures of strings. Currently only shows the hostname.
#
# Settings
# font: The figlet font to render the text with. All supported fonts
# can be found at http://www.figlet.org/fontdb.cgi
# color: The color of the resulting text art. Supports the standard base-8
# colors: black, red, green, yellow, blue, magenta, cyan, and white. You
# can also use 'default' for your default terminal color. Additionally,
# you can prefix any of the base colors with 'light_' to get the lighter
# version.
#####
ascii_text_art:
enabled: true
font: slant
color: red
#####
# Service Status
# Displays the current state of services running on the system. Currently
# only supports systemd.
#
# Settings
# services: Pairs following the format "service_name: Pretty Name". The
# service_name is the name of the systemd service to look for, NOT
# including the '.service' suffix. The pretty name is the name that is
# used in the MOTD to represent that service.
#####
# service_status:
# enabled: true
# services:
# chunkwm: chunkwm
# ssh: skhd
# elasticsearch@5.6: elasticsearch
# mysql: MySQL
#####
# Uptime
# Displays the current uptime of the machine.
#
# Settings
# prefix: The text to prepend to the uptime string.
#####
uptime:
enabled: true
prefix: up
#####
# SSL Certificates
# Displays the validity and expiration dates of SSL certificates.
#
# Settings
# certs: Pairs following the format "PrettyName: absolute_cert_file_path".
# The absolute_cert_file_path is the absolute file path of the SSL
# certificate. The pretty name is the name that is used in the MOTD to
# represent that certificate, typically a domain name.
#####
# ssl_certificates:
# enabled: true
# certs:
# taylorjthurlow.com: /etc/letsencrypt/live/taylorjthurlow.com/cert.pem
#####
# Filesystems
# Displays filesystem usage information.
#
# Settings
# filesystems: Pairs following the format "filesystem_name: Pretty Name".
# The filesystem_name is the name of the filesystem listed when using the
# `df` command line tool. The pretty name is the name that is used in the
# MOTD to represent that filesystem.
#####
# filesystems:
# enabled: true
# filesystems:
# /dev/sda1: Ubuntu
# /dev/sdc1: Data
#####
# Last Login
# Displays previous login information for users.
#
# Settings
# users: A list of user names which you are interested in receiving login
# information about. The key is the username, and the value is the number
# of recent logins you'd like to display.
#####
last_login:
enabled: true
users:
rush: 1
# stoyan: 1
That should do it. Make sure you have consistent indents - I think each component definition has one extra space. Two spaces for indents.
Also, this is fixed in 86cb667. Will release a new version to fix this ASAP.
EDIT: Going to leave this open for the time being.
EDIT: Just pushed 0.0.5 which includes this fix. A sudo gem update panda-motd
should fix this issue.