Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

iris Plan issue #644

Closed
allwyn-pradip opened this issue Oct 19, 2021 · 12 comments
Closed

iris Plan issue #644

allwyn-pradip opened this issue Oct 19, 2021 · 12 comments

Comments

@allwyn-pradip
Copy link
Contributor

allwyn-pradip commented Oct 19, 2021

with the new images, new or existing plans do not get saved.

the error pops up as

Error: Invalid plan - Priority not found for step 1

even when the priority are setup

image

@allwyn-pradip
Copy link
Contributor Author

@diegocepedaw any update what is causing this issue.

@diegocepedaw
Copy link
Collaborator

diegocepedaw commented Nov 8, 2021

@allwyn-pradip unfortunately I have not had much bandwidth recently to look at community issues lately. Do you remember which release version this issue was introduced in? I haven't encountered this issue myself, can you give me more details on your current Iris setup as well?

@allwyn-pradip
Copy link
Contributor Author

allwyn-pradip commented Nov 8, 2021

@diegocepedaw I am at the latest version 1.36 testing it for python3

image

@diegocepedaw
Copy link
Collaborator

diegocepedaw commented Nov 10, 2021

@allwyn-pradip what do you get if you run SELECT name, id FROM target_type in your mysql? That error you linked means Iris didn't find the type user in its cache, and the cache should be pulling the types from the database.

@mohammad-sajid
Copy link

@diegocepedaw the output for the query is fine.
MySQL [iris]> SELECT name, id FROM target_type;
+--------------+----+
| name | id |
+--------------+----+
| mailing-list | 3 |
| team | 2 |
| user | 1 |
+--------------+----+

Also facing the issue Error: Invalid plan - Target NOC-Team not found for step 1.
But we have this team created at oncall DB.
what will be the reason, why its not taking the team names from oncall DB. ?

image

@diegocepedaw
Copy link
Collaborator

Is the sync targets script running and correctly able to git oncall-api?

@mohammad-sajid
Copy link

@diegocepedaw what is the sync target script?
where can I find that oncall-api ?
could you please help here.

@mohammad-sajid
Copy link

@diegocepedaw i saw there is one sync_target.py code is available in srs/iris/bin. executed manually and getting below error. could you please help here.

