Closed tristanbes closed 6 years ago
Gandi does not provide package repository for now. But a quick process to build the package could be:
Prepare the build env:
$ builddir=`mktemp -d --suffix=gandicli`
$ cd "${builddir}"
$ git clone https://github.com/Gandi/gandi.cli.git gandi.cli.git
$ cd gandi.cli.git
$ ln -sf packages/debian .
Install the build dependencies:
$ su -l root
# apt-get install debhelper python python-setuptools python3-setuptools python-docutils python3-docutils dh-python python-nose python3-nose
Build binary packages:
$ cd "${builddir}"
$ debuild -us -uc -b
Install the builded package
$ su -l root
# cd "${builddir}"
# dpkg -i python3-gandicli # or python-gandicli for the python2.7 version
# apt-get -f install
Note that you could also use sbuild to create the binary package.
Then we clean our temporary build env:
$ cd && rm -rf "${builddir}"
$ rm -v /tmp/python-gandicli*.deb /tmp/python3-gandicli*.deb /tmp/gandicli_*
Sorry if I got something wrong, but
apt-get install python3-gandicli
gave nothing so i did:
I ended up with dpkg errors because of missing dependency in python.
(PS: python --version
returns Python 2.7.13
@tristanbes indeed you should use dpkg -i python3-gandi
instead of apt-get. This was a mistake in my comments.
You can fix the missing dependencies with apt-get install -f
after the manual installation with dpkg.
So the apt-get install -f
step should happen after dpkg -i python-gandicli_1.1_all.deb
or It can be right before to prevent failure of dpkg ?
Thanks
Right after installing it:
gandi
gives:
root@ziggs ➜ ~ gandi
Traceback (most recent call last):
File "/usr/bin/gandi", line 11, in <module>
load_entry_point('gandi.cli==1.1', 'console_scripts', 'gandi')()
File "build/bdist.linux-x86_64/egg/pkg_resources/__init__.py", line 561, in load_entry_point
File "build/bdist.linux-x86_64/egg/pkg_resources/__init__.py", line 2631, in load_entry_point
File "build/bdist.linux-x86_64/egg/pkg_resources/__init__.py", line 2291, in load
File "build/bdist.linux-x86_64/egg/pkg_resources/__init__.py", line 2297, in resolve
File "/usr/lib/python2.7/dist-packages/gandi/cli/__main__.py", line 4, in <module>
from gandi.cli.core.cli import cli
File "/usr/lib/python2.7/dist-packages/gandi/cli/core/cli.py", line 12, in <module>
from .base import GandiContextHelper
File "/usr/lib/python2.7/dist-packages/gandi/cli/core/base.py", line 19, in <module>
from .client import XMLRPCClient, APICallFailed, DryRunException, JsonClient
File "/usr/lib/python2.7/dist-packages/gandi/cli/core/client.py", line 15, in <module>
import requests
File "/usr/local/lib/python2.7/dist-packages/requests/__init__.py", line 52, in <module>
from .packages.urllib3.contrib import pyopenssl
File "/usr/local/lib/python2.7/dist-packages/requests/packages/urllib3/contrib/pyopenssl.py", line 46, in <module>
import OpenSSL.SSL
File "/usr/local/lib/python2.7/dist-packages/OpenSSL/__init__.py", line 8, in <module>
from OpenSSL import rand, crypto, SSL
File "/usr/local/lib/python2.7/dist-packages/OpenSSL/SSL.py", line 118, in <module>
SSL_ST_INIT = _lib.SSL_ST_INIT
AttributeError: 'module' object has no attribute 'SSL_ST_INIT'
@tristanbes dpkg -i python-gandicli_*_all.deb
install the package but dpkg does not resolve the dependencies graph and therefor does not install any dependencies. This is a task for apt. Using -f, it will fix the broken dependencies in the local installation. dpkg -i python-gandicli_*_all.deb && apt-get -f install
. Before the dpkg command, there should be no broken dependencies on your system and running the apt-get -f install
command before the dpkg
command will not have any action.
ok thx for explanation. But once installed, I hit the AttributeError: 'module' object has no attribute 'SSL_ST_INIT'
error though all depandancies are installed
@tristanbes which version of python-requests is installed on your system ?
$ dpkg -l | awk '/python-(openssl|requests) / { print $1 "\t" $2 "\t" $3 }'
root@ziggs ➜ tmp.gHIaSsHtgngandicli dpkg -l | awk '/python-(openssl|requests) / { print $1 "\t" $2 "\t" $3 }'
ii python-openssl 16.2.0-1
ii python-requests 2.12.4-1
Meh, it seems like your instruction broke something in python because even our Ansible (not related to gandi.cli) can't connect to this server with the exact same message. Do you know how to revert/fix it ?
@tristanbes check your /var/log/dpkg.log for the list of installed or update package with the dpkg and apt-get command and revert them. A partial list of package is shown in your screenshot.
Ok, removing python && re-installing it fixed the problem. Closing the issue. Would love a simpler installation process though ;-).
Thanks
Hello,
Is that possible to enhance documentation ? I find it not very clear when it comes to installation.
I tried building from source, but after doing
python setup.py install --user
I don't know what to except. Where is the executable ? How to make it available on the OS wise ?I ended up using virtual env but I don't want to install all of those on the production environement, where the Cli will live, if possible.
Isn't it possible to use a custom repository for Debian/Ubuntu to install your cli tool via
apt
?