univ-of-utah-marriott-library-apple / python-jamf

`python-jamf` is a library for connecting to a Jamf Server. It maps Jamf Pro records to a Record class. It is the basis for the `jctl` tool to automate patch management & packages and many other items.
MIT License
56 stars 17 forks source link

docker-compose doesn't create network automatically #68

Closed pythoninthegrass closed 2 years ago

pythoninthegrass commented 2 years ago

Issue

Testing the stable docker version of python-jamf and the build process is failing at network creation.

Steps to reproduce

Have only tried with python-jamf-github, but suspect it's the same for python-jamf-dev.

$ cd python-jamf/python-jamf-docker
$ docker-compose run --rm python-jamf-github
network jamfpro_jamfnet declared as external, but could not be found

Workaround

Create the jamfpro_jamfnet docker network manually.

$ docker network create -d bridge jamfpro_jamfnet
4576<snip>
$ docker-compose run --rm python-jamf-github
[+] Building 106.1s (6/8)
 => [internal] load build definition from Dockerfile                                                                                                                            0.0s
pythoninthegrass commented 2 years ago

Added the bridge mode to the manual network to avoid DNS issues hitting like so:

 => ERROR [2/4] RUN git clone https://github.com/univ-of-utah-marriott-library-apple/python-jamf                                                                               76.8s
------
 > [2/4] RUN git clone https://github.com/univ-of-utah-marriott-library-apple/python-jamf:
#6 0.277 Cloning into 'python-jamf'...
#6 76.77 fatal: unable to access 'https://github.com/univ-of-utah-marriott-library-apple/python-jamf/': Failed to connect to github.com port 443: Connection refused
magnusviri commented 2 years ago

Hm. I added jamfpro_jamfnet so that I could test this with a dockerized Jamf Pro server. Because that is a separate project, and because that isn't the only way to use python-jamf, I actually think I should just remove the code that references jamfpro_jamfnet.

uurazzle commented 2 years ago

Hi @pythoninthegrass:

One option, if you want to just test python-jamf in a "safer" way to isolated from system site directories, etc. You could try setting up a python virtual environment to install & test python-jamf?

For more info, see this page:

https://docs.python.org/3/library/venv.html

pythoninthegrass commented 2 years ago

Hi all. I'm comfy setting these things up locally. The main idea is to have a portable environment without having to set it up or package the repo. Not crucial to incorporate into your work, but definitely a nicety. Especially since there are things that will likely need to be refactored if running in a container vs. the host machine/virtualenv.

Currently implementing a similar setup for scriptorium but that code base is simpler (e.g., a single python executable) with much different goals than python-jamf.

My employer doesn't use a containerized JPS, so just the tooling is what we're interested in.

EDIT I can see about generalizing my work with scriptorium to this repo and open a PR if you prefer to close the issue?

magnusviri commented 2 years ago

This is fixed in 0704df6.