2022-02-08 11:26:10,489 ERROR root Error syncing from oncall!
Traceback (most recent call last):
File "sync_targets.py", line 786, in main
sync_from_oncall(config, engine)
File "sync_targets.py", line 174, in sync_from_oncall
oncall_users = fetch_users_from_oncall(oncall)
File "sync_targets.py", line 157, in fetch_users_from_oncall
return {user['name']: fix_user_contacts(user['contacts'])
File "sync_targets.py", line 157, in
return {user['name']: fix_user_contacts(user['contacts'])
File "sync_targets.py", line 145, in fix_user_contacts
contacts['sms'] = normalize_phone_number(sms)
File "sync_targets.py", line 77, in normalize_phone_number
return format_number(parse(num, 'US'),
File "/usr/local/lib/python3.8/dist-packages/phonenumbers/phonenumberutil.py", line 2579, in parse
raise NumberParseException(NumberParseException.NOT_A_NUMBER,
phonenumbers.phonenumberutil.NumberParseException: (1) The string supplied did not seem to be a phone number.

@diegocepedaw
Copy link
Collaborator

@mohammad-sajid the sync_targets.py script is what syncs teams and users from oncall-api, you will need this running if you want to automatically have oncal-api teams become available as targets in Iris. If you are running it locally with the make file you should be able to run make targets. Looking out your output it seems that the contact field of the users that are coming from oncall-api do not have valid phone numbers for 'sms' and/or 'call' fields in their contact. I would recommend checking that all your oncall users have validly formatted phone numbers.

@mohammad-sajid
Copy link

Thanks, @diegocepedaw . after verifying user_contact table now am able to sync between the iris and oncall app.

Thanks for your support @diegocepedaw

@bla-ckbox
Copy link

I still encounter the issues discussed above when testing with the master branch commit Version 500822a

  • Error: Invalid plan - Priority not found for step 1 when saving plan
  • Error 400 Target type user not found on /v0/targets/user

sync_targets.py seems to be running fine:

2022-04-05 16:12:44,234 INFO root Sending metrics: failed_tasks: 0, ldap_lists_added: 0, ldap_lists_failed_to_add: 0, ldap_lists_found: 0, ldap_lists_removed: 0, ldap_memberships_added: 0, ldap_memberships_failed_to_add: 0, ldap_memberships_found: 0, ldap_memberships_removed: 0, ldap_reconnects: 0, others_purged: 0, sql_errors: 0, teams_added: 0, teams_failed_to_add: 0, teams_found: 0, user_contacts_updated: 0, users_added: 0, users_failed_to_add: 0, users_failed_to_update: 0, users_found: 0, users_purged: 0
2022-04-05 16:12:44,234 INFO root Starting oncall sync...
2022-04-05 16:12:44,441 INFO root Users to insert (0)
2022-04-05 16:12:44,441 INFO root Users to update (5)
2022-04-05 16:12:44,447 INFO root Teams to insert (0)
2022-04-05 16:12:44,450 INFO root Users to mark inactive (0)
2022-04-05 16:12:44,450 INFO root Teams to mark inactive (0)
2022-04-05 16:12:44,451 INFO root oncall sync took 0.22 seconds

target_type, target, and priority are not empty

mysql> select * from target_type;
+----+--------------+
| id | name         |
+----+--------------+
|  3 | mailing-list |
|  2 | team         |
|  1 | user         |
+----+--------------+
3 rows in set (0.00 sec)

mysql> select * from target;
+----+--------------------------------------+---------+--------+
| id | name                                 | type_id | active |
+----+--------------------------------------+---------+--------+
|  1 | demo                                 |       1 |      0 |
|  4 | b291694f-7789-4436-a5d2-ca37f67b3df3 |       2 |      0 |
|  5 | 8558d07b-b5ae-44c3-b3c0-6f4179e79402 |       2 |      0 |
|  6 | abc                                  |       3 |      1 |
|  7 | demo                                 |       3 |      1 |
|  8 | jp******                             |       1 |      1 |
|  9 | bn*****                              |       1 |      1 |
| 10 | bl******                             |       1 |      1 |
| 11 | cb******                             |       1 |      1 |
| 12 | pr*****                              |       1 |      1 |
| 13 | Di******                             |       2 |      1 |
| 14 | On****                               |       2 |      1 |
+----+--------------------------------------+---------+--------+
12 rows in set (0.00 sec)

mysql> select * from priority;
+----+--------+---------+
| id | name   | mode_id |
+----+--------+---------+
|  8 | urgent |      26 |
| 17 | high   |       8 |
| 26 | medium |      35 |
| 35 | low    |      35 |
+----+--------+---------+
4 rows in set (0.00 sec)

@bilbof
Copy link
Contributor

bilbof commented Apr 11, 2022

I have also hit the same issue.

Steps to reproduce:

  1. Spin up a test instance docker compose up
  2. Login demo:demo at http://localhost:16649
  3. Navigate to http://localhost:16649/plans/new and attempt to create a plan

@allwyn-pradip mentioned that this issue is fixed by #690. I ran those changes locally and found that the issue was fixed, but haven't yet figured out what particular change resolved the bug.

Edit: turns out it was gevent's monkey patching!

bilbof added a commit to bilbof/iris that referenced this issue Apr 11, 2022
The api makes use of [gevent], a coroutine based networking
library which relies heavily on monkey patching the stdlib.

From the [gevent.monkey] docs:
> Warning Patching too late can lead to unreliable behaviour
> (for example, some modules may still use blocking sockets) or even errors.

This appears to have happened here. Thanks to @allwyn-pradip for
pointing me at the right file in PR
linkedin#690.

Resolves linkedin#686, linkedin#699, linkedin#644.

Blog on gevent: https://eng.lyft.com/what-the-heck-is-gevent-4e87db98a8
> In the case of gevent — monkey patching has to be the absolute first thing a process does

[gevent]: https://www.gevent.org/index.html
[gevent.monkey]: https://www.gevent.org/api/gevent.monkey.html
diegocepedaw pushed a commit that referenced this issue Apr 11, 2022
The api makes use of [gevent], a coroutine based networking
library which relies heavily on monkey patching the stdlib.

From the [gevent.monkey] docs:
> Warning Patching too late can lead to unreliable behaviour
> (for example, some modules may still use blocking sockets) or even errors.

This appears to have happened here. Thanks to @allwyn-pradip for
pointing me at the right file in PR
#690.

Resolves #686, #699, #644.

Blog on gevent: https://eng.lyft.com/what-the-heck-is-gevent-4e87db98a8
> In the case of gevent — monkey patching has to be the absolute first thing a process does

[gevent]: https://www.gevent.org/index.html
[gevent.monkey]: https://www.gevent.org/api/gevent.monkey.html
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants