Giter VIP home page Giter VIP logo

syncthingmanager's Issues

How to accept a folder request?

I have a folder on computer A, which is already synced with computer B and I want it to also sync with computer C. I've added computer C (using computer A) using the syncthing GUI. Now, on computer C, how do I accept (using stman) the request made by computer A?

Basically, I want to say:

"Accept this request, and add the contents of that folder to this path.". How do I do that in stman?

FR: realtime oversight

Hi
I realize that your tool is initially an commandline tool to control syncthing but I feel like it can expand beyond that. I was dreaming about a complimentary syncthing tool that works on the termianl that functions like atop or htop where it shows what is going o with syncthing and files, more like a terminal version of web gui.

Maybe stman can bring this kind of functionality?

thanks

Issue on CentOS 7

Hi,

I get the following when trying to run a device list:

[lyderic@cube ~]$ stman device list
Traceback (most recent call last):
  File "/usr/bin/stman", line 9, in 
    load_entry_point('syncthingmanager==0.1.0', 'console_scripts', 'stman')()
  File "/usr/lib/python3.4/site-packages/syncthingmanager/__init__.py", line 810, in main
    st._device_list()
  File "/usr/lib/python3.4/site-packages/syncthingmanager/__init__.py", line 471, in _device_list
    status = self.system.status()
  File "/usr/lib/python3.4/site-packages/syncthing/__init__.py", line 515, in status
    resp = keys_to_datetime(resp, 'startTime')
  File "/usr/lib/python3.4/site-packages/syncthing/__init__.py", line 125, in keys_to_datetime
    obj[k] = parse_datetime(v)
  File "/usr/lib/python3.4/site-packages/syncthing/__init__.py", line 79, in parse_datetime
    obj = datetime.strptime(s[0:26], date_format)
  File "/usr/lib64/python3.4/_strptime.py", line 507, in _strptime_datetime
    tt, fraction = _strptime(data_string, format)
  File "/usr/lib64/python3.4/_strptime.py", line 347, in _strptime
    data_string[found.end():])
ValueError: unconverted data remains: +01

I am running python 3.4 on CentOS 7. I installed syncthingmanager following the instructions.

My versions:

[lyderic@cube ~]$ syncthing --version
syncthing v0.14.26 "Dysprosium Dragonfly" (go1.8 linux-amd64) [email protected] 2017-03-23 11:04:35 UTC

[lyderic@cube ~]$ pip3 --version
pip 9.0.1 from /usr/lib/python3.4/site-packages (python 3.4)

[lyderic@cube ~]$ python3 --version
Python 3.4.5

[lyderic@cube ~]$ cat /etc/redhat-release 
CentOS Linux release 7.3.1611 (Core) 

[lyderic@cube ~]$ uname -a
Linux cube.lyderic.net 3.10.0-514.10.2.el7.x86_64 #1 SMP Fri Mar 3 00:04:05 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux

My config file:

[lyderic@cube ~]$ cat ~/.config/syncthingmanager/syncthingmanager.conf 
[DEFAULT]
name = localhost

[localhost]
apikey = JFUS.....
hostname = localhost
port = 8384

Thanks for any help,

Lyderic

Add folder on Linux device doesn't work when running stman from Windows

I am running stman on my Windows 10 Laptop. I have a number of Linux devices. Using the Add folder feature to add a directory on the Linux devices doesn't take the proper path.

For example, if i run the below command:
stman --device myhost folder add /develop/syncthing syncthing --label syncthing --foldertype readwrite --rescan-interval 10
On my Linux machine 'myhost' a folder will get added but the path it takes is C:\develop instead of /develop/syncthing

edit folder ignore pattern

It would be great if one could edit a folder's ignore pattern.

Something like

stman folder ignore-patterns FOLDER [PATTERNS]

If PATTERNS is not given, print the patterns to stdout.

If PATTERNS is given, replace the current patterns by PATTERNS

If PATTERNS is -, read patterns from stdin.

Display device completion

Device completion and events didn't work so well in my testing. The problem is that the event we need isn't always there, forcing a guess that isn't consistent with the GUI.

It might be worth trying to look through /rest/db/completion for each folder. Or I could be overlooking something with events.

Normalises folder path locally even for remote device

I'm trying to use stman to add a folder to the remote device, but there, a different path is configured:

% stman -d fishbowl folder add --help -l '~/misc' /home/madduck/misc madduck-misc
% stman -d fishbowl folder info madduck-misc
folder path missing

The problem is that stman resolves symlinks in the path, and home directories on this machine aren't directly under /home:

