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

Rebase4.x #38

Merged
merged 3 commits into from
Apr 25, 2018
Merged

Rebase4.x #38

merged 3 commits into from
Apr 25, 2018

Conversation

zachfi
Copy link
Contributor

@zachfi zachfi commented Apr 19, 2018

Here is a rebase of the 4.x branch that had gotten out of date, and quite long in the tooth. The commits here have been squashed for brevity.

@zachfi
Copy link
Contributor Author

zachfi commented Apr 19, 2018

@igalic Hi. This is looking close to final for merge to me, assuming the tests pass. Do you want to take a pass over it before merge? My last commit has some details you may or may not care about. This should be supporting both the legacy provider and the new one that you worked on so heavily. Let me know what you think if you don't mind.

igalic and others added 3 commits April 21, 2018 20:44
this also adds a new fact to short-cut the FreeBSD release as used by
iocage.

add default for our freebsd_release fact

add global state validation for resource

we add all global state validation for iocage into the type.

We also rename the rebuild & restart functions to allow_* so it's
clearer what they do.

And, finally, we remove `hostname` — and other properties, cuz they are
no longer needed.

streamline & simplify provider

we get rid of lots of code and simplify what we're doing by using the
pattern of filling options / props in flush and passing them all to
create…

The next thing is to figure out what to do on changes.
and also, how to figure out the difference between two Hashes, because
aparently, `hsh1 - hsh2` doesn't ;)

fix copy paste issue & missing props

tag has now been removed

in iocage/iocage@64946b8
tag has now been completely removed.

properly flush on update… maybe?

rework properties handling to… probably work ;)

Hashes cannot be subtracted, but Sets can!
We use frozen Sets, for "performance" reasons.

restore pkglist functionality

remove defaults for template & fix tests!

this also removes unused fixtures.

fix ensure parameter & remove noise

we replace empty values ('-') with nil, so they won't show up

use constant frozen symbols for our fields list

forgot `properties` setter

ensure that this type is ensurable (again)

use @property_flush to decide, not as data-feed

We can use `@property_flush` to decide whether to (re)build or destroy a jail,
but not really to feed the data in. This, however, can simply come from
`resource` — the current resource object.

protect /bin/sh from interpreting | in ip*_addr

given that this is passed down to `/bin/sh`, we need to ensure it won't see the
`|` in the jails ip4_addr="interface|172.16.1.2/12" notation

rubocop complains about empty line

new type jail_release

this `iocage fetch`es the specified release.
Being a type & provider, we can also make use of `prefetch` and `puppet resource`!

in this provider, we can failonfail

since there's no issue in any of the calls here, we can `failonfail` already.

fstab: collect state & implement change!

using `iocage get fstab` we can collect a jail's state
our fstab= function currently changes that state. Let's see if we have to fold
it into flush

resource doesn't exist at instances time

use j[:uuid] instead

correctly calculate the difference between the two states

adapt to new features and bug fixes

iocage/iocage#260
iocage/iocage#259

are now fixed, which means we can enable failonfail.

add speculative spec test for how fstab should be implemented

Fix parsing of fstab entries

only jails can have fstab entries

consider that, both when accepting data, and when collecting it from the
system

Filter out properties that are exposed thru the type

and values that match our jail's name

Filter out cloned_release from properties

appease rubocop

autorequire template jails & jail_releases

validate that release xor template is set

as discovered 5 seconds after pushing this code to my server

use self[:release] / self[:template

these are half guaranteed to exist…

on #execute, combine stdin & stderr

by default, `stderr` is discarded. `combine: true` in combination with
`failonfail: true` should guarantee that we see the *reason* for why something
is failing.

use same name validation as iocage does

same as it uses now… iocage/iocage#292

Fix tests, after fixing execute() behaviour

handle apparent discrepancy in --release conventions

the reporting gives us the patch level, which is good to know, but iocage fetch
wants it without the patch. This should take care of that

ref: iocage/iocage#294
Here are a bunch of changes that were needed to get this version of the code
live in my environment.  Much of this was needed as the upstream iocage was very
unstable for a period of time, but seems to be stabilizing somewhat, anecdotally
observed by github activity.

There are most certainly still issues here, but the core functionality does seem
to work for me reasonably well, and I personally rely on this module to get my
work done.  What follows are brief descriptions of the changes.

Update package name.  The name of the iocage package has changed recently to
reflect the rewrite in python.  Furthermore, it is unclear if the prefix of py36
will remain, as is hardcoded here.  As such, we allow tuning the package name.

Improve validation on release property

Create and destroy only when necessary

Correct parameter order on resource

Fixes for rubocop

Include more debug

Adjust address logic

Check for the property_hash ensure before starting

Check discovered state for creation

Start a jail only if necessary

Wrap the address in quotes

Add the properties individually

Skip built in jail properties

Set boot state

Use pipe for executing from stdin

Better iocage path

Bring back legacy spec fixuture.  This was deleted as part of prior work due to
the expectation that we would retire the legacy provider as part of this work.
With the length of time that this work has been outstanding, there have been
commits here against the legacy provider that I would like not to loose so as to
avoid breaking folks who have started using this module recently.  Versions are
cheap, and so we might seek to pull out the legacy provider as its own effort,
followed by cutting a new release.
@zachfi
Copy link
Contributor Author

zachfi commented Apr 25, 2018

@RainbowHackerHorse Heads up, this change may break you if you're not pinned to a release. I'll get #35 merged shortly after this one.

@zachfi zachfi merged commit d555124 into master Apr 25, 2018
@zachfi zachfi deleted the rebase4.x branch April 25, 2018 19:02
@zachfi zachfi mentioned this pull request Apr 25, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants