Giter VIP home page Giter VIP logo

phabfive's People

Contributors

dependabot-preview[bot] avatar grokzen avatar holmboe avatar maiyuki avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

grokzen d0wn10ad

phabfive's Issues

"No such file or directory" when executing in removed directory

Environment

  • Python version: 3.6.9
  • Phabfive version: 0.1.0

Steps to Reproduce

  1. cd into a directory in one shell
  2. rmdir that same directory in another shell
  3. Execute phabfive K1 in the first shell
Traceback (most recent call last):
  File "/home/nn/profile/bin/phabfive", line 11, in <module>
    load_entry_point('phabfive', 'console_scripts', 'phabfive')()
  File "/home/nn/.virtualenvs/phabfive-kOPdHCq0/lib/python3.6/site-packages/pkg_resources/__init__.py", line 480, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "/home/nn/.virtualenvs/phabfive-kOPdHCq0/lib/python3.6/site-packages/pkg_resources/__init__.py", line 2693, in load_entry_point
    return ep.load()
  File "/home/nn/.virtualenvs/phabfive-kOPdHCq0/lib/python3.6/site-packages/pkg_resources/__init__.py", line 2324, in load
    return self.resolve()
  File "/home/nn/.virtualenvs/phabfive-kOPdHCq0/lib/python3.6/site-packages/pkg_resources/__init__.py", line 2330, in resolve
    module = __import__(self.module_name, fromlist=['__name__'], level=0)
  File "/home/nn/code/dynamist/phabfive/master/phabfive/cli.py", line 10, in <module>
    from phabfive import passphrase, diffusion, paste, user
  File "/home/nn/code/dynamist/phabfive/master/phabfive/passphrase.py", line 9, in <module>
    from phabfive.core import Phabfive
  File "/home/nn/code/dynamist/phabfive/master/phabfive/core.py", line 18, in <module>
    from phabricator import Phabricator, APIError
  File "/home/nn/.virtualenvs/phabfive-kOPdHCq0/lib/python3.6/site-packages/phabricator/__init__.py", line 35, in <module>
    CURRENT_DIR = os.getcwd()
FileNotFoundError: [Errno 2] No such file or directory

Schema

none

Data

none

Expected Behavior

It should execute properly, or at least give a proper error message.

Observed Behavior

Got a traceback.

Create Snap package

Proposed Functionality

Snap packages is a new way of packaging applications into self contained packages very easily.

For reference and implementation help see https://snapcraft.io/

Connection refused exception in diffusion module

Environment

  • Python version: 3.6
  • Phabfive version: 0.1.0

Steps to Reproduce

$ PHAB_URL=http://127.0.0.1/api/ phabfive diffusion repo list
Traceback (most recent call last):
  File "/home/mai/.virtualenvs/phabfive-github/bin/phabfive", line 11, in <module>
    load_entry_point('phabfive', 'console_scripts', 'phabfive')()
  File "/home/mai/phabfive-github/phabfive/cli.py", line 176, in cli_entrypoint
    sys.exit(run(cli_args, sub_args))
  File "/home/mai/phabfive-github/phabfive/cli.py", line 139, in run
    d = diffusion.Diffusion()
  File "/home/mai/phabfive-github/phabfive/diffusion.py", line 17, in __init__
    super(Diffusion, self).__init__()
  File "/home/mai/phabfive-github/phabfive/core.py", line 77, in __init__
    self.verify_connection()
  File "/home/mai/phabfive-github/phabfive/core.py", line 83, in verify_connection
    result = self.phab.user.whoami()
  File "/home/mai/.virtualenvs/phabfive-github/local/lib/python2.7/site-packages/phabricator/__init__.py", line 248, in __call__
    return self._request(**kwargs)
  File "/home/mai/.virtualenvs/phabfive-github/local/lib/python2.7/site-packages/phabricator/__init__.py", line 308, in _request
    conn.request('POST', path, body, headers)
  File "/usr/lib/python2.7/httplib.py", line 1042, in request
    self._send_request(method, url, body, headers)
  File "/usr/lib/python2.7/httplib.py", line 1082, in _send_request
    self.endheaders(body)
  File "/usr/lib/python2.7/httplib.py", line 1038, in endheaders
    self._send_output(message_body)
  File "/usr/lib/python2.7/httplib.py", line 882, in _send_output
    self.send(msg)
  File "/usr/lib/python2.7/httplib.py", line 844, in send
    self.connect()
  File "/usr/lib/python2.7/httplib.py", line 821, in connect
    self.timeout, self.source_address)
  File "/usr/lib/python2.7/socket.py", line 575, in create_connection
    raise err
