Skip to main content

Modifying OEC to explicitly use Python3

Some older operating systems are dependent on the "python" command mapping to "python2" (e.g. RHEL/CentOS 7)

Robert Pratt avatar
Written by Robert Pratt
Updated over 4 years ago

1. Install dependencies (Go, git)

# Install go + git from the OS package manager 
[root@ip-172-31-77-28 oec]# yum install golang git

2. Clone the OEC repository

# Move to /opt 
[root@ip-172-31-77-28 ~]# cd /opt

# Clone the OEC Repository
[root@ip-172-31-77-28 opt]# git clone https://github.com/opsgenie/oec.git

3. Modify executor.go to explicitly use Python3

# Open executor.go in your text editor of choice
[root@ip-172-31-77-28 opt]# vim /opt/oec/runbook/executor.go

Change this line from

	".py":     {"python"},

to

	".py":     {"python3"},

Save the changes and quit.

4. Compile OEC

# Move to /opt/oec/main 
[root@ip-172-31-77-28 opt]# cd /opt/oec/main/

# Download dependencies and compile
[root@ip-172-31-77-28 main]# go get -d
[root@ip-172-31-77-28 main]# go build -o ../bin/OpsgenieEdgeConnector

5. Install the "new" version of OEC

# Remove the OEC executable bundled with the RPM/DEB packages
[root@ip-172-31-77-28 opt]# rm /usr/local/bin/OpsgenieEdgeConnector

# Add a symlink to the version we just compiled
[root@ip-172-31-77-28 main]# ln -s /opt/oec/bin/OpsgenieEdgeConnector /usr/local/bin/OpsgenieEdgeConnector

Did this answer your question?