Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fork python module name iocage to ioc #596

Merged
merged 4 commits into from
Jan 4, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Make sure to follow and check these boxes before submitting an issue! Thank you.

- [ ] Supply `iocage --version`
- [ ] Supply `print(ioc.VERSION)`
- [ ] Supply the commands used, along with any steps to recreate it.
- [ ] Provide the output from the command you issued.
- [ ] Supply what you expected the result or output to be
Expand Down
2 changes: 1 addition & 1 deletion .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Make sure to follow and check these boxes before submitting a PR! Thank you.

- [ ] Explain the feature
- [ ] Read [CONTRIBUTING.md](https://github.com/iocage/iocage/blob/master/CONTRIBUTING.md)
- [ ] Read [CONTRIBUTING.md](https://github.com/bsdci/libioc/blob/master/CONTRIBUTING.md)
2 changes: 1 addition & 1 deletion CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ This Code of Conduct applies both within project spaces and in public spaces whe

## Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at [email protected]. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at [email protected]. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.

Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.

Expand Down
8 changes: 2 additions & 6 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,18 +78,14 @@ Please run our Test suit before submitting a pull request.
To do this you can run

```sh
make check-deps # install dependencies needed to run check
make install-dev # install dependencies needed to run check
make check
```

The linters and static code analysis tools run in `check ` can be executed on _any_ system.
For regression tests, you'll need a \*BSD system with a ZFS pool you can give `iocage` access to:
For regression tests, you'll need a \*BSD system with a ZFS pool you can give `ioc` access to:

```sh
setenv ZPOOL=jails
make test
```

## Documentation for Read The Docs

If you wish to update some of our [documentation](http://iocage.readthedocs.org), you only need to submit a PR for the files you change in iocage/doc/source. They will automatically be updated when the changes are merged.
2 changes: 1 addition & 1 deletion LICENSE.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Copyright (c) 2017-2019, Stefan Grönke
Copyright (c) 2014-2018, iocage
Copyright (c) 2017-2018, Stefan Grönke
All rights reserved.

Redistribution and use in source and binary forms, with or without
Expand Down
22 changes: 4 additions & 18 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,30 +8,16 @@ deps:
if [ "`uname`" = "FreeBSD" ]; then pkg install -q -y libucl py36-cython rsync python36 py36-libzfs py36-sysctl; fi
python3.6 -m ensurepip
python3.6 -m pip install -Ur requirements.txt
python3.6 -m pip install -Ur requirements-ioc.txt
install: deps
python3.6 -m pip install -U .
@if [ -f /usr/local/etc/init.d ]; then \
install -m 0755 rc.d/ioc /usr/local/etc/init.d; \
else \
install -m 0755 rc.d/ioc /usr/local/etc/rc.d; \
fi
install-dev: deps
if [ "`uname`" = "FreeBSD" ]; then pkg install -y gmake; fi
python3.6 -m pip install -Ur requirements-dev.txt
python3.6 -m pip install -e .
@if [ -f /usr/local/etc/init.d ]; then \
install -m 0755 -o root -g wheel rc.d/ioc /usr/local/etc/init.d; \
else \
install -m 0755 -o root -g wheel rc.d/ioc /usr/local/etc/rc.d; \
fi
install-travis:
python3.6 -m pip install flake8-mutable flake8-docstrings flake8-builtins flake8-mypy bandit bandit-high-entropy-string
uninstall:
python3.6 -m pip uninstall -y iocage ioc
@if [ -f /usr/local/etc/rc.d/ioc ]; then \
rm /usr/local/etc/rc.d/ioc; \
fi
python3.6 -m pip uninstall -y ioc
check:
flake8 --version
flake8 --exclude=".travis,.eggs,__init__.py,docs" --ignore=E203,E252,W391,D107,A001,A002,A003,A004
Expand All @@ -42,14 +28,14 @@ regression-test:
tests/run-integration.sh
.PHONY: docs
docs:
sphinx-apidoc -o docs --separate -H libiocage -A "iocage Authors" --full iocage ioc tests
sphinx-apidoc -o docs --separate -H ioc -A "ioc Contributors" --full ioc tests
if [ "`uname`" = "FreeBSD" ]; then gmake -C docs html; else make -C docs html; fi

help:
@echo " install"
@echo " Installs libiocage"
@echo " Installs libioc"
@echo " uninstall"
@echo " Removes libiocage."
@echo " Removes libioc"
@echo " test"
@echo " Run unit tests with pytest"
@echo " check"
Expand Down
99 changes: 22 additions & 77 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,11 @@
# libiocage
# libioc

**Python Library to manage FreeBSD jails with libiocage.**
**Python Library to manage FreeBSD jails with ioc{age,ell}.**

iocage is a jail/container manager fusioning some of the best features and technologies the FreeBSD operating system has to offer.
It is geared for ease of use with a simple and easy to understand command syntax.

This library provides programmatic access to iocage features and jails, while aiming to be compatible with iocage-legacy, and the current Python 3 version of iocage.

### Latest News (September 22nd, 2018)
Progress towards the transition of [python-iocage](https://github.com/iocage/iocage) using libiocage has been made.
Recent changes to both projects ensure compatibility running on the same host, so that it is now possible to partially utilize libiocage in iocage until a full migration is performed.
Because some changes to the command line arguments and the script output will occur, @skarekrow will continue to maintain the current implementation until users had time to follow the deprecation warnings and suggestions.

In terms of the "Advanced container management with libiocage" tutorial at EuroBSDCon 2018 the [Handbook](https://iocage.io/handbook) was published.
This library provides programmatic access to iocage features and jails, while aiming to be compatible with iocage_legacy, iocell and the Python 3 version of iocage (`< 1.0`).

## Install

Expand All @@ -26,8 +19,8 @@ At the current time libiocage is not packaged or available in FreeBSD ports.

## Documentation

- Iocage Handbook: https://iocage.io/handbook
- Reference Documentation: https://iocage.io/libiocage
- Iocage Handbook: https://bsdci.github.io/handbook
- Reference Documentation: https://bsdci.github.io/libioc

## Configuration

Expand All @@ -50,7 +43,11 @@ ioc_dataset_othersource="zroot/iocage"
iocage commands default to the first root data source specified in the file.
Operations can be pointed to an alternative root by prefixing the subject with the source name followed by a slash.

```sh
```python
import ioc
release = ioc.Release("12.0-RELEASE")

jail_a = ioc.Jail(new=True, {})
ioc create othersource/myjail
ioc rename othersource/myjail myjail2
```
Expand All @@ -62,86 +59,27 @@ When `othersource` is the only datasource with a jail named `myjail` the above o
### Library

```python
import iocage
import ioc

jail = iocage.Jail()
jail = ioc.Jail()
jail.create("11.1-RELEASE")
```

### CLI

Libiocage comes bundles with a CLI tool called `ioc`.
libioc has a CLI tool called [ioc](https://github.com/bsdci/ioc) that is no longer bundled with the library, but can be installed individually.
It is inspired by the command line interface of [iocage](https://github.com/iocage/iocage) but meant to be developed along with the library and to spike on new features.

```
Usage: ioc [OPTIONS] COMMAND [ARGS]...

A jail manager.

Options:
--version Show the version and exit.
--source TEXT Globally override the activated iocage dataset(s)
-d, --log-level TEXT Set the CLI log level ('critical', 'error', 'warn',
'info', 'notice', 'verbose', 'debug', 'spam',
'screen')
--help Show this message and exit.

Commands:
activate Set a zpool active for iocage usage.
clone Clone and promote jails.
console Login to a jail.
create Create a jail.
deactivate Disable a ZFS pool for iocage.
destroy Destroy specified resource
exec Run a command inside a specified jail.
export Export a jail to a backup archive
fetch Fetch and update a Release to create Jails...
fstab View and manipulate a jails fstab file.
get Gets the specified property.
import Import a jail from a backup archive
list List a specified dataset type, by default...
migrate Migrate jails to the latest format.
pkg Manage packages in a jail.
promote Clone and promote jails.
provision Trigger provisioning of jails.
rename Rename a stopped jail.
restart Restarts the specified jails.
set Sets the specified property.
snapshot Take and manage resource snapshots.
start Starts the specified jails or ALL.
stop Stops the specified jails or ALL.
update Starts the specified jails or ALL.
```

### Custom Release (e.g. running -CURRENT)

#### Initially create the release dataset

```sh
zfs create zroot/iocage/releases/custom/root
cd /usr/src
# install your source tree
make installworld DESTDIR=/iocage/releases/custom/root
make distribution DESTDIR=/iocage/releases/custom/root
ioc fetch -r custom -b
```

#### Update the installation after recompile
```sh
make installworld DESTDIR=/iocage/releases/custom/root
ioc fetch -r custom -b
```

## Documentation

The [API Reference (html)](https://iocage.io/libiocage) documenting all public interfaces of libiocage is updated with every release.
The [API Reference (html)](https://bsdci.github.io/libioc) documenting all public interfaces of libioc is updated with every release.
The information found in the reference is compiled from Python docstrings and MyPy typings using Sphinx.

## Development

### Unit Tests

Unit tests may run on FreeBSD or HardenedBSD and require an activated iocage pool.
Unit tests may run on FreeBSD or HardenedBSD and require an activated ioc pool.

```sh
ZPOOL=zroot make test
Expand All @@ -161,6 +99,13 @@ make check

### Project Status (Archive)

igalic marked this conversation as resolved.
Show resolved Hide resolved
#### 2018-09-22
Progress towards the transition of [python-iocage](https://github.com/iocage/iocage) using libiocage has been made.
Recent changes to both projects ensure compatibility running on the same host, so that it is now possible to partially utilize libiocage in iocage until a full migration is performed.
Because some changes to the command line arguments and the script output will occur, @skarekrow will continue to maintain the current implementation until users had time to follow the deprecation warnings and suggestions.

In terms of the "Advanced container management with libiocage" tutorial at EuroBSDCon 2018 the [Handbook](https://bsdci.github.io/handbook) was published.

#### 2018-08-07
libiocage is making small but continuous steps to stabilize the interfaces and become used in [iocage/iocage](https://github.com/iocage/iocage).
The project was first presented in the talk "[Imprisoning software with libiocage](https://www.bsdcan.org/2018/schedule/events/957.en.html)" at BSDCan 2018 (Video Recording on [YouTube](https://www.youtube.com/watch?v=CTGc3zYToh0)).
Expand Down
2 changes: 1 addition & 1 deletion docs/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# You can set these variables from the command line.
SPHINXOPTS =
SPHINXBUILD = sphinx-build
SPHINXPROJ = libiocage
SPHINXPROJ = libioc
SOURCEDIR = .
BUILDDIR = _build

Expand Down
21 changes: 11 additions & 10 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@
#
# import os
# import sys
# sys.path.insert(0, '/usr/local/src/libiocage/iocage')
# sys.path.insert(0, '/usr/local/src/libioc/iocage')


# -- Project information -----------------------------------------------------

project = 'libiocage'
copyright = '2018, iocage Authors'
author = 'iocage Authors'
project = 'libioc'
copyright = '2018, ioc Contributors'
author = 'ioc Contributors'

# The short X.Y version
version = ''
Expand Down Expand Up @@ -106,7 +106,7 @@
# -- Options for HTMLHelp output ---------------------------------------------

# Output file base name for HTML help builder.
htmlhelp_basename = 'libiocagedoc'
htmlhelp_basename = 'libiocdoc'


# -- Options for LaTeX output ------------------------------------------------
Expand All @@ -133,8 +133,8 @@
# (source start file, target name, title,
# author, documentclass [howto, manual, or own class]).
latex_documents = [
(master_doc, 'libiocage.tex', 'libiocage Documentation',
'iocage Authors', 'manual'),
(master_doc, 'libioc.tex', 'libioc Documentation',
'ioc Contributors', 'manual'),
]


Expand All @@ -143,7 +143,7 @@
# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
(master_doc, 'libiocage', 'libiocage Documentation',
(master_doc, 'libioc', 'libioc Documentation',
[author], 1)
]

Expand All @@ -154,8 +154,9 @@
# (source start file, target name, title, author,
# dir menu entry, description, category)
texinfo_documents = [
(master_doc, 'libiocage', 'libiocage Documentation',
author, 'libiocage', 'One line description of project.',
(master_doc, 'libioc', 'libioc Documentation',
author, 'libioc',
'libioc is a Python 3 jail management library originating from iocage.',
'Miscellaneous'),
]

Expand Down
2 changes: 1 addition & 1 deletion iocage/BridgeInterface.py → ioc/BridgeInterface.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Copyright (c) 2017-2019, Stefan Grönke
# Copyright (c) 2014-2018, iocage
# Copyright (c) 2017-2018, Stefan Grönke
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
Expand Down
2 changes: 1 addition & 1 deletion iocage/CommandQueue.py → ioc/CommandQueue.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Copyright (c) 2017-2019, Stefan Grönke
# Copyright (c) 2014-2018, iocage
# Copyright (c) 2017-2018, Stefan Grönke
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
Expand Down
10 changes: 5 additions & 5 deletions iocage/Config/Dataset.py → ioc/Config/Dataset.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Copyright (c) 2017-2019, Stefan Grönke
# Copyright (c) 2014-2018, iocage
# Copyright (c) 2017-2018, Stefan Grönke
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
Expand Down Expand Up @@ -27,10 +27,10 @@
import libzfs
import typing

import iocage.Config.Prototype
import ioc.Config.Prototype


class DatasetConfig(iocage.Config.Prototype.Prototype):
class DatasetConfig(ioc.Config.Prototype.Prototype):
"""iocage configuration associated with ZFS datasets."""

_dataset: libzfs.ZFSDataset
Expand All @@ -39,13 +39,13 @@ def __init__(
self,
dataset: typing.Optional[libzfs.ZFSDataset]=None,
file: typing.Optional[str]=None,
logger: typing.Optional['iocage.Logger.Logger']=None
logger: typing.Optional['ioc.Logger.Logger']=None
) -> None:

if dataset is not None:
self._dataset = dataset

iocage.Config.Prototype.Prototype.__init__(
ioc.Config.Prototype.Prototype.__init__(
self,
file=file,
logger=logger
Expand Down
Loading