socket.error: [Errno 111] Connection refused

Expected Behavior

Better wrapped exception

Observed Behavior

Badly wrapped exception

Wrap 404 errors when connecting to wrong server in better exception

Environment

  • Python version: 3.6
  • Phabfive version: 0.1.0

Steps to Reproduce

$ PHAB_URL=http://google.se/api/ phabfive diffusion repo list
Traceback (most recent call last):
  File "/home/mai/.virtualenvs/phabfive-github/bin/phabfive", line 11, in <module>
    load_entry_point('phabfive', 'console_scripts', 'phabfive')()
  File "/home/mai/phabfive-github/phabfive/cli.py", line 176, in cli_entrypoint
    sys.exit(run(cli_args, sub_args))
  File "/home/mai/phabfive-github/phabfive/cli.py", line 139, in run
    d = diffusion.Diffusion()
  File "/home/mai/phabfive-github/phabfive/diffusion.py", line 17, in __init__
    super(Diffusion, self).__init__()
  File "/home/mai/phabfive-github/phabfive/core.py", line 77, in __init__
    self.verify_connection()
  File "/home/mai/phabfive-github/phabfive/core.py", line 83, in verify_connection
    result = self.phab.user.whoami()
  File "/home/mai/.virtualenvs/phabfive-github/local/lib/python2.7/site-packages/phabricator/__init__.py", line 248, in __call__
    return self._request(**kwargs)
  File "/home/mai/.virtualenvs/phabfive-github/local/lib/python2.7/site-packages/phabricator/__init__.py", line 314, in _request
    'Bad response status: {0}'.format(response.status)
httplib.HTTPException: Bad response status: 404

Expected Behavior

Better wrapped exception

Observed Behavior

Bad wrapped exception

Create new command "maniphest create" to allow for bulk ticket create

Proposed Functionality

Create a new command "maniphest create" that takes a yaml config file as input that enables to create multiple tickets at one time. It also gives the ability to render the tickets with variables and with Jinja2 to allow for complex logic like for loops, if/else cases etc.

Differentiate between hidden and visible URIs

Environment

  • Phabfive version:
  • Python version:

Proposed Functionality

Phabfive currently does not make a difference between hidden and visible URIs.

$ phabfive diffusion uri list kubespray
[email protected]:dynamist/kubespray.git
ssh://.../dynamist/kubespray.git
ssh://.../dynamist/kubespray_b.git

Suggested new cli behaviour

$ phabfive diffusion uri list kubespray
[email protected]:dynamist/kubespray.git

$ phabfive diffusion uri list hidden kubespray
ssh://.../dynamist/kubespray.git
ssh://.../dynamist/kubespray_b.git

Suggested docopt: phabfive diffusion uri list [(visible || hidden || all)] <repo> [options]

Examples might not be exact replicas of suggested input/output.

Use Case

Other?

None

SSL operation timeout

Environment

  • Python version: 3.6
  • Phabfive version: 0.1.0

Steps to Reproduce

Given the following exception below

