Comments (16)
That config looks good. I think the problem is in the code here:
40 if autodiscover:
41 self.account = Account(
42 primary_smtp_address=config['primary_smtp_address'],
43 credentials=self._credentials,
44 autodiscover=autodiscover,
45 access_type=DELEGATE)
46 else:
47 config = Configuration(
48 server=server,
49 credentials=self._credentials)
50 self.account = Account(
51 primary_smtp_address=config['primary_smtp_address'],
52 config=config,
53 autodiscover=False,
54 access_type=DELEGATE)
The problem starts at line 41. It is re-defining config, which was originally an st2 config object. It redefines it as a Configuration
object from exchangelib. Then on line 51 it tries to retrieve an item from the original config
object, but that no longer exists.
If you have auto discovery enabled, it never goes down this code path, which is probably why other people have not hit this issue (since most people have autodiscover in their Exchange environments).
You could probably do something like this:
--- a/actions/base/action.py
+++ b/actions/base/action.py
@@ -44,12 +44,12 @@ class BaseExchangeAction(Action):
autodiscover=autodiscover,
access_type=DELEGATE)
else:
- config = Configuration(
+ ms_config = Configuration(
server=server,
credentials=self._credentials)
self.account = Account(
primary_smtp_address=config['primary_smtp_address'],
- config=config,
+ config=ms_config,
autodiscover=False,
access_type=DELEGATE)
self._store_cache_configuration()
Can you try making that change locally and see if that helps?
from stackstorm-msexchange.
Also, please open a separate issue about that get_folder_by_name()
deprecation warning. That is something else, related to https://github.com/ecederstrand/exchangelib/blob/master/CHANGELOG.rst#1102
from stackstorm-msexchange.
Bingo ! That one below worked ...
st2 run msexchange.search_items folder=Inbox
Much appreciated
from stackstorm-msexchange.
Double-checking: have you loaded that configuration with sudo st2ctl reload --register-configs
?
from stackstorm-msexchange.
I did, also when I do troubleshooting
$ sudo /opt/stackstorm/st2/bin/st2sensorcontainer --config-file=/etc/st2/st2.conf --sensor-ref=msexchange.ItemSensor
I can see the error below
2018-02-21 15:40:29,548 ERROR [-] /opt/stackstorm/virtualenvs/msexchange/lib/python2.7/site-packages/exchangelib/folders.py:151: UserWarning: The get_folder_by_name() method is deprecated. Use "[f for f in self.walk() if f.name == name]" or "some_folder / 'Sub Folder'" instead, to find folders by name.
from stackstorm-msexchange.
So after reloading the config, actions are still failing with that same TypeError?
Can you try connecting to mongoDB (mongo -u stackstorm -p <password> st2
), and running a query like this:
db.config_d_b.find({"pack":"msexchange"})
Mask out any sensitive results
from stackstorm-msexchange.
Correct , same Typeerror after reload --register-configs, what's the default password to mongo ?
from stackstorm-msexchange.
There is no default password. They are randomly generated if you use the install script. Check your st2.conf to see what your system is using
from stackstorm-msexchange.
oh, here it is
> db.config_d_b.find({"pack":"msexchange"})
{ "_id" : ObjectId("5a8dcbd950140028874da756"), "pack" : "msexchange", "values" : { "primary_smtp_address" : "[email protected]", "username" : "[email protected]", "password" : "password", "server" : "mailserver.common.com", "timezone" : "America/New_York" } }
from stackstorm-msexchange.
Now , after that change I am getting UserWarning: The get_folder_by_name() method is deprecated and then Error: No subfolders found with name None\n"
from stackstorm-msexchange.
That get_folder_by_name()
error is just a deprecation warning at this stage, and can be ignored.
The more important issue is Error: No subfolders found with name None
What is the full command (with parameters) that you're running?
from stackstorm-msexchange.
I tried all below:
st2 run msexchange.search_items
st2 run msexchange.search_items folder=inbox
st2 run msexchange.search_items folder=netpro-reply
st2 run msexchange.search_items [email protected]
always same Error: No subfolders found
from stackstorm-msexchange.
I'm not convinced that the code should work if folder is not specified, but I would have expected something like st2 run msexchange.search_items folder=inbox
to work. What if you use proper case for Inbox
?
I would not expect st2 run msexchange.search_items [email protected]
to work
from stackstorm-msexchange.
Thanks for confirmation. Maybe worth doing a PR to update the README, and possibly to update that action to make folder
a required parameter?
from stackstorm-msexchange.
I tried PR, 'Create pull request' button is not active. Troubleshooting sensor, it is not working despite msexchange.search_items being fine
from stackstorm-msexchange.
from stackstorm-msexchange.
Related Issues (8)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from stackstorm-msexchange.