GithubHelp home page GithubHelp logo

nl2go / hrobot-cli Goto Github PK

View Code? Open in Web Editor NEW
9.0 2.0 0.0 85 KB

A command-line interface for Hetzner Robot https://robot.your-server.de/

License: MIT License

Dockerfile 1.16% Makefile 2.84% Go 95.81% Shell 0.19%
golang go hetzner hetzner-robot-api

hrobot-cli's Introduction

hrobot-cli: Command-line interface for Hetzner Robot Webservice

Build Coverage

hrobot-cli is a command-line interface for interacting with the Hetzner Robot API.

Set environment variables for robot webservice credentials

hrobot-cli use environment variables for authenticating with the Hetzner Robot. It is recommended to use an env file similar to sample.env which can be used in the local environment as well as with the docker container. The expected variables are

  • HROBOTCLI_USER
  • HROBOTCLI_PASSWORD

Build manually and run on local machine

If you have Go installed, you can build hrobot-cli with:

go build

and run it with:

export $(cat sample.env | xargs) # or set the expected environemnt variables in any other way
./hrobot-cli

Build and run in docker

The project contains a Dockerfile which will build a container with the binary by running:

docker build --rm -f "Dockerfile" -t hrobot-cli:latest .

Afterwards you can run it with:

docker run -it --env-file=sample.env hrobot-cli:latest

Run latest version in docker using pre-built docker image

Run latest version from docker registry:

docker run -it --env-file=sample.env registry.github.com/nl2go/hrobot-cli:v0-1-1

Update hrobot-go mocks

This project uses gomock. When the hrobot-go library is upgraded to a new version, the mocks used for the tests need to be updated. This can be done by running the following command:

mockgen -package mock github.com/nl2go/hrobot-go RobotClient > test/mock/mock_robot_client.go

Features & overview

Currently implemented commands are:

CLI application for the Hetzner Robot API - version 0.1.1

Usage:
  hrobot-cli [command]

Available Commands:
  help               Help about any command
  ip:list            Print list of IP's
  key:list           Print list of ssh keys
  rdns:get           Print single reverse DNS entry
  rdns:list          Print list of reverse DNS entries
  server:ansible-inv Generates ansible inventory from server list
  server:get         Print single server
  server:list        Print list of servers
  server:rescue      Activate rescue mode for single server
  server:reset       Reset single server (hardware reset)
  server:reverse     Revert single server order
  server:set-name    Sets name for selected servers
  version            Print the version number of hrobot-cli

Flags:
  -h, --help   help for hrobot-cli

Use "hrobot-cli [command] --help" for more information about a command.

For commands that are applied to a single server it is possible to select the server interactively by searching through the server list. For other commands (like server renaming) multiple items can be selected for executing the respective command.

hrobot-cli's People

Contributors

dirkaholic avatar sananguliyev avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

hrobot-cli's Issues

panic: interface conversion: interface {} is []interface {}, not []string

When trying to execute server:rescue the following panic happens in a certain case.

panic: interface conversion: interface {} is []interface {}, not []string

goroutine 1 [running]:
github.com/nl2go/hrobot-cli/cmd.(*RobotApp).NewServerActivateRescueCmd.func1(0xc0002a2280, 0x1924be8, 0x0, 0x0)
	/Users/development/hrobot-cli/cmd/server.go:227 +0x14a3
github.com/spf13/cobra.(*Command).execute(0xc0002a2280, 0x1924be8, 0x0, 0x0, 0xc0002a2280, 0x1924be8)
	/Users/development/go/pkg/mod/github.com/spf13/[email protected]/command.go:830 +0x2aa
github.com/spf13/cobra.(*Command).ExecuteC(0xc00028d400, 0xc0000ce930, 0xc00028d400, 0xc00022aba0)
	/Users/development/go/pkg/mod/github.com/spf13/[email protected]/command.go:914 +0x2fb
github.com/spf13/cobra.(*Command).Execute(...)
	/Users/development/go/pkg/mod/github.com/spf13/[email protected]/command.go:864
github.com/nl2go/hrobot-cli/cmd.(*RobotApp).Run(0xc00022aba0, 0xc00022aba0, 0x10)
	/Users/development/hrobot-cli/cmd/app.go:34 +0x6c
main.main()
	/Users/development/hrobot-cli/main.go:25 +0x1f4

vSwitch management

Hi, first of all, thanks a lott for opensourcing this!
Do you plan on adding vSwitches management ?

I will try to have a look on my side, but I wanted to aask beforehand.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.