Closed Sylvain303 closed 7 years ago
Hi,
Can you retry with the code from branch https://github.com/yadutaf/ovh-cli/tree/jt-arguments ? This is work in progress code but it should help with this bug.
I got:
./ovh-eu ip 149.202.168.43 reverse post --ipReverse 149.202.168.43 --reverse grep.opensource-expert.com
Traceback (most recent call last):
File "./ovh-eu", line 194, in <module>
verb, method, arguments = parser.parse('', args)
File "/home/sylvain/code/ovh/ovh-cli/ovhcli/parser.py", line 195, in parse
return parser.parse(base_url, args)
File "/home/sylvain/code/ovh/ovh-cli/ovhcli/parser.py", line 209, in parse
return parser.parse(base_url, args)
File "/home/sylvain/code/ovh/ovh-cli/ovhcli/parser.py", line 195, in parse
return parser.parse(base_url, args)
File "/home/sylvain/code/ovh/ovh-cli/ovhcli/parser.py", line 201, in parse
args = self.parse_action_params(verb, args, base_url)
File "/home/sylvain/code/ovh/ovh-cli/ovhcli/parser.py", line 308, in parse_action_params
param.get('description', ''),
File "/home/sylvain/code/ovh/ovh-cli/ovhcli/parser.py", line 238, in _register_parser_command
description = description.replace('%', '%%') # Encode description to fix some help printing
AttributeError: 'NoneType' object has no attribute 'replace'
branch:
git branch
master
* origin/jt-arguments
my script works fine: (forward need to be set before, was done with ovh-cli OK)
./ovh_reverse.py 149.202.168.43 grep.opensource-expert.com
{
"ipReverse": "149.202.168.43",
"reverse": "grep.opensource-expert.com."
}
./ovh_reverse.py
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
'''
First, install the latest release of Python wrapper: $ pip install ovh
Usage: ovh_reverse IP FQDN
'''
import os
import sys
import json
import ovh
ip = sys.argv[1]
fqdn = sys.argv[2]
# Instanciate an OVH Client. use your ovh.conf
client = ovh.Client()
result = client.post('/ip/%s/reverse/' % ip,
ipReverse=ip,
reverse=fqdn)
print json.dumps(result, indent=4) # Pretty print
I pushed my code here to test with public cloud:
Should be better now.
Fine, it works!
Steps:
first have an public cloud instance with an OVH IP, and set forward DNS, it fails correctly if not.
./cloud.sh set_forward_dns 213.32.72.120 grep.opensource-expert.com
null
Success
which calls approximately:
record=$(./ovh-eu --format json domain zone $domain record \
--subDomain $subdomain \
| jq -r '.[0]')
./ovh-eu --format json domain zone $domain record $record put --target $ip --ttl 60
./ovh-eu domain zone $domain refresh post
And finally:
./ovh-eu ip 213.32.72.120 reverse post --ipReverse 213.32.72.120 --reverse grep.opensource-expert.com
---------- ---------------------------
Ip reverse 213.32.72.120
Reverse grep.opensource-expert.com.
---------- ---------------------------
Note: ovhcli/schema.py depends of fixed local path and ./ohv-eu seems to must be called in its orginal folder.
SCHEMAS_BASE_PATH='./schemas/'
delete works that way (which I feel confusing), I was testing: Wrong:
./ovh-eu ip 213.32.72.120 reverse delete --ipReverse 213.32.72.120
Good:
./ovh-eu ip 213.32.72.120 reverse 213.32.72.120 delete -h
usage: DELETE /ip/213.32.72.120/reverse/213.32.72.120 [-h]
./ovh-eu ip 213.32.72.120 reverse 213.32.72.120 delete
Success
Yeah ! Thanks for testing. If this issue is solved for you, I'll let you close it :)
Regarding the hard-coded path, I'm aware of it . This is clearly not the right path to go to distribute the CLI. There is PR #10 about it. Maybe you already saw it.
Salut
https://eu.api.ovh.com/console/#/ip/{ip}/reverse#POST
returns
but on console:
it seems to be a type string… on schema it is
also what about delete?
isn't working neither.
-h give a strange GET
works on console.