Skip to content

Commit

Permalink
change --legacy to --latest to switch v1 to default
Browse files Browse the repository at this point in the history
  • Loading branch information
resoluteCoder committed Aug 6, 2024
1 parent 32e4786 commit c1ec58a
Show file tree
Hide file tree
Showing 9 changed files with 28 additions and 32 deletions.
14 changes: 6 additions & 8 deletions .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -141,24 +141,22 @@ jobs:

- name: Write out basic config
run: |
cat << EOF > test.yaml
cat << EOF > test.conf
---
version: 2
local-only:
local: true
control-services:
- service: control
- control-service:
service: control
filename: /tmp/receptor.sock
work-commands:
- worktype: cat
- work-command:
worktype: cat
command: cat
EOF
- name: Run receptor (and wait a few seconds for it to boot)
run: |
podman run --name receptor -d -v $PWD/test.yaml:/etc/receptor/receptor.yaml:Z localhost/receptor
podman run --name receptor -d -v $PWD/test.conf:/etc/receptor/receptor.conf:Z localhost/receptor
sleep 3
podman logs receptor
Expand Down
8 changes: 4 additions & 4 deletions cmd/receptor-cl/receptor.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ import (
)

func main() {
var legacy bool
var latest bool
newArgs := []string{}
for _, arg := range os.Args {
if arg == "--legacy" {
legacy = true
if arg == "--latest" {
latest = true

continue
}
Expand All @@ -26,7 +26,7 @@ func main() {

os.Args = newArgs

if !legacy {
if latest {
cmd.Execute()
} else {
fmt.Println("Running old cli/config")
Expand Down
4 changes: 2 additions & 2 deletions packaging/container/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ LABEL version="${VERSION}"

COPY receptorctl-${VERSION}-py3-none-any.whl /tmp
COPY receptor_python_worker-${VERSION}-py3-none-any.whl /tmp
COPY receptor.yaml /etc/receptor/receptor.yaml
COPY receptor.conf /etc/receptor/receptor.conf

RUN dnf -y update && \
dnf -y install python3.12-pip && \
Expand All @@ -36,4 +36,4 @@ ENV RECEPTORCTL_SOCKET=/tmp/receptor.sock
EXPOSE 7323

ENTRYPOINT ["/usr/local/bin/dumb-init", "--"]
CMD ["/usr/bin/receptor", "--config", "/etc/receptor/receptor.yaml"]
CMD ["/usr/bin/receptor", "-c", "/etc/receptor/receptor.conf"]
7 changes: 7 additions & 0 deletions packaging/container/receptor.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
- control-service:
service: control
filename: /tmp/receptor.sock

- tcp-listener:
port: 7323
8 changes: 0 additions & 8 deletions packaging/container/receptor.yaml

This file was deleted.

2 changes: 1 addition & 1 deletion packaging/tc-image/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ FROM receptor:latest
RUN dnf install tc -y

ENTRYPOINT ["/bin/bash"]
CMD ["-c", "/usr/bin/receptor --legacy --config /etc/receptor/receptor.conf > /etc/receptor/stdout 2> /etc/receptor/stderr"]
CMD ["-c", "/usr/bin/receptor --config /etc/receptor/receptor.conf > /etc/receptor/stdout 2> /etc/receptor/stderr"]
2 changes: 1 addition & 1 deletion pkg/workceptor/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ func (cw *commandUnit) Start() error {
receptorBin = "receptor"
}

cmd := exec.Command(receptorBin, "--legacy", "--node", "id=worker",
cmd := exec.Command(receptorBin, "--node", "id=worker",
"--log-level", levelName,
"--command-runner",
fmt.Sprintf("command=%s", cw.command),
Expand Down
3 changes: 1 addition & 2 deletions receptorctl/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ def start_nodes(receptor_mesh, receptor_nodes, receptor_bin_path):
)
receptor_nodes.nodes.append(
subprocess.Popen(
[receptor_bin_path, "--legacy", "-c", config_file],
[receptor_bin_path, "-c", config_file],
stdout=receptor_nodes.log_files[i],
stderr=receptor_nodes.log_files[i],
)
Expand Down Expand Up @@ -335,7 +335,6 @@ def receptor_mesh_access_control(
@pytest.fixture(scope="function")
def receptor_control_args(receptor_mesh):
args = {
"--legacy": None,
"--socket": f"{receptor_mesh.get_mesh_tmp_dir()}/{receptor_mesh.socket_file_name}",
"--config": None,
"--tls": None,
Expand Down
12 changes: 6 additions & 6 deletions tests/functional/cli/cli_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ func ConfirmListening(pid int, proto string) (bool, error) {

func TestHelp(t *testing.T) {
t.Parallel()
cmd := exec.Command("receptor", "--legacy", "--help")
cmd := exec.Command("receptor", "--help")
if err := cmd.Run(); err != nil {
t.Fatal(err)
}
Expand All @@ -50,7 +50,7 @@ func TestListeners(t *testing.T) {
t.Run(listener, func(t *testing.T) {
t.Parallel()
receptorStdOut := bytes.Buffer{}
cmd := exec.Command("receptor", "--legacy", "--node", "id=test", listener, "port=0")
cmd := exec.Command("receptor", "--node", "id=test", listener, "port=0")
cmd.Stdout = &receptorStdOut
err := cmd.Start()
if err != nil {
Expand Down Expand Up @@ -98,7 +98,7 @@ func TestSSLListeners(t *testing.T) {
if err != nil {
t.Fatal(err)
}
cmd := exec.Command("receptor", "--legacy", "--node", "id=test", "--tls-server", "name=server-tls", fmt.Sprintf("cert=%s", crt), fmt.Sprintf("key=%s", key), listener, fmt.Sprintf("port=%d", port), "tls=server-tls")
cmd := exec.Command("receptor", "--node", "id=test", "--tls-server", "name=server-tls", fmt.Sprintf("cert=%s", crt), fmt.Sprintf("key=%s", key), listener, fmt.Sprintf("port=%d", port), "tls=server-tls")
cmd.Stdout = &receptorStdOut
err = cmd.Start()
if err != nil {
Expand Down Expand Up @@ -143,7 +143,7 @@ func TestNegativeCost(t *testing.T) {
t.Run(listener, func(t *testing.T) {
t.Parallel()
receptorStdOut := bytes.Buffer{}
cmd := exec.Command("receptor", "--legacy", "--node", "id=test", listener, "port=0", "cost=-1")
cmd := exec.Command("receptor", "--node", "id=test", listener, "port=0", "cost=-1")
cmd.Stdout = &receptorStdOut
err := cmd.Start()
if err != nil {
Expand Down Expand Up @@ -185,7 +185,7 @@ func TestCostMap(t *testing.T) {
t.Run(costMapCopy, func(t *testing.T) {
t.Parallel()
receptorStdOut := bytes.Buffer{}
cmd := exec.Command("receptor", "--legacy", "--node", "id=test", listener, "port=0", fmt.Sprintf("nodecost=%s", costMapCopy))
cmd := exec.Command("receptor", "--node", "id=test", listener, "port=0", fmt.Sprintf("nodecost=%s", costMapCopy))
cmd.Stdout = &receptorStdOut
err := cmd.Start()
if err != nil {
Expand Down Expand Up @@ -235,7 +235,7 @@ func TestCosts(t *testing.T) {
t.Run(costCopy, func(t *testing.T) {
t.Parallel()
receptorStdOut := bytes.Buffer{}
cmd := exec.Command("receptor", "--legacy", "--node", "id=test", listener, "port=0", fmt.Sprintf("cost=%s", costCopy))
cmd := exec.Command("receptor", "--node", "id=test", listener, "port=0", fmt.Sprintf("cost=%s", costCopy))
cmd.Stdout = &receptorStdOut
err := cmd.Start()
if err != nil {
Expand Down

0 comments on commit c1ec58a

Please sign in to comment.