diff --git a/bin/finish_setup.sh b/bin/finish_setup.sh index 31738ec..74343e9 100755 --- a/bin/finish_setup.sh +++ b/bin/finish_setup.sh @@ -13,6 +13,8 @@ sudo mkdir -p /etc/service/openmanage/supervise sudo ln -s $OPENMANAGE_ROOT/etc/service/openmanage/run /etc/service/openmanage/run sudo sv start openmanage +python $HOME/netkes/upgrade/apply_sql.py + if [ -e $OPENMANAGE_ROOT/netkes/account_mgr/user_source/ldap_source.py ]; then echo "Now we're going to start the initial LDAP->SpiderOak account sync. This may take a while. diff --git a/netkes/account_mgr/user_source/ldap_source.py b/netkes/account_mgr/user_source/ldap_source.py index 550a076..99ee8c4 100644 --- a/netkes/account_mgr/user_source/ldap_source.py +++ b/netkes/account_mgr/user_source/ldap_source.py @@ -268,7 +268,7 @@ def _get_group_ou(ldap_conn, config, group): filterstr = "(|(objectClass=person)(objectClass=user)(objectClass=organizationalUser))", attrlist=_create_attrlist(config)): - if dn is None: + if dn is None or not result_dict: continue if config['dir_username_source'] not in result_dict: log.info("User %s lacks %s, skipping", dn, config['dir_username_source']) @@ -296,7 +296,7 @@ def _build_user_details(ldap_conn, config, group, uid): return None log.debug("Appending user %s", user) - return _build_user_dict(user_dict, config, group['group_id']) + return _build_user_dict(config, user_dict, group['group_id']) def _get_group_group(ldap_conn, config, group): @@ -307,7 +307,7 @@ def _get_group_group(ldap_conn, config, group): base_dn=group['ldap_id'], scope=ldap.SCOPE_BASE, attrlist=[config['dir_member_source']]): - if dn is None: + if dn is None or not result_dict: continue # Search LDAP to get User entries that match group for user in result_dict[config['dir_member_source']]: diff --git a/upgrade/apply_sql.py b/upgrade/apply_sql.py index 5d36a44..27e4a03 100644 --- a/upgrade/apply_sql.py +++ b/upgrade/apply_sql.py @@ -4,7 +4,7 @@ def apply_sql(): common.set_config(common.read_config_file()) - sql_files = glob.glob('/opt/openmanage/net_kes/sql/*.sql') + sql_files = glob.glob('/home/openmanage/netkes/sql/*.sql') sql_files = [(x.split('/')[-1], open(x).readlines()) for x in sql_files] sql_files = sorted(sql_files, key=lambda x: x[0]) @@ -12,6 +12,7 @@ def apply_sql(): with get_cursor(common.get_config()) as cur: cur.execute('select * from sql_updates where name=%s', (sql_file[0], )) if cur.rowcount == 0: + print "Applying", sql_file[0] cur.execute(''.join(sql_file[1])) cur.execute('insert into sql_updates (name) values (%s)', (sql_file[0], ))