From 8c2661b023ff99f33224ef6391d08e231b68d7e1 Mon Sep 17 00:00:00 2001 From: bdzim Date: Wed, 28 Aug 2013 17:40:03 -0400 Subject: [PATCH 1/4] run apply_sql from new netkes location --- upgrade/apply_sql.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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], )) From ac6285583ed4c5b6eaf09476891f117db8498f60 Mon Sep 17 00:00:00 2001 From: bdzim Date: Thu, 29 Aug 2013 10:38:11 -0400 Subject: [PATCH 2/4] fixed wrong paramater order in _build_user_dict --- netkes/account_mgr/user_source/ldap_source.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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']]: From 8bc6684e6abf26e8a24ed01d36dc2fe1b21a0579 Mon Sep 17 00:00:00 2001 From: bdzim Date: Thu, 29 Aug 2013 11:06:26 -0400 Subject: [PATCH 3/4] run apply_sql.py in finish_setup.sh --- bin/finish_setup.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/bin/finish_setup.sh b/bin/finish_setup.sh index 31738ec..71b8679 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 +sudo 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. From ac54abe41fdb45e735a699c50674ec7fa5ba4bbf Mon Sep 17 00:00:00 2001 From: bdzim Date: Thu, 29 Aug 2013 11:17:41 -0400 Subject: [PATCH 4/4] make sure apply sql has the correct env vars set --- bin/finish_setup.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/finish_setup.sh b/bin/finish_setup.sh index 71b8679..74343e9 100755 --- a/bin/finish_setup.sh +++ b/bin/finish_setup.sh @@ -13,7 +13,7 @@ sudo mkdir -p /etc/service/openmanage/supervise sudo ln -s $OPENMANAGE_ROOT/etc/service/openmanage/run /etc/service/openmanage/run sudo sv start openmanage -sudo python $HOME/netkes/upgrade/apply_sql.py +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.