readlink("/home", 0x7ffd589485d0, 4096) = -1 EINVAL (Invalid argument)
readlink("/home/madduck", "ssd/madduck", 4096) = 11
readlink("/home/ssd", 0x7ffd58948350, 4096) = -1 EINVAL (Invalid argument)
readlink("/home/ssd/madduck", 0x7ffd58948350, 4096) = -1 EINVAL (Invalid argument)
readlink("/home/ssd/madduck/misc", 0x7ffd589485d0, 4096) = -1 EINVAL (Invalid argument)

So if used with a remote device, I don't think the local filesystem should be taken into account.

Please enable fsWatcher for new folders, or make configurable

New folders created by stman are not inotify-enabled. I tried passing fsWatcherEnabled=true to the API call, but that didn't do it. It'd be nice if this were exposed to the command-line, and probably enabled by default, as it's now supported by default.

raise SyncthingError(msg) from exc

When I try stman in anyway I get the error:

Traceback (most recent call last):
File "/home/foobar/.linuxbrew/bin/stman", line 7, in
from syncthingmanager import main
File "/home/foobar/.linuxbrew/Cellar/python@2/2.7.15_1/lib/python2.7/site-packages/syncthingmanager/init.py", line 18, in
from syncthing import Syncthing, SyncthingError
File "/home/foobar/.linuxbrew/Cellar/python@2/2.7.15_1/lib/python2.7/site-packages/syncthing/init.py", line 41
raise SyncthingError(msg) from exc
SyntaxError: invalid syntax

Support for filewatcher

Syncthing now supports filewatcher natively. Does syncthingmanager already support this option?

FR: Support for SSL

Please add support for https. As far as I understood it just needs is_https boolean argument to Synthing constructor.

Raspbian: Max retries exceeded with url error

Hi there

I'm using stman in a raspbian machine:

  1. $uname -sr:
    Linux 4.9.35-v7+

  2. $cat /etc/os-release:
    PRETTY_NAME="Raspbian GNU/Linux 8 (jessie)"
    NAME="Raspbian GNU/Linux"
    VERSION_ID="8"
    VERSION="8 (jessie)"
    ID=raspbian
    ID_LIKE=debian
    HOME_URL="http://www.raspbian.org/"
    SUPPORT_URL="http://www.raspbian.org/RaspbianForums"
    BUG_REPORT_URL="http://www.raspbian.org/RaspbianBugs"

3.$python3:
Python 3.4.2 (default, Oct 19 2014, 13:31:11)
[GCC 4.9.1] on linux

4.$pip --version
pip 9.0.1 from /usr/local/lib/python3.4/dist-packages/pip-9.0.1-py3.4.egg (python 3.4)

5.$syncthing --version
syncthing v0.14.33 "Dysprosium Dragonfly" (go1.8.3 linux-arm) deb@9b8983e226ea
2017-07-13 06:55:12 UTC [noupgrade]

Everytime i try any stman command i got this error:

HTTPConnectionPool(host='localhost', port=8384): Max retries exceeded with url: /rest/system/config (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7615d4b0>: Failed to establish a new connection: [Errno 111] Connection refused',))
Traceback (most recent call last):
File "/usr/local/lib/python3.4/dist-packages/urllib3/connection.py", line 141, in _new_conn
(self.host, self.port), self.timeout, **extra_kw)
File "/usr/local/lib/python3.4/dist-packages/urllib3/util/connection.py", line 83, in create_connection
raise err
File "/usr/local/lib/python3.4/dist-packages/urllib3/util/connection.py", line 73, in create_connection
sock.connect(sa)
ConnectionRefusedError: [Errno 111] Connection refused

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/usr/local/lib/python3.4/dist-packages/urllib3/connectionpool.py", line 601, in urlopen
chunked=chunked)
File "/usr/local/lib/python3.4/dist-packages/urllib3/connectionpool.py", line 357, in _make_request
conn.request(method, url, **httplib_request_kw)
File "/usr/lib/python3.4/http/client.py", line 1090, in request
self._send_request(method, url, body, headers)
File "/usr/lib/python3.4/http/client.py", line 1128, in _send_request
self.endheaders(body)
File "/usr/lib/python3.4/http/client.py", line 1086, in endheaders
self._send_output(message_body)
File "/usr/lib/python3.4/http/client.py", line 924, in _send_output
self.send(msg)
File "/usr/lib/python3.4/http/client.py", line 859, in send
self.connect()
File "/usr/local/lib/python3.4/dist-packages/urllib3/connection.py", line 166, in connect
conn = self._new_conn()
File "/usr/local/lib/python3.4/dist-packages/urllib3/connection.py", line 150, in _new_conn
self, "Failed to establish a new connection: %s" % e)
urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPConnection object at 0x7615d4b0>: Failed to establish a new connection: [Errno 111] Connection refused

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/usr/local/lib/python3.4/dist-packages/requests/adapters.py", line 440, in send
timeout=timeout
File "/usr/local/lib/python3.4/dist-packages/urllib3/connectionpool.py", line 639, in urlopen
_stacktrace=sys.exc_info()[2])
File "/usr/local/lib/python3.4/dist-packages/urllib3/util/retry.py", line 388, in increment
raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='localhost', port=8384): Max retries exceeded with url: /rest/system/config (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7615d4b0>: Failed to establish a new connection: [Errno 111] Connection refused',))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/usr/local/lib/python3.4/dist-packages/syncthing/init.py", line 200, in _request
headers=headers
File "/usr/local/lib/python3.4/dist-packages/requests/api.py", line 58, in request
return session.request(method=method, url=url, **kwargs)
File "/usr/local/lib/python3.4/dist-packages/requests/sessions.py", line 508, in request
resp = self.send(prep, **send_kwargs)
File "/usr/local/lib/python3.4/dist-packages/requests/sessions.py", line 618, in send
r = adapter.send(request, **kwargs)
File "/usr/local/lib/python3.4/dist-packages/requests/adapters.py", line 508, in send
raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPConnectionPool(host='localhost', port=8384): Max retries exceeded with url: /rest/system/config (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7615d4b0>: Failed to establish a new connection: [Errno 111] Connection refused',))
HTTPConnectionPool(host='localhost', port=8384): Max retries exceeded with url: /rest/system/config (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7615d4b0>: Failed to establish a new connection: [Errno 111] Connection refused',))

Thanks in advance

device list and folder list crash

Traceback for stman device list:

Traceback (most recent call last):
  File "/usr/bin/stman", line 11, in <module>
    load_entry_point('syncthingmanager==0.1.0', 'console_scripts', 'stman')()
  File "/usr/lib/python3.6/site-packages/syncthingmanager/__init__.py", line 810, in main
    st._device_list()
  File "/usr/lib/python3.6/site-packages/syncthingmanager/__init__.py", line 469, in _device_list
    config = self.system.config()
  File "/usr/lib/python3.6/site-packages/syncthing/__init__.py", line 279, in config
    return self.get('config')
  File "/usr/lib/python3.6/site-packages/syncthing/__init__.py", line 180, in get
    return_response, raw_exceptions)
  File "/usr/lib/python3.6/site-packages/syncthing/__init__.py", line 250, in _request
    if isinstance(json_data, dict) and j.get('error'):
NameError: name 'j' is not defined

Traceback for stman folder list:

Traceback (most recent call last):
  File "/usr/bin/stman", line 11, in <module>
    load_entry_point('syncthingmanager==0.1.0', 'console_scripts', 'stman')()
  File "/usr/lib/python3.6/site-packages/syncthingmanager/__init__.py", line 861, in main
    st._folder_list()
  File "/usr/lib/python3.6/site-packages/syncthingmanager/__init__.py", line 566, in _folder_list
    config = self.system.config()
  File "/usr/lib/python3.6/site-packages/syncthing/__init__.py", line 279, in config
    return self.get('config')
  File "/usr/lib/python3.6/site-packages/syncthing/__init__.py", line 180, in get
    return_response, raw_exceptions)
  File "/usr/lib/python3.6/site-packages/syncthing/__init__.py", line 250, in _request
    if isinstance(json_data, dict) and j.get('error'):
NameError: name 'j' is not defined

It is the first time I'm using syncthingmanager. I could use it only since python-syncthing was upgraded to 2.2.0 because of blakev/python-syncthing#18.

From my pour knowledge in python, this is a problem with python-syncthing, I just thought it should be reported here because I don't know how to reproduce it without syncthingmanager.

A few comments on the CLI syntax

Hello @classicsc,

I'm building ZSH completion for stman and since I've covered all of the sub-commands and their sub-commands etc. , I have a few enhancements suggestions:

device vs server terminology

Currently, there is a global flag called --device which chooses the device configured in syncthingmanager's configuration file. It seems it would have been better to call rename it to --server so it won't be confused with device related commands?

Editing folders

I've noticed that there is both the stman folder edit command and stman folder versioning command. Both of these commands seem to use SyncthingManager.folder_edit so perhaps it would have been better to put everything under another subparser? I think this would could be more consistent with the structure of the whole XML file that is actually used in the API calls.

Undocumented / missing extra parameters for stman folder versioning:

In addition to the previous topic, some versioning options have additional arguments. According to my tests only the external versioning scheme works when an additional argument (the external command) is provided. Providing any additional argument for the simple or the staggered versioning schemes is not supported and certain default values are used instead.

I'd be happy to know your opinion because I'd like to contribute fixes to these issues. I have a few other suggestions not covered here that might contribute as well but most importantly, aid when it'll be time for the ZSH completion to be submitted, depending on your approval.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.