Git Product home page Git Product logo

Comments (2)

hth2 avatar hth2 commented on August 15, 2024 1

I was in hurry to look for a way to get some info from Hetzner using command-line. I don't want PHP so I tried this library. Sadly the documentation is really lacking. I put my notes here, hope that it could save some time and frustration for people in similar situation.

# install:
pip3 install hetzner

# create a minimal config file:
cat <<EOT > ~/.hetznerrc
[login]
username = abc
password = def
EOT

# list all my servers:
hetznerctl  list

# show details of one server:
hetznerctl  show 1.2.3.4 # 1.2.3.4 = IP of the server from previous command

from hetzner.

aszlig avatar aszlig commented on August 15, 2024

First of all, I completely agree that this library needs better documentation and also better packaging.

I got my RDNS kinda working, but the library does not output anything which can be used to determine if it was successful?

You can look at the hetznerctl tool for example usage:

hetzner/hetznerctl

Lines 211 to 229 in e3e20a8

def execute(self, robot, parser, args):
if args.ip is None:
for rdns in robot.rdns:
self.putline("{0} -> {1}".format(rdns.ip, rdns.ptr))
elif args.delptr:
robot.rdns.get(args.ip).remove()
elif args.setptr:
if args.ip is None or args.value is None:
parser.error("Need exactly two arguments: IP address and new"
" reverse FQDN.")
else:
rdns = robot.rdns.get(args.ip)
rdns.set(args.value)
else:
rdns = robot.rdns.get(args.ip)
if rdns.ptr is None:
self.putline("No reverse record set for {0}.".format(rdns.ip))
else:
self.putline("{0} -> {1}".format(rdns.ip, rdns.ptr))

In terms of determining whether it was successfully set, first of all you get an exception if the POST on /rdns/N has failed. So in theory this should be enough. However if you want to be absolutely sure, you could call update_info() on the ReverseDNS object and check whether the value is the correct one.

from hetzner.

Related Issues (20)

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.