Skip to main content

An unofficial python wrapper library for Anka

Project description

PyAnka

An unofficial python wrapper library for Anka

Build Status PyPI

Requirements

You will need python3^ and the anka cli.

brew install python3
brew install --cask anka-virtualization

Installing

pip3 install pyanka

Dev Notes

You can run test locally via the bitrise CLI (brew install bitrise) by running bitrise run ci

The library at this point is not feature ready, but sufficient for the Bitrise Infrastructure team's current requirements.

Usage

Import the module and instalce it with the AnkaVm() constructor, this will require you to name the virtual machine in question.

See the examples below or the example file.

import anka from pyanka

# Create an instance of the Anka VM Class
    vm = anka.AnkaVm("test-vm")

    # Start up an already existing VM that is stopped, or suspended
    vm.start()

    # Show runtime properties of an already existing VM
    # This method returns a JSON object, that you can use as a dictionary
    vm.show()

    # CLone an already existing VM
    # You need to define the name of the to be cloned VM
    # The method will initialise an instance of the class with the ne name for you.
    clone = vm.clone("cloned-vm")
    clone.show()

    # Suspend a running VM
    vm.suspend()

    # stop a running or suspended VM
    vm.stop()

    # Delete a VM, this needs to be in a stopped state
    vm.delete()

    # Copy a file from the host machine to the virtual machine
    # TODO make it work both ways
    vm.copy("./example.file", "/tmp/example.file")

    # run a shell command on the virtual machine, and get back the stdout or stderr
    vm.run("ls", "-la")

Authors

Name Mail Address GitHub Profile
Sandor Feher sandor.feher@bitrise.io fehersanyi-bitrise

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyanka-0.0.2.tar.gz (3.5 kB view hashes)

Uploaded Source

Built Distribution

pyanka-0.0.2-py3-none-any.whl (3.8 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page