~ » phabfive passphrase K32                                                                                            mai@maiThinkPad
Traceback (most recent call last):
  File "/home/mai/.virtualenvs/phabfive/bin/phabfive", line 11, in <module>
    load_entry_point('phabfive', 'console_scripts', 'phabfive')()
  File "/home/mai/dynamist/phabfive/phabfive/cli.py", line 278, in cli_entrypoint
    sys.exit(run(cli_args, sub_args))
  File "/home/mai/dynamist/phabfive/phabfive/cli.py", line 170, in run
    p.print_secret(sub_args["<id>"])
  File "/home/mai/dynamist/phabfive/phabfive/passphrase.py", line 59, in print_secret
    secret = self.get_secret(ids)
  File "/home/mai/dynamist/phabfive/phabfive/passphrase.py", line 34, in get_secret
    response = self.phab.passphrase.query(ids=[ids], needSecrets=1)
  File "/home/mai/.virtualenvs/phabfive/lib/python3.6/site-packages/phabricator/__init__.py", line 248, in __call__
    return self._request(**kwargs)
  File "/home/mai/.virtualenvs/phabfive/lib/python3.6/site-packages/phabricator/__init__.py", line 308, in _request
    conn.request('POST', path, body, headers)
  File "/usr/lib/python3.6/http/client.py", line 1254, in request
    self._send_request(method, url, body, headers, encode_chunked)
  File "/usr/lib/python3.6/http/client.py", line 1300, in _send_request
    self.endheaders(body, encode_chunked=encode_chunked)
  File "/usr/lib/python3.6/http/client.py", line 1249, in endheaders
    self._send_output(message_body, encode_chunked=encode_chunked)
  File "/usr/lib/python3.6/http/client.py", line 1036, in _send_output
    self.send(msg)
  File "/usr/lib/python3.6/http/client.py", line 974, in send
    self.connect()
  File "/usr/lib/python3.6/http/client.py", line 1415, in connect
    server_hostname=server_hostname)
  File "/usr/lib/python3.6/ssl.py", line 407, in wrap_socket
    _context=self, _session=session)
  File "/usr/lib/python3.6/ssl.py", line 817, in __init__
    self.do_handshake()
  File "/usr/lib/python3.6/ssl.py", line 1077, in do_handshake
    self._sslobj.do_handshake()
  File "/usr/lib/python3.6/ssl.py", line 689, in do_handshake
    self._sslobj.do_handshake()
socket.timeout: _ssl.c:835: The handshake operation timed out

Expected Behavior

Better formatted exception.

Observed Behavior

Bad formatted exception printed to enduser

Proposal for fields output from diffusion list

Proposed Functionality

Background: The default for phabfive diffusion list is to print the name field.

Objective: Allow to specify fields of interest. An example:

phabfive diffusion list --fields name,url,type

Where the fields could map directly to data returned by the Phabricator API, but not necessarily, for example the url field would have to be assembled from various data from the API.

  • name -- same as repository['fields']['name']
  • url -- built from the above name plus a prefix and suffix
  • type -- same as repository['fields']['vcs']

The output would be something similar to this:

$ phabfive diffusion list --fields url,type
ssh://[email protected]/source/phabfive.git,git
ssh://[email protected]/source/unifik.git,git

For now we will focus on CSV compliant output, JSON and/or YAML is not in scope.


(This section was suggested by @rholmboe)

OpenStack actually perfected it imho

This is the default output in the cli, which is for all modules (network, server, floating etc etc)

(openstack) $ git:(master) openstack network list -f table
+--------------------------------------+---------+----------------------------------------------------------------------------+
| ID                                   | Name    | Subnets                                                                    |
+--------------------------------------+---------+----------------------------------------------------------------------------+
| 42f2071d-273f-4445-b981-dd05776422ed | private | ae7bdddb-5c99-46f8-bab1-25efab1cba42                                       |
| 7b6935ef-4a13-41d1-b8fa-087927cb480b | public  | 1993b658-8cf1-421a-a93f-e2de7b5dd06a, 5151480f-ae04-4619-b36f-3bdcc4de5342 |
+--------------------------------------+---------+----------------------------------------------------------------------------+

in yaml

(openstack) $ git:(master) openstack network list -c ID -c Subnets -f yaml
- ID: 42f2071d-273f-4445-b981-dd05776422ed
  Subnets: ae7bdddb-5c99-46f8-bab1-25efab1cba42
- ID: 7b6935ef-4a13-41d1-b8fa-087927cb480b
  Subnets: 1993b658-8cf1-421a-a93f-e2de7b5dd06a, 5151480f-ae04-4619-b36f-3bdcc4de5342

in csv

(openstack) $ git:(master) openstack network list -f csv
"ID","Name","Subnets"
"42f2071d-273f-4445-b981-dd05776422ed","private","ae7bdddb-5c99-46f8-bab1-25efab1cba42"
"7b6935ef-4a13-41d1-b8fa-087927cb480b","public","1993b658-8cf1-421a-a93f-e2de7b5dd06a, 5151480f-ae04-4619-b36f-3bdcc4de5342"

in json

(openstack) $ git:(master) openstack network list -c Name -c Subnets -f json
[
  {
    "Subnets": "ae7bdddb-5c99-46f8-bab1-25efab1cba42", 
    "Name": "private"
  }, 
  {
    "Subnets": "1993b658-8cf1-421a-a93f-e2de7b5dd06a, 5151480f-ae04-4619-b36f-3bdcc4de5342", 
    "Name": "public"
  }
]

Just the values

(openstack) $ git:(master) openstack network list -c ID -f value
42f2071d-273f-4445-b981-dd05776422ed
7b6935ef-4a13-41d1-b8fa-087927cb480b

From the helper

output formatters:
  output formatter options

  -f {csv,json,table,value,yaml}, --format {csv,json,table,value,yaml}
                        the output format, defaults to table
  -c COLUMN, --column COLUMN
                        specify the column(s) to include, can be repeated
  --sort-column SORT_COLUMN
                        specify the column(s) to sort the data (columns
                        specified first have a priority, non-existing columns
                        are ignored), can be repeated

Wrap "name of service not known" exception in better exception

Environment

  • Python version:
  • Phabfive version:

Steps to Reproduce

## When running this

$ phabfive diffusion list inactive

Traceback (most recent call last):
  File "/home/nn/.virtualenvs/phabfive-kOPdHCq0/bin/phabfive", line 11, in <module>
    load_entry_point('phabfive', 'console_scripts', 'phabfive')()
  File "/home/nn/code/phabfive/phabfive/cli.py", line 119, in cli_entrypoint
    run(cli_args, sub_args)
  File "/home/nn/code/phabfive/phabfive/cli.py", line 103, in run
    print(p.print_secret(p.get_secret(sub_args['<id>'])))
  File "/home/nn/code/phabfive/phabfive/passphrase.py", line 33, in get_secret
    response = self.phab.passphrase.query(ids=[ids], needSecrets=1)
  File "/home/nn/.virtualenvs/phabfive-kOPdHCq0/lib/python3.6/site-packages/phabricator/__init__.py", line 248, in __call__
    return self._request(**kwargs)
  File "/home/nn/.virtualenvs/phabfive-kOPdHCq0/lib/python3.6/site-packages/phabricator/__init__.py", line 308, in _request
    conn.request('POST', path, body, headers)
  File "/usr/lib/python3.6/http/client.py", line 1239, in request
    self._send_request(method, url, body, headers, encode_chunked)
  File "/usr/lib/python3.6/http/client.py", line 1285, in _send_request
    self.endheaders(body, encode_chunked=encode_chunked)
  File "/usr/lib/python3.6/http/client.py", line 1234, in endheaders
    self._send_output(message_body, encode_chunked=encode_chunked)
  File "/usr/lib/python3.6/http/client.py", line 1026, in _send_output
    self.send(msg)
  File "/usr/lib/python3.6/http/client.py", line 964, in send
    self.connect()
  File "/usr/lib/python3.6/http/client.py", line 1392, in connect
    super().connect()
  File "/usr/lib/python3.6/http/client.py", line 936, in connect
    (self.host,self.port), self.timeout, self.source_address)
  File "/usr/lib/python3.6/socket.py", line 704, in create_connection
    for res in getaddrinfo(host, port, 0, SOCK_STREAM):
  File "/usr/lib/python3.6/socket.py", line 745, in getaddrinfo
    for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno -2] Name or service not known

Expected Behavior

A bettter and wrapped exception to be presented to the user.

Observed Behavior

A low level exception was raised to the user

Phabricator url including a port do not work

Environment

  • Python version: 3.10.x
  • Phabfive version: latest master version

Steps to Reproduce

When developing code, i stumbled upon this that when i export a development phabricator url including a port number, it fails a validation step that it should not fail on. We assume that in our regex checks that we have specified a valid URL instead of just trying the URL no matter what it is and letting it fail.

export PHAB_URL=http://phabricator.domain.tld:81/api/

Result: PHAB_URL is malformed, example: http://127.0.0.1/api/

Possible solution to this problem is to either remove the regex check, implement port checking in the regex, change from regex validation to be a requests/curl validation instead

Exception timeout in passphrase module

Environment

  • Python version: 3.6
  • Phabfive version: 0.1.0

Steps to Reproduce

(phabfive-kOPdHCq0) ~/c/d/phabfive ❯❯❯ PHABFIVE_DEBUG=1 phabfive passphrase K30
INFO:phabfive.controller:Loglevel is: DEBUG
DEBUG:phabfive.controller:Loading configuration defaults
DEBUG:phabfive.controller:Loading configuration file: /etc/phabfive.yaml
DEBUG:phabfive.controller:Loading configuration files: /etc/phabfive.d/*.yaml
DEBUG:phabfive.controller:Loading configuration file: /home/nn/.config/phabfive.yaml
DEBUG:phabfive.controller:Loading configuration files: /home/nn/.config/phabfive.d/*.yaml
DEBUG:phabfive.controller:Loading configuration from environment
DEBUG:phabfive.controller:PHABFIVE_DEBUG ........ 1
DEBUG:phabfive.controller:PHAB_TOKEN ............ cli-y...
DEBUG:phabfive.controller:PHAB_URL .............. https://.../api/
DEBUG:phabfive.controller:Controller for https://....com/api/
Traceback (most recent call last):
  File "/home/nn/.virtualenvs/phabfive-kOPdHCq0/bin/phabfive", line 11, in <module>
    load_entry_point('phabfive', 'console_scripts', 'phabfive')()
  File "/home/nn/code/phabfive/phabfive/cli.py", line 153, in cli_entrypoint
    sys.exit(run(cli_args, sub_args))
  File "/home/nn/code/phabfive/phabfive/cli.py", line 116, in run
    c = Controller()
  File "/home/nn/code/phabfive/phabfive/controller.py", line 78, in __init__
    self.passphrase = passphrase.Passphrase(self.conf)
  File "/home/nn/code/phabfive/phabfive/passphrase.py", line 23, in __init__
    self.verify_connection()
  File "/home/nn/code/phabfive/phabfive/interface.py", line 17, in verify_connection
    result = self.phab.user.whoami()
  File "/home/nn/.virtualenvs/phabfive-kOPdHCq0/lib/python3.6/site-packages/phabricator/__init__.py", line 248, in __call__
    return self._request(**kwargs)
  File "/home/nn/.virtualenvs/phabfive-kOPdHCq0/lib/python3.6/site-packages/phabricator/__init__.py", line 308, in _request
    conn.request('POST', path, body, headers)
  File "/usr/lib/python3.6/http/client.py", line 1239, in request
    self._send_request(method, url, body, headers, encode_chunked)
  File "/usr/lib/python3.6/http/client.py", line 1285, in _send_request
    self.endheaders(body, encode_chunked=encode_chunked)
  File "/usr/lib/python3.6/http/client.py", line 1234, in endheaders
    self._send_output(message_body, encode_chunked=encode_chunked)
  File "/usr/lib/python3.6/http/client.py", line 1026, in _send_output
    self.send(msg)
  File "/usr/lib/python3.6/http/client.py", line 964, in send
    self.connect()
  File "/usr/lib/python3.6/http/client.py", line 1392, in connect
    super().connect()
  File "/usr/lib/python3.6/http/client.py", line 936, in connect
    (self.host,self.port), self.timeout, self.source_address)
  File "/usr/lib/python3.6/socket.py", line 724, in create_connection
    raise err
  File "/usr/lib/python3.6/socket.py", line 713, in create_connection
    sock.connect(sa)
socket.timeout: timed out
Traceback (most recent call last):
  File "/home/nn/profile/bin/phabfive", line 11, in <module>
    load_entry_point('phabfive', 'console_scripts', 'phabfive')()
  File "/home/nn/code/phabfive-github/phabfive/cli.py", line 198, in cli_entrypoint
    sys.exit(run(cli_args, sub_args))
  File "/home/nn/code/phabfive-github/phabfive/cli.py", line 152, in run
    p.print_secret(sub_args["<id>"])
  File "/home/nn/code/phabfive-github/phabfive/passphrase.py", line 50, in print_secret
    secret = self.get_secret(ids)
  File "/home/nn/code/phabfive-github/phabfive/passphrase.py", line 34, in get_secret
    response = self.phab.passphrase.query(ids=[ids], needSecrets=1)
  File "/home/nn/.virtualenvs/phabfive-kOPdHCq0/lib/python3.6/site-packages/phabricator/__init__.py", line 248, in __call__
    return self._request(**kwargs)
  File "/home/nn/.virtualenvs/phabfive-kOPdHCq0/lib/python3.6/site-packages/phabricator/__init__.py", line 308, in _request
    conn.request('POST', path, body, headers)
  File "/usr/lib/python3.6/http/client.py", line 1254, in request
    self._send_request(method, url, body, headers, encode_chunked)
  File "/usr/lib/python3.6/http/client.py", line 1300, in _send_request
    self.endheaders(body, encode_chunked=encode_chunked)
  File "/usr/lib/python3.6/http/client.py", line 1249, in endheaders
    self._send_output(message_body, encode_chunked=encode_chunked)
  File "/usr/lib/python3.6/http/client.py", line 1036, in _send_output
    self.send(msg)
  File "/usr/lib/python3.6/http/client.py", line 974, in send
    self.connect()
  File "/usr/lib/python3.6/http/client.py", line 1415, in connect
    server_hostname=server_hostname)
  File "/usr/lib/python3.6/ssl.py", line 407, in wrap_socket
    _context=self, _session=session)
  File "/usr/lib/python3.6/ssl.py", line 817, in __init__
    self.do_handshake()
  File "/usr/lib/python3.6/ssl.py", line 1077, in do_handshake
    self._sslobj.do_handshake()
  File "/usr/lib/python3.6/ssl.py", line 689, in do_handshake
    self._sslobj.do_handshake()
socket.timeout: _ssl.c:835: The handshake operation timed out

Expected Behavior

Better formatted exception

Observed Behavior

Bad formatted exception

Avoid leaking secrets

Proposed Functionality

Protect your secrets using Gitleaks-Action.

Use Case

Gitleaks is a SAST tool for detecting and preventing hardcoded secrets like passwords, API keys, and tokens in git repos.

python-anyconfig 0.12.x introduces backward incompatible handling of ignore_missing

Environment

  • Python version: 3.8.10
  • Phabfive version: 0.1.0 (latest)

Steps to Reproduce

  1. Clone master branch from GH
  2. pipenv install -e .
  3. Try to execute phabfive K1 and watch it error out

Expected Behavior

It to return the K1 passphrase.

Observed Behavior

Traceback (most recent call last):
  File "/home/nn/code/github.com/dynamist/phabfive/.venv/bin/phabfive", line 11, in <module>
    load_entry_point('phabfive', 'console_scripts', 'phabfive')()
  File "/home/nn/code/github.com/dynamist/phabfive/phabfive/cli.py", line 278, in cli_entrypoint
    sys.exit(run(cli_args, sub_args))
  File "/home/nn/code/github.com/dynamist/phabfive/phabfive/cli.py", line 169, in run
    p = passphrase.Passphrase()
  File "/home/nn/code/github.com/dynamist/phabfive/phabfive/passphrase.py", line 22, in __init__
    super(Passphrase, self).__init__()
  File "/home/nn/code/github.com/dynamist/phabfive/phabfive/core.py", line 50, in __init__
    self.conf = self.load_config()
  File "/home/nn/code/github.com/dynamist/phabfive/phabfive/core.py", line 114, in load_config
    anyconfig.load(site_conf_file, ignore_missing=True)
  File "/home/nn/code/github.com/dynamist/phabfive/.venv/lib/python3.8/site-packages/anyconfig/api/_load.py", line 295, in load
    return single_load(iois[0], ac_parser=ac_parser, ac_dict=ac_dict,
  File "/home/nn/code/github.com/dynamist/phabfive/.venv/lib/python3.8/site-packages/anyconfig/api/_load.py", line 146, in single_load
    cnf = _single_load(ioi, ac_parser=ac_parser, ac_template=ac_template,
  File "/home/nn/code/github.com/dynamist/phabfive/.venv/lib/python3.8/site-packages/anyconfig/api/_load.py", line 86, in _single_load
    return psr.load(ioi, **options)
  File "/home/nn/code/github.com/dynamist/phabfive/.venv/lib/python3.8/site-packages/anyconfig/backend/base/loaders.py", line 208, in load
    cnf = self.load_from_path(ioi.path, container, **options)
  File "/home/nn/code/github.com/dynamist/phabfive/.venv/lib/python3.8/site-packages/anyconfig/backend/base/loaders.py", line 289, in load_from_path
    with self.ropen(filepath) as inp:
  File "/home/nn/code/github.com/dynamist/phabfive/.venv/lib/python3.8/site-packages/anyconfig/backend/base/loaders.py", line 74, in ropen
    return open(  # pylint: disable=consider-using-with
FileNotFoundError: [Errno 2] No such file or directory: '/etc/phabfive.yaml'

Implement repo observe and mirror commands

Environment

  • Phabfive version: 0.1.0
  • Python version: 3.6

Proposed Functionality

$ phabfive diffusion uri list observed myrepo
[email protected]:dynamist/myrepo.git
$ phabfive diffusion uri list mirrored phabfive
https://github.com/dynamist/phabfive.git

Suggested docopt:
phabfive diffusion uri list [(mirrored || observed || all)] <repo> [options]

Use Case

Support the features/commands

Other?

None

Add schema validation to anyconfig data

Environment

  • Phabfive version: latest
  • Python version: 3.x

Proposed Functionality

Add json schema validation to the internal data/config that is using anyconfig to build the config file based on files on disk.

https://python-anyconfig.readthedocs.io/en/latest/usage.html#validation-with-and-or-generate-json-schema

An example/WIP schema.yaml:

type: object
properties:
  PHABFIVE_DEBUG: {type: boolean}
  PHAB_TOKEN: {type: string}
  PHAB_URL: {type: string}

Use Case

None

Other?

None

504 Exception on unreachable server

Environment

  • Python version: 3.6
  • Phabfive version: Git hash 67399d1

Steps to Reproduce

  1. Setup a phabricator instance
  2. Make the instance not accessible or connectable (Shut it down for example)
  3. Run phabfive K32
$ phabfive K32
Traceback (most recent call last):
  File "/home/nn/profile/bin/phabfive", line 11, in <module>
    load_entry_point('phabfive', 'console_scripts', 'phabfive')()
  File "/home/nn/code/phabfive-github/phabfive/cli.py", line 184, in cli_entrypoint
    sys.exit(run(cli_args, sub_args))
  File "/home/nn/code/phabfive-github/phabfive/cli.py", line 139, in run
    p = passphrase.Passphrase()
  File "/home/nn/code/phabfive-github/phabfive/passphrase.py", line 22, in __init__
    super(Passphrase, self).__init__()
  File "/home/nn/code/phabfive-github/phabfive/core.py", line 77, in __init__
    self.verify_connection()
  File "/home/nn/code/phabfive-github/phabfive/core.py", line 83, in verify_connection
    result = self.phab.user.whoami()
  File "/home/nn/.virtualenvs/phabfive-kOPdHCq0/lib/python3.6/site-packages/phabricator/__init__.py", line 248, in __call__
    return self._request(**kwargs)
  File "/home/nn/.virtualenvs/phabfive-kOPdHCq0/lib/python3.6/site-packages/phabricator/__init__.py", line 314, in _request
    'Bad response status: {0}'.format(response.status)
http.client.HTTPException: Bad response status: 504

Implement remove of uri

Environment

  • Phabfive version: 0.1.0
  • Python version: 3.6

Proposed Functionality

Current functionality

$ phabfive diffusion
Usage:
    phabfive diffusion repo list [(active || inactive || all)] [options]
    phabfive diffusion repo create <name> [options]
    phabfive diffusion uri create (--observe || --mirror) (<credential>) <repo> <uri> [options]
    phabfive diffusion uri list <repo> [options]
    phabfive diffusion branch list <repo> [options]

Implement following behaviour

$ phabfive diffusion uri remove REPO https://foo/bar.git
Removed https://foo/bar.git from REPO

$ echo $?
0

$ phabfive diffusion uri remove REPO https://foo/non-existant.git
Unable to remove non-existant https://foo/non-existant.git from REPO

$ echo $?
0

Use Case

Enable ues to remove URI from phabricator

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.