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

Adding a chat-id to whitelist results in purged config.yaml #216

Closed
TildeSlashC0re opened this issue Aug 24, 2018 · 0 comments
Closed

Adding a chat-id to whitelist results in purged config.yaml #216

TildeSlashC0re opened this issue Aug 24, 2018 · 0 comments
Labels
bug: unclassified Something isn't working and it may or may not have worked in the past
Milestone

Comments

@TildeSlashC0re
Copy link

TildeSlashC0re commented Aug 24, 2018

here's a log-excerpt:

cat config.yaml > config-backup.yaml
cat config.yaml 
# Homeserver details
homeserver:
    # The address that this appservice can use to connect to the homeserver.
    address: https://0xbtfd.one
    # The domain of the homeserver (for MXIDs, etc).
    domain: 0xbtfd.one
    # Whether or not to verify the SSL certificate of the homeserver.
    # Only applies if address starts with https://
    verify_ssl: true

# Application service host/registration related details
# Changing these values requires regeneration of the registration.
appservice:
    # The address that the homeserver can use to connect to this appservice.
    address: http://localhost:8080

[...........]

    # Filter rooms that can/can't be bridged. Can also be managed using the `filter` and 
    # `filter-mode` management commands.
    #
    # Filters do not affect direct chats.
    # An empty blacklist will essentially disable the filter.
    filter:
        # Filter mode to use. Either "blacklist" or "whitelist".
        # If the mode is "blacklist", the listed chats will never be bridged.
        # If the mode is "whitelist", only the listed chats can be bridged.
        mode: whitelist
        # The list of group/channel IDs to filter.
        list: []

Then:
filter whitelist -1001225096046

from here there's three possible outcomes

[2018-08-24 02:34:40,606] [[email protected]] Unhandled error while handling command filter whitelist -1001225096046 from @c0re:0xbtfd.one                                                                                                    
Traceback (most recent call last):                                                                                                                                                                                                             
  File "/home/c0re/mautrix-telegram/mautrix_telegram/commands/handler.py", line 172, in handle                                                                                                                                                 
    await command_handler(evt)                                                                                                                                                                                                                 
  File "/home/c0re/mautrix-telegram/mautrix_telegram/commands/handler.py", line 113, in __call__                                                                                                                                               
    return await self._handler(evt)                                                                                                                                                                                                            
  File "/home/c0re/mautrix-telegram/mautrix_telegram/commands/portal.py", line 492, in filter                                                                                                                                                  
    save()                                                                                                                                                                                                                                     
  File "/home/c0re/mautrix-telegram/mautrix_telegram/commands/portal.py", line 485, in save                                                                                                                                                    
    evt.config.save()                                                                                                                                                                                                                          
  File "/home/c0re/mautrix-telegram/mautrix_telegram/config.py", line 118, in save                                                                                                                                                             
    yaml.dump(self._data, stream)                                                                                                                                                                                                              
  File "/home/c0re/mautrix-telegram/.venv/lib/python3.6/site-packages/ruamel/yaml/main.py", line 428, in dump                                                                                                                                  
    return self.dump_all([data], stream, _kw, transform=transform)
  File "/home/c0re/mautrix-telegram/.venv/lib/python3.6/site-packages/ruamel/yaml/main.py", line 442, in dump_all
    self._context_manager.dump(data)
  File "/home/c0re/mautrix-telegram/.venv/lib/python3.6/site-packages/ruamel/yaml/main.py", line 785, in dump
    self._yaml.representer.represent(data)
  File "/home/c0re/mautrix-telegram/.venv/lib/python3.6/site-packages/ruamel/yaml/representer.py", line 79, in represent                                                                                                                      
    node = self.represent_data(data)
  File "/home/c0re/mautrix-telegram/.venv/lib/python3.6/site-packages/ruamel/yaml/representer.py", line 106, in represent_data                                                                                                                
    node = self.yaml_representers[data_types[0]](self, data)
  File "/home/c0re/mautrix-telegram/.venv/lib/python3.6/site-packages/ruamel/yaml/representer.py", line 1089, in represent_dict                                                                                                               
    return self.represent_mapping(tag, data)
  File "/home/c0re/mautrix-telegram/.venv/lib/python3.6/site-packages/ruamel/yaml/representer.py", line 934, in represent_mapping                                                                                                             
    node_value = self.represent_data(item_value)
  File "/home/c0re/mautrix-telegram/.venv/lib/python3.6/site-packages/ruamel/yaml/representer.py", line 106, in represent_data                                                                                                                
    node = self.yaml_representers[data_types[0]](self, data)
  File "/home/c0re/mautrix-telegram/.venv/lib/python3.6/site-packages/ruamel/yaml/representer.py", line 1089, in represent_dict                                                                                                               
    return self.represent_mapping(tag, data)
  File "/home/c0re/mautrix-telegram/.venv/lib/python3.6/site-packages/ruamel/yaml/representer.py", line 934, in represent_mapping                                                                                                             
    node_value = self.represent_data(item_value)
  File "/home/c0re/mautrix-telegram/.venv/lib/python3.6/site-packages/ruamel/yaml/representer.py", line 106, in represent_data                                                                                                                
    node = self.yaml_representers[data_types[0]](self, data)
  File "/home/c0re/mautrix-telegram/.venv/lib/python3.6/site-packages/ruamel/yaml/representer.py", line 1089, in represent_dict                                                                                                               
    return self.represent_mapping(tag, data)
  File "/home/c0re/mautrix-telegram/.venv/lib/python3.6/site-packages/ruamel/yaml/representer.py", line 934, in represent_mapping                                                                                                             
    node_value = self.represent_data(item_value)
  File "/home/c0re/mautrix-telegram/.venv/lib/python3.6/site-packages/ruamel/yaml/representer.py", line 116, in represent_data                                                                                                                
    node = self.yaml_representers[None](self, data)
  File "/home/c0re/mautrix-telegram/.venv/lib/python3.6/site-packages/ruamel/yaml/representer.py", line 386, in represent_undefined                                                                                                           
    raise RepresenterError('cannot represent an object: %s' % data)
ruamel.yaml.representer.RepresenterError: cannot represent an object: <logging.Formatter object at 0x7ff3f765ff28>
./ cat config.yaml
./ 

OR

Telegrambot answers:
That chat is already whitelisted.

this seems to be the case when there are ANY chat-ids defined in the config.yaml. Regardless whether they match or not.

OR

[2018-08-24 02:11:49,915] [[email protected]] Received Matrix event "{'body': 'filter whitelist -1001168676661', 'msgtype': 'm.text'}" from <mautrix_telegram.user.User object at 0x7fab5e9a5f60> in !yRwfJWBDqysqVfBiIX:0xbtfd.one                 
[2018-08-24 02:11:49,917] [[email protected]] GET /rooms/%21yRwfJWBDqysqVfBiIX%3A0xbtfd.one/joined_members {} as user No identity                                                                                                               
[2018-08-24 02:11:49,961] [[email protected]] Unhandled error while handling command filter whitelist -1001168676661 from @c0re:0xbtfd.one                                                                                                    
Traceback (most recent call last):                                                                                                                                                                                                             
  File "/home/c0re/mautrix-telegram/mautrix_telegram/commands/handler.py", line 172, in handle                                                                                                                                                 
    await command_handler(evt)                                                                                                                                                                                                                 
  File "/home/c0re/mautrix-telegram/mautrix_telegram/commands/handler.py", line 113, in __call__
    return await self._handler(evt)
  File "/home/c0re/mautrix-telegram/mautrix_telegram/commands/portal.py", line 492, in filter
    save()
  File "/home/c0re/mautrix-telegram/mautrix_telegram/commands/portal.py", line 485, in save
    evt.config.save()
  File "/home/c0re/mautrix-telegram/mautrix_telegram/config.py", line 118, in save
    yaml.dump(self._data, stream)
  File "/home/c0re/mautrix-telegram/.venv/lib/python3.6/site-packages/ruamel/yaml/main.py", line 424, in dump
    self._context_manager.dump(data)
  File "/home/c0re/mautrix-telegram/.venv/lib/python3.6/site-packages/ruamel/yaml/main.py", line 785, in dump
    self._yaml.representer.represent(data)
  File "/home/c0re/mautrix-telegram/.venv/lib/python3.6/site-packages/ruamel/yaml/representer.py", line 80, in represent                                                                                                                      
    self.serializer.serialize(node)
  File "/home/c0re/mautrix-telegram/.venv/lib/python3.6/site-packages/ruamel/yaml/serializer.py", line 117, in serialize                                                                                                                      
    self.serialize_node(node, None, None)
  File "/home/c0re/mautrix-telegram/.venv/lib/python3.6/site-packages/ruamel/yaml/serializer.py", line 232, in serialize_node                                                                                                                 
    self.serialize_node(value, node, key)
  File "/home/c0re/mautrix-telegram/.venv/lib/python3.6/site-packages/ruamel/yaml/serializer.py", line 231, in serialize_node                                                                                                                 
    self.serialize_node(key, node, None)
  File "/home/c0re/mautrix-telegram/.venv/lib/python3.6/site-packages/ruamel/yaml/serializer.py", line 180, in serialize_node                                                                                                                 
    comment=node.comment,
  File "/home/c0re/mautrix-telegram/.venv/lib/python3.6/site-packages/ruamel/yaml/emitter.py", line 238, in emit
    self.state()
  File "/home/c0re/mautrix-telegram/.venv/lib/python3.6/site-packages/ruamel/yaml/emitter.py", line 378, in expect_document_root                                                                                                              
    self.expect_node(root=True)
  File "/home/c0re/mautrix-telegram/.venv/lib/python3.6/site-packages/ruamel/yaml/emitter.py", line 417, in expect_node
    self.write_pre_comment(self.event)
  File "/home/c0re/mautrix-telegram/.venv/lib/python3.6/site-packages/ruamel/yaml/emitter.py", line 1569, in write_pre_comment                                                                                                                
    self.write_comment(comment)
  File "/home/c0re/mautrix-telegram/.venv/lib/python3.6/site-packages/ruamel/yaml/emitter.py", line 1552, in write_comment                                                                                                                    
    self.stream.write(value)
ValueError: I/O operation on closed file.
[2018-08-24 02:11:50,001] [[email protected]] PUT /rooms/%21yRwfJWBDqysqVfBiIX%3A0xbtfd.one/send/m.room.message/10531535069510001 {"body": "Unhandled error while handling command. Check logs for more details.", "msgtype": "m.notice", "format": "org.matrix.custom.html", "formatted_body": "<p>Unhandled error while handling command. Check logs for more details.</p>", "m.relates_to": null} as user No identity                                                

this seems to be the output for when the config.yaml has been nuked already - as it is the case with the first scenario I've shown.

@tulir tulir added the bug: unclassified Something isn't working and it may or may not have worked in the past label Sep 1, 2018
@tulir tulir added this to the 0.4.0 milestone Sep 1, 2018
@tulir tulir closed this as completed in 29541ff Sep 1, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug: unclassified Something isn't working and it may or may not have worked in the past
Development

No branches or pull requests

2 participants