From d13b78bd832a716fb9b7ae7716dbef1d9cddbae1 Mon Sep 17 00:00:00 2001 From: James Bracy Date: Tue, 25 Oct 2016 12:34:33 -0700 Subject: [PATCH] Check for existence of 'apps' and 'users' in the configuration file. Fixes #4 --- sync-accounts | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/sync-accounts b/sync-accounts index 302adff..9620efa 100755 --- a/sync-accounts +++ b/sync-accounts @@ -28,11 +28,16 @@ def read_permissions(url) end # Add keys to users and apps - yaml['users'].each do |user| - permissions['users'][user] = github_keys(user) + if (yaml['users']) + yaml['users'].each do |user| + permissions['users'][user] = github_keys(user) + end end - yaml['apps'].each do |app, users| - permissions['apps'][app] = users.map{|u| github_keys(u) }.flatten + + if (yaml['apps']) + yaml['apps'].each do |app, users| + permissions['apps'][app] = users.map{|u| github_keys(u) }.flatten + end end permissions