393 Commits

Author SHA1 Message Date
be8278fbdc Upgrade act_runner 2026-02-13 16:06:08 +04:00
ff3f05452f Merge pull request 'Update Gitea to 1.25.4' (#622) from chore/upgrade_gitea into master
Reviewed-on: #622
Reviewed-by: Râu Cao <raucao@kosmos.org>
2026-02-13 10:18:36 +00:00
Greg Karekinian
1fb66092fc Update Gitea to 1.25.4
Back to using the binary from upstream releases
2026-02-13 11:15:07 +01:00
Greg Karekinian
81691f7e21 Run systemctl daemon-reload on gitea service changes 2026-02-13 11:05:08 +01:00
e9dff82628 Merge pull request 'Add IPv6 support for all OpenResty sites' (#618) from feature/614-ipv6 into master
Reviewed-on: #618
2026-02-12 13:09:25 +00:00
0933e9caa0 Add IPv6 to all OpenResty sites
Co-authored-by: Greg Karékinian <greg@karekinian.com>
2026-02-12 17:05:14 +04:00
9f862a89cc Merge pull request 'Enable Gitea SSH via IPv6' (#613) from chore/612-enable_ipv6_ssh into master
Reviewed-on: #613
Reviewed-by: Greg <greg@kosmos.org>
2026-01-11 13:19:33 +00:00
039dbdf091 Enable Gitea SSH via IPv6
closes #612
2026-01-09 13:43:06 +07:00
e3559119be Update node info 2025-11-25 10:56:35 +00:00
16f95170ef Remove old node 2025-11-25 10:55:04 +00:00
36f5903271 Merge pull request 'Fix URL matcher for substr (vs strfry)' (#608) from bugfix/substr_url_matching into master
Reviewed-on: #608
2025-11-17 11:03:48 +00:00
fd9636441b Fix URL matcher for substr (vs strfry)
I wasn't able to reach https://nostr.kosmos.org/nodeinfo/2.1, which I
stumbled upon in an upstream PR. This one only matches exactly the paths
that substr is serving.

Tested/running in production.
2025-11-17 10:47:50 +01:00
aade479e5b Remove obsolete recipe 2025-11-12 13:47:00 +01:00
a3bb927f95 Merge pull request 'Document script that creates VMs' (#604) from feature/244-document_creating_vm into master
Reviewed-on: #604
Reviewed-by: Râu Cao <raucao@kosmos.org>
2025-10-30 16:32:02 +00:00
Greg Karekinian
5b53635f1a Document script that creates VMs
Closes #244
2025-10-30 16:18:59 +01:00
ea087b1e3e Add new Garage nodes 2025-10-24 18:20:06 +02:00
9817589a92 Merge pull request 'Upgrade bitcoind to 30.0' (#603) from chore/upgrade_bitcoind into master
Reviewed-on: #603
2025-10-24 16:18:35 +00:00
d632cafd9c Upgrade bitcoind to 30.0
Also disables building the tests, which eats up more than 5GB of disk space.
2025-10-24 18:16:00 +02:00
87b03d3936 Merge pull request 'Upgrade ejabberd from 23.10 to 25.08' (#602) from chore/upgrade_ejabberd into master
Reviewed-on: #602
Reviewed-by: Greg <greg@kosmos.org>
2025-09-21 11:03:39 +00:00
ae3df992e4 Update node info 2025-09-21 12:45:54 +02:00
2ea5b30224 Upgrade ejabberd to 25.08
Co-authored-by: Greg Karékinian <greg@karekinian.com>
2025-09-21 12:45:20 +02:00
4ef06cb4b7 Merge pull request 'Modernize kosmos-mediawiki cookbook' (#600) from feature/500-chef_upgrade_mediawiki into master
Reviewed-on: #600
Reviewed-by: Râu Cao <raucao@kosmos.org>
2025-09-17 06:41:30 +00:00
73e8a2c413 Fix random port being used for EPMD node
Fixes not being able to join a cluster from other nodes, because the
ports are not within the firewall range of allowed ports.

Co-authored-by: Greg Karékinian <greg@karekinian.com>
2025-09-16 17:48:09 +02:00
ea4713c654 Move firewall config
Co-authored-by: Greg Karékinian <greg@karekinian.com>
2025-09-16 17:47:41 +02:00
dde29c4a6c Upgrade ejabberd to 24.02
Co-authored-by: Greg Karékinian <greg@karekinian.com>
2025-09-16 17:01:43 +02:00
03f1d16998 Update SQL Schema automatically on ejabberd upgrades
Co-authored-by: Greg Karékinian <greg@karekinian.com>
2025-09-16 16:07:10 +02:00
6534086df2 Update logger configuration
* Remove unused/deprecated options
* Hide user IPs
* Set level to "info"

Co-authored-by: Greg Karékinian <greg@karekinian.com>
2025-09-16 16:07:00 +02:00
dbf0e50abf Merge pull request 'Enable unattended-upgrades' (#598) from bugfix/499-unattended_upgrades into master
Reviewed-on: #598
Reviewed-by: Râu Cao <raucao@kosmos.org>
2025-09-10 08:47:52 +00:00
Greg Karekinian
a828d92185 Fix Ruby style
This is using Standard Ruby
2025-09-09 15:29:17 +02:00
Greg Karekinian
0fe6d0bd06 Use the "new" way to set up sasl in the postfix cookbook 2025-09-09 15:28:20 +02:00
Greg Karekinian
9712697569 Fork the postfix cookbook to work around a bug
I ran into the issue described in
https://github.com/sous-chefs/postfix/issues/148
and couldn't figure out a way to work around it without forking it.
2025-09-09 14:54:06 +02:00
Greg Karekinian
d32f276b42 Update akkounts-1 node file after Chef run 2025-09-09 10:13:26 +02:00
Greg Karekinian
cc40c0db19 Configure unattended-upgrades for ESM 2025-09-09 10:12:35 +02:00
41339c1040 Add doc for Mastodon maintenance 2025-07-27 09:17:01 +02:00
Greg Karekinian
0cae8dca69 Set the email sender in unattended-upgrades config
Mailgun was rejecting the email as it did not have a valid sender
(the default, which is something like root@akkounts-1). Unattended
upgrades have been working properly, now we will start getting emails
next time an upgrade is done on akkounts-1.
2025-07-15 10:12:02 +02:00
Greg Karekinian
78e5f810b7 Update node file after Chef upgrade
I ended up upgrading Chef manually on the server as I couldn't using
knife-zero

`curl https://omnitruck.chef.io/install.sh | sudo bash -s -- -P chef -v 18.7.10`
2025-07-09 15:42:30 +02:00
Greg Karekinian
443910c7a2 Modernize kosmos-mediawiki
This has been done with the help of `cookstyle` which is very useful to
learn about breaking changes and updates in Chef.

On wiki-1 I managed to update Chef up to 17.10.163. For version 18 I ran
into an issue with the omnibus installer returning a 404

Refs #500
2025-07-09 11:24:14 +02:00
8052c67d23 Merge pull request 'Opt-out of dotnet telemetry for btcpay' (#599) from feature/441-optout_dotnet_telemetry into master
Reviewed-on: #599
Reviewed-by: Râu Cao <raucao@kosmos.org>
2025-06-25 10:01:58 +00:00
Greg Karekinian
cd269dca03 Also disable dotnet telemetry during the build 2025-06-25 10:35:07 +02:00
Greg Karekinian
7e47c879a1 Remove unused variable 2025-06-25 10:18:57 +02:00
Greg Karekinian
2b49cb1b2b Restart the btcpay service on config changes
It cannot handle reloads
2025-06-25 10:13:25 +02:00
Greg Karekinian
89fa3ede9e Remove the condition on the postgresql
Also move back the environment variable definitions to the hash
2025-06-25 09:51:35 +02:00
Greg Karekinian
efb032fffa Opt-out of dotnet telemetry for btcpay
This is done by setting an environment variable in the systemd unit

Fixes #441
2025-06-24 16:53:59 +02:00
Greg Karekinian
68df49037c Merge remote-tracking branch 'origin/master' into bugfix/499-unattended_upgrades 2025-06-16 16:05:35 +02:00
364adec80f Upgrade LND to 0.19.1 2025-06-16 17:57:30 +04:00
092a2edb3c Update node info 2025-06-16 17:57:04 +04:00
63d0b68c36 Upgrade Deno 2025-06-02 10:53:38 +04:00
3adb2a1aee Adapt strfry config to cookbook changes, increase allowed event size 2025-06-01 20:06:47 +04:00
9cff1fb68b Update node info 2025-06-01 20:06:32 +04:00
Greg Karekinian
773950b9a5 Always send an email on unattended-upgrades 2025-05-31 17:00:07 +02:00
Greg Karekinian
f39a1ed250 Enable unattended-upgrades
We were missing a positive value on
`["apt"]["unattended_upgrades"]["enable"]` to enable it.

Refs #499
2025-05-31 16:44:01 +02:00
3c51ff261e Merge pull request 'Compile Gitea from source, apply our LDAP fixes' (#596) from feature/compile_gitea_from_source into master
Reviewed-on: #596
Reviewed-by: Greg <greg@kosmos.org>
2025-05-31 12:26:28 +00:00
0c62ff6c84 Improve Gitea logging 2025-05-31 15:29:18 +04:00
2c3b381755 Update Gitea stable version 2025-05-31 15:29:03 +04:00
3492bec627 Use Gitea from source 2025-05-31 15:28:33 +04:00
00f4c8bd31 Optionally compile Gitea from source 2025-05-31 15:27:21 +04:00
301596500d Update node info 2025-05-28 10:18:53 +04:00
8a2bfb6b18 Fix attribute
Was moved to a new name since the recipe was created
2025-05-23 14:44:04 +04:00
846bf3483a Update node info 2025-05-23 14:43:40 +04:00
e3ef1dc3b3 Merge pull request 'Upgrade Bitcoin Core, NBXplorer, BTCPay Server' (#595) from chore/upgrade_bitcoin_software into master
Reviewed-on: #595
Reviewed-by: Greg <greg@noreply.kosmos.org>
2025-05-22 12:32:25 +00:00
2089999cc8 Upgrade bitcoind to 29.0, switch to cmake 2025-05-22 15:52:22 +04:00
a4aa29de0c Upgrade NBXplorer, BTCPay Server 2025-05-22 15:50:27 +04:00
98be234a4f Merge pull request 'Configure maximum size and timespan of journald logs' (#594) from feature/506-journald_logs_config into master
Reviewed-on: #594
Reviewed-by: Râu Cao <raucao@kosmos.org>
2025-05-21 12:12:57 +00:00
Greg Karekinian
7dc4f674a0 Use the systemd unit instead of an execute resource
Also extract the attributes so it is possible to override them.
2025-05-21 13:40:12 +02:00
Greg Karekinian
49b636305e Update mastodon-3 node file after Chef run 2025-05-21 11:36:15 +02:00
Greg Karekinian
3e2ee30334 Configure maximum size and timespan of journald logs
Closes #506
2025-05-21 11:36:15 +02:00
d00072ee5a Merge pull request 'Delete old Mastodon media cache every day' (#593) from feature/533-delete_old_mastodon_cached_media into master
Reviewed-on: #593
Reviewed-by: Râu Cao <raucao@kosmos.org>
2025-05-17 07:06:35 +00:00
14687558fe Minor cleanup 2025-05-17 10:55:06 +04:00
de7cc69505 Allow more users per room 2025-05-17 10:42:41 +04:00
Greg Karekinian
b01315f998 Delete old Mastodon media cache every day
This is done using a systemd timer

Closes #533
2025-05-16 19:12:47 +02:00
160134bd86 Allow more ejabberd API calls from akkounts 2025-05-16 15:17:43 +04:00
766030d716 Merge pull request 'Adapt akkounts recipes for config changes' (#592) from chore/rails_deployment into master
Reviewed-on: #592
Reviewed-by: Greg <greg@noreply.kosmos.org>
2025-05-06 17:11:24 +00:00
3c436bb9f1 Configure LDAP for akkounts, add more Rails credentials 2025-05-06 19:41:54 +04:00
d029d90214 Generate postgres user/db for akkounts, use credentials from env
Co-authored-by: Greg Karékinian <greg@karekinian.com>
2025-05-06 15:49:43 +04:00
f8e5fd2f3e Fix missing dir for Mastodon maintenance file 2025-04-29 17:53:05 +04:00
cab766c806 Update node.js, install bun, for Rails 8.0 upgrade 2025-04-29 17:51:53 +04:00
5777a45f0a Fix/improve ejabberd cert renewals 2025-04-22 17:28:44 +04:00
f23c37312e Update deno cookbook 2025-04-18 16:21:07 +04:00
cf1ef4f2f4 Merge pull request 'Upgrade Gitea, disable downloads of repo archives' (#588) from chore/upgrade_gitea into master
Reviewed-on: #588
2025-04-09 13:28:28 +00:00
f65256d229 Disable downloads of repo archives 2025-04-09 17:25:41 +04:00
2cc0ee5b8a Upgrade Gitea to 1.23.7 2025-04-09 17:25:17 +04:00
10e8ba5569 Add missing CORS headers to host-meta.json
Otherwise XMPP Web clients cannot fetch the Bosh and WS endpoint info
2025-04-08 00:10:29 +04:00
6c35a20b89 Merge pull request 'Upgrade rskj to 7.0.0' (#587) from chore/upgrade_rskj into master
Reviewed-on: #587
2025-04-05 09:14:25 +00:00
e3d9a50f09 Upgrade Gitea to 1.23.6 2025-04-04 18:53:46 +04:00
c4652ca2eb Upgrade rskj to 7.0.0 2025-04-04 16:59:11 +04:00
56440bfd89 Merge pull request 'Upgrade nbxplorer, BTCPay Server' (#586) from chore/upgrade_btcpay into master
Reviewed-on: #586
2025-03-25 10:08:06 +00:00
abee2407bf Upgrade nbxplorer, BTCPay Server 2025-03-25 14:03:34 +04:00
0cef08fb7b Merge pull request 'Update Gandi API token' (#585) from chore/update_gandi_token into master
Reviewed-on: #585
2025-03-19 14:02:49 +00:00
f246f63594 Update Gandi API token
For certbot renewals. Also set resource to sensitive in ejabberd recipe.

Co-authored-by: Greg Karékinian <greg@karekinian.com>
2025-03-19 18:01:50 +04:00
2dee25bf23 Update node info 2025-03-19 18:00:07 +04:00
a28d31b415 Upgrade Gitea to 1.23.5 2025-03-05 14:09:03 +04:00
0bf50bce2e Merge pull request 'Fix postgres running out of available connection slots' (#584) from bugfix/gitea_db_connections into master
Reviewed-on: #584
2025-03-05 10:03:51 +00:00
6be99aa3de Cap maximum open database connections
Fixes Gitea opening too many connections, which can impact other apps
trying to connect as well.
2025-03-05 13:53:33 +04:00
90bf66ada9 Upgrade Gitea to 1.23.4 2025-02-21 10:12:27 +04:00
32cfd6401f Upgrade LND to 0.18.5
Urgent security upgrade
2025-02-19 14:19:10 +04:00
1124f25069 Upgrade Gitea to 1.23.3 2025-02-12 11:51:14 +04:00
f34c7ecd9b Merge pull request 'Publish daily BTC price in public remoteStorage' (#581) from feature/btc-rate-tracker into master
Reviewed-on: #581
Reviewed-by: Greg <greg@noreply.kosmos.org>
2025-01-23 13:28:33 +00:00
8d149a475d Merge pull request 'Upgrade Gitea to 1.23.1' (#582) from chore/upgrade_gitea into master
Reviewed-on: #582
2025-01-22 14:41:19 +00:00
905a67475b Upgrade Gitea to 1.23.1 2025-01-22 09:36:33 -05:00
8251fa83ce Merge pull request 'Deploy substr' (#579) from feature/substr into master
Reviewed-on: #579
2025-01-22 14:27:02 +00:00
0fa61a585e DRY up code, add GBP rates 2025-01-17 14:52:28 -05:00
89f1790afc Publish daily BTC price in public remoteStorage 2025-01-17 10:42:09 -05:00
72ac8c6a84 Update akkounts credentials 2025-01-17 09:17:43 -05:00
b1bb5d0625 Use default value for STUN credentials lifetime 2025-01-14 15:30:42 -05:00
b470110fd4 Upgrade Gitea to 1.22.6 2024-12-16 12:10:08 +04:00
31b7ff9217 Upgrade Gitea to 1.22.5 2024-12-12 18:32:58 +04:00
d90a374811 Remove outdated flag from certbot command 2024-12-12 18:32:26 +04:00
12cd14fff5 Deploy new postgres primary 2024-12-12 18:31:54 +04:00
b67d91077d Remove old garage nodes 2024-12-12 18:30:16 +04:00
070badfeb3 Add postgres replica bootstrap example 2024-12-12 18:29:16 +04:00
4ce39738fd Allow larger bodies for Gitea file uploads
Needed for uploading larger packages to the registry
2024-12-09 21:19:39 +04:00
d35e57b90e Deploy substr 2024-12-09 21:19:13 +04:00
2d8a1cebb1 Update node info 2024-12-09 20:44:18 +04:00
c8160e38c8 Turn known pubkeys into object with usernames 2024-12-09 18:21:55 +04:00
67cd89b7b8 Merge pull request 'Fix TLS cert updates for kosmos.chat' (#578) from chore/fix_cert_updates_kosmos-chat into master
Reviewed-on: #578
2024-12-09 14:21:05 +00:00
e4112a3626 Fix TLS cert updates for kosmos.chat
Some recipes weren't updated for the proxy validation yet. Needed to
split the ejabberd cert in two, so it can do normal validation on
`.org` and proxy validation on `.chat`.
2024-12-09 18:17:10 +04:00
89813465b2 Merge pull request 'Upgrade Mastodon to 4.3' (#577) from chore/upgrade_mastodon into master
Reviewed-on: #577
2024-12-09 14:14:35 +00:00
6106e627e2 Upgrade Mastodon to 4.3
Co-authored-by: Greg Karékinian <greg@karekinian.com>
2024-12-09 18:12:45 +04:00
d8baa41c14 Add new node configs 2024-12-09 18:11:51 +04:00
8405b8df52 Merge pull request 'Upgrade lndhub.go to 1.0.2, add service fee config' (#576) from chore/upgrade_lndhub into master
Reviewed-on: #576
Reviewed-by: Greg <greg@noreply.kosmos.org>
2024-10-20 19:27:19 +00:00
775f2275bb Upgrade Gitea to 1.22.3 2024-10-19 14:42:11 +02:00
b4019b224b Upgrade lndhub.go to 1.0.2, add service fee config
Co-authored-by: Michael Bumann <hello@michaelbumann.com>
2024-10-18 12:36:41 +02:00
52841d8c53 Add WKD endpoint to website nginx conf 2024-10-17 11:58:53 +02:00
b9b97d5056 Fix mail server VM backups 2024-10-16 12:48:08 +02:00
e5448aa85c Merge pull request 'Upgrade strfry, add new Kosmos profile/pubkey, relay icon' (#575) from chore/upgrade_strfry into master
Reviewed-on: #575
2024-10-16 10:44:47 +00:00
4d1125ac2b Upgrade strfry to 1.0.1
Also set up and use a new Kosmos pubkey/profile and add a relay icon
2024-10-16 12:42:49 +02:00
3853f94ae0 Use new proxy domain for ejabberd cert 2024-10-16 12:40:10 +02:00
d1097c7688 Fix and improve nginx redirects, akkounts headers 2024-10-16 12:39:34 +02:00
7949fd067c Add IPv6 support for nostr.kosmos.org 2024-10-16 12:37:47 +02:00
0726e58f7c Update ejabberd LDAP filter for new akkounts release 2024-10-16 12:36:30 +02:00
fe581c348a Fix bookmarks disappearing for XMPP users
The limit for PEP nodes was ridiculously low. No idea why, but it means
users were only able to save 10 items (e.g. channel bookmarks) at once.
2024-10-16 12:34:31 +02:00
af62078960 Update node info 2024-10-16 12:34:17 +02:00
9b4deff91e Remove cln from bitcoin-2 node 2024-10-16 12:34:01 +02:00
0944bc5266 Merge pull request 'Migrate S3 backups from AWS, fix automatic cleanups' (#574) from chore/move_fix_s3_backups into master
Reviewed-on: #574
2024-10-16 10:33:24 +00:00
eb06926606 Migrate S3 backups from AWS, fix automatic cleanups
The cleanups were broken in that every single archive was also copied to
a shared folder and never deleted from there.

Co-authored-by: Greg Karékinian <greg@karekinian.com>
2024-10-16 12:31:51 +02:00
15096ca17b Merge pull request 'Bitcoin-related software upgrades' (#573) from chore/bitcoin_upgrades into master
Reviewed-on: #573
2024-10-16 10:25:53 +00:00
3551b71154 Add sensitive attribute to resource with credentials 2024-10-16 12:23:38 +02:00
752bb74663 Remove boltz service and RTL integration
We use peerswap these days, and the build process for boltz was made
much more complicated at some point. Not worth upgrading for us.
2024-10-16 12:23:38 +02:00
c64526a944 Upgrade RTL to v0.15.2
Need to use `npm install --force` due to a dependency issue
2024-10-16 12:23:38 +02:00
da242d4817 Upgrade LND to 0.18.3 2024-10-16 12:23:29 +02:00
0af4bc1d0d Upgrade bitcoind to 28.0
Requires a newer C++ compiler
2024-10-16 11:28:13 +02:00
c9f5a745a3 Merge pull request 'Fix Mastodon signup/password/confirmation links' (#570) from chore/562-mastodon_login_urls into master
Reviewed-on: #570
Reviewed-by: Greg <greg@noreply.kosmos.org>
2024-08-23 14:18:12 +00:00
d935b99d7d Fix Mastodon signup/password/confirmation links
Adds ENV vars for our custom fix in b916182bc1

fixes #562
2024-08-22 21:51:49 +02:00
d048bbb297 Merge pull request 'Upgrade Gitea to 1.22.1' (#568) from chore/upgrade_gitea into master
Reviewed-on: #568
2024-08-10 11:45:39 +00:00
61bd121709 Upgrade Gitea to 1.22.1 2024-08-10 13:44:39 +02:00
ec9b912e45 Merge pull request 'Configure nginx default vhost, add specific redirects for some domains' (#565) from chore/nginx_redirects into master
Reviewed-on: #565
2024-08-09 12:44:29 +00:00
d53ba42a1d Make kosmos.org the default nginx vhost 2024-08-04 16:51:57 +02:00
a99f7f7574 Add config for accounts .well-known proxyying 2024-08-04 16:51:18 +02:00
1c8ee14bb3 Add HTTP redirects for kosmos.chat and kosmos.cash 2024-08-04 16:49:20 +02:00
cdedf49be3 Merge pull request 'Fix download URLs for Mastodon exports/archives' (#564) from bugfix/mastodon_archive_download_urls into master
Reviewed-on: #564
2024-08-04 14:46:26 +00:00
5e727ec279 Fix download URLs for Mastodon exports/archives
See https://github.com/mastodon/mastodon/issues/24380
2024-08-04 14:55:22 +02:00
9d928298d2 Fix Gitea user/repo avatar URLs in certain situations
I encountered a CORS proxy which somehow ended up with http://_gitea_web
URLs.
2024-07-10 11:36:07 +02:00
1174661b46 Use proxy domain for RS Discourse ACME challenge 2024-07-08 20:31:46 +02:00
2dff7cf850 Merge pull request 'Add new service: nostr.kosmos.org (members-only nostr relay)' (#559) from feature/strfry into master
Reviewed-on: #559
Reviewed-by: Greg <greg@noreply.kosmos.org>
2024-07-05 07:33:40 +00:00
232360efba Remove commented code 2024-07-03 09:23:13 +02:00
8b8e8f3438 Move strfry extras into their own directory 2024-07-03 09:22:50 +02:00
522c213b09 Add Deno lockfile 2024-06-20 18:16:27 +02:00
80eddfbf56 Configure strfry whitelist
Allow akkounts pubkey to publish to our own relay
2024-06-20 15:38:27 +02:00
7e664723a1 Configure akkounts nostr relay URL in production 2024-06-20 15:04:17 +02:00
f5961af7fe Create/deploy strfry VM 2024-06-11 23:17:33 +02:00
d1301dad3e Add, configure, deploy strfry policies 2024-06-11 23:12:22 +02:00
42c46a5645 Deploy strfry reverse proxy 2024-06-11 23:10:24 +02:00
5be9081613 Header name has to be all lowercase in strfry config 2024-06-11 23:09:49 +02:00
1649d03665 Update strfry cookbook 2024-06-11 23:09:48 +02:00
b9a3910364 Update strfry cookbook 2024-06-11 23:09:48 +02:00
9835b85181 Fall back to default port for strfry proxy
When we don't override it elsewhere
2024-06-11 23:09:48 +02:00
dbccd9d2bf Add kosmos_strfry cookbook, configs 2024-06-11 23:09:48 +02:00
1a5f312699 Add strfry cookbook 2024-06-11 23:09:48 +02:00
f843a31e03 Merge pull request 'Improve mail server TLS certificate management' (#556) from chore/mail_server_cert into master
Reviewed-on: #556
Reviewed-by: Greg <greg@noreply.kosmos.org>
2024-06-05 14:49:01 +00:00
ff313525c8 Reload postfix and dovecot on cert renewal
closes #552

Co-authored-by: Greg Karékinian <greg@karekinian.com>
2024-06-05 16:44:18 +02:00
cfb379741e Add imap and smtp subdomains to mail server cert
closes #543

Co-authored-by: Greg Karékinian <greg@karekinian.com>
2024-06-05 15:55:29 +02:00
0c29fad404 Remove superfluous license header
Co-authored-by: Greg Karékinian <greg@karekinian.com>
2024-06-05 15:50:09 +02:00
416935d8b5 Merge pull request 'Upgrade Gitea to 1.22' (#555) from chore/upgrade_gitea into master
Reviewed-on: #555
2024-06-02 21:18:07 +00:00
2b6f81c5d6 Upgrade Gitea to 1.22 2024-06-02 23:17:16 +02:00
18496bb0da Merge pull request 'Configure akkounts for nostr zaps' (#554) from chore/akkounts_config into master
Reviewed-on: #554
2024-06-02 21:05:15 +00:00
d878b4208e Configure akkounts for nostr zaps 2024-06-02 23:03:06 +02:00
d31440d235 Add CORS headers to kosmos.social LNURL paths 2024-06-02 23:02:22 +02:00
6f287f14ef Deploy live branch 2024-06-02 23:01:49 +02:00
b77df3d0db Update email aliases 2024-05-16 14:34:09 +02:00
f7f5a0069d Merge pull request 'Add support for proxy domain validation to tls_cert resource' (#553) from feature/letsencrypt_proxy_validation into master
Reviewed-on: #553
Reviewed-by: Greg <greg@noreply.kosmos.org>
2024-05-08 12:30:29 +00:00
989185f951 Support proxy domain validation for Garage web domains
Also rename the data bag item
2024-04-30 12:23:36 +02:00
4cbda69a6b Add support for proxy domain validation to tls_cert resource 2024-04-26 12:24:17 +02:00
6931fe05d0 Hide Gitea version and load times in footer 2024-04-07 13:16:19 +03:00
b248ef70db Upgrade Gitea to 1.21.10 2024-04-07 13:10:10 +03:00
45159ad4e7 Resolve Mastodon addresses as Lightning Address 2024-03-31 08:27:20 +04:00
612cd0c55e Merge pull request 'Configure LDAP login for Mastodon (merge .social and .org accounts)' (#551) from feature/mastodon_ldap_integration into master
Reviewed-on: #551
Reviewed-by: Greg <greg@noreply.kosmos.org>
2024-03-29 09:51:42 +00:00
83380047bb Configure LDAP integration for Mastodon 2024-03-29 09:28:13 +04:00
8aebb386a4 Configure Mastodon user address domain for akkounts 2024-03-27 20:19:24 +04:00
a8c4f0bd0e Merge pull request 'Only allow ejabberd logins when XMPP service is enabled for user' (#550) from feature/xmpp_service_enabled into master
Reviewed-on: #550
2024-03-27 16:17:04 +00:00
12b4fb37fa Only allow ejabberd logins when XMPP service is enabled 2024-03-27 20:12:33 +04:00
263eb88b72 Add new env var for akkounts 2024-03-14 23:05:05 +01:00
25ee38fe27 Update kredits-ipfs-pinner 2024-03-14 23:04:27 +01:00
e701938442 Merge pull request 'Support letsencrypt proxy validation via CNAMEs' (#548) from feature/letsencrypt_proxy_validation into master
Reviewed-on: #548
Reviewed-by: greg <greg@noreply.kosmos.org>
2024-03-12 14:11:14 +00:00
309bc45791 Merge pull request 'Fix backup script removing image after unsuccessful pivot' (#549) from bugfix/vm_backups into master
Reviewed-on: #549
2024-03-11 15:35:50 +00:00
82a4af05ef Fix backup script removing image after unsuccessful pivot
If pivoting the VM backing storage back to the original image fails
(e.g. VM being down at that time), the script currently still deletes
the hotswap image, which means that all changes since the creation of
the hotswap image are lost.
2024-03-11 16:26:14 +01:00
4a8ab3abe3 Support letsencrypt proxy validation via CNAMEs
Allows to point other domains' `_acme-challenge.example.com` entries at
`example.com.letsencrypt.kosmos.chat` so we can validate from our side
without access to the other domain's DNS records.

Used for 5apps.com XMPP for now. Can be used for others later.

Co-authored-by: Greg Karékinian <greg@karekinian.com>
2024-03-11 16:21:28 +01:00
21de964e1b Upgrade nbxplorer, btcpay 2024-03-11 16:14:03 +01:00
b4ddfd19e3 Upgrade Ruby for latest Mastodon release 2024-03-11 16:13:48 +01:00
08c604962c Upgrade Ruby for latest akkounts release 2024-03-11 16:13:30 +01:00
089574d0de Merge pull request 'Update Gitea and act_runner, improve recipes' (#547) from chore/upgrade_gitea into master
Reviewed-on: #547
2024-03-11 15:12:00 +00:00
d19a8eebfb Update Gitea and act_runner, improve recipes 2024-03-11 16:11:12 +01:00
c0487d0e13 Deploy 5apps Gitea act runner 2024-03-11 16:08:22 +01:00
023a4261cd Update node info 2024-03-11 16:07:32 +01:00
fea65404cf Deploy new garage node 2024-03-11 16:03:22 +01:00
5139f242a4 Merge pull request 'Switch postgresql primary, deploy new replica' (#546) from switch_postgres_primary into master
Reviewed-on: #546
2024-03-11 14:59:57 +00:00
9c2aa9faaa Add info about required, unautomated step to script 2024-03-11 15:57:46 +01:00
164b974eb8 Switch postgresql primary, deploy new replica 2024-03-11 15:55:05 +01:00
6e4cc48068 Upgrade Gitea to 1.21.5 2024-02-05 14:39:12 +02:00
c2bd03dc23 Update node info 2024-02-05 10:14:27 +02:00
210a83a686 Increase max user offline messages for ejabberd 2024-02-04 15:47:55 +02:00
49db14869d Merge pull request 'Add Liquor Cabinet cookbooks and configs, deploy to production' (#541) from feature/535-liquor_cabinet into master
Reviewed-on: #541
2024-02-04 13:47:05 +00:00
000a13cec4 Merge pull request 'Set up coturn, switch from ejabberd in production' (#532) from feature/coturn into master
Reviewed-on: #532
2024-02-04 13:46:50 +00:00
5f7701c288 Fix missing listen IP for storage proxy 2024-01-29 18:16:07 +02:00
bcaee3bb21 Fix ActiveStorage not liking the local S3 endpoint 2024-01-29 18:15:36 +02:00
f352901582 Consolidate akkounts well-known proxying, add Webfinger and Nostr
refs #158
2024-01-29 14:17:15 +02:00
5c1c63f94e Add S3/Garage config for akkounts 2024-01-26 10:40:36 +03:00
98543f3e7d Configure RS integration for akkounts 2024-01-26 09:01:55 +03:00
7ab83d3d82 Section header comments for ENV vars
Improve readability of recipe
2024-01-26 09:00:25 +03:00
b5020efdd5 Merge branch 'master' into feature/535-liquor_cabinet 2024-01-26 08:19:50 +03:00
2763244fdc Merge pull request 'Config updates and improvements for new akkounts release' (#542) from chore/akkounts_updates into master
Reviewed-on: #542
2024-01-26 05:19:16 +00:00
e10e54c12a Deploy liquor-cabinet proxy to production 2024-01-26 08:16:26 +03:00
6114f0f799 Add liquor-cabinet proxy recipe 2024-01-26 08:15:53 +03:00
a2ec41b68a Add/use kosmos_liquor-cabinet cookbook 2024-01-25 17:42:56 +03:00
715fdbc2ba Node-attribute ALL THE THINGS 2024-01-25 17:40:42 +03:00
211a613e5c Add liquor-cabinet configs, deploy to production 2024-01-25 16:27:31 +03:00
d3c22ea787 Add liquor_cabinet cookbook 2024-01-25 16:26:41 +03:00
6047ea3f84 Merge pull request 'Add support for Redis replication, set up in production' (#540) from feature/redis_replication into master
Reviewed-on: #540
2024-01-25 10:19:12 +00:00
7d478f0183 Set up Redis replication in production 2024-01-24 18:12:22 +03:00
88e96747e3 Add Redis replica recipe and role 2024-01-24 18:11:58 +03:00
4b04aa7cd9 Let akkounts API proxy forward all API requests
... instead of just a specific subdirectory/path
2024-01-24 16:19:04 +03:00
2597e211ed Add new akkounts configs 2024-01-24 16:18:50 +03:00
f96faf9fa2 Install libvips for image manipulation in akkounts 2024-01-24 16:18:19 +03:00
c32e8bc9e5 Add new garage nodes 2024-01-11 18:38:22 +03:00
Râu Cao
24b22b8f91 Merge pull request 'Add email service' (#526) from feature/email into master
Reviewed-on: #526
2024-01-10 12:09:21 +00:00
456ec7a5fa Deploy new email VM 2024-01-09 15:57:04 +03:00
daadd9374f Use attribute for root dir 2024-01-08 11:35:04 +03:00
98acd429de Add configs for virtual email aliases 2024-01-08 11:29:56 +03:00
cfa7da2051 Create vmail dir on fresh systems 2024-01-08 10:47:19 +03:00
0d3082e1c8 Upgrade Gitea to 1.21.3 2024-01-01 16:13:15 +03:00
e1007f7886 ejabberd disco config additions 2023-12-18 13:23:21 +01:00
292366a77f Domain vs realm vs IP 2023-12-18 13:23:05 +01:00
ed998fc1d3 Use TCP for TLS connections 2023-12-18 13:22:34 +01:00
8a97ebf4f8 Use domain instead of IP, add TLS endpoints 2023-12-17 17:57:49 +01:00
ca3f06f831 Increase size of port range for TURN 2023-12-17 17:05:06 +01:00
1576a8e731 Set up coturn, switch from ejabberd in production
https://github.com/coturn/coturn
2023-12-17 15:20:11 +01:00
6e3fb80565 Upgrade CLN 2023-12-16 19:23:09 +01:00
Râu Cao
295d95c048 Upgrade Gitea to 1.21.1 2023-12-16 11:49:35 +01:00
789532fae9 Merge pull request 'Upgrade bitcoind, LND, CLN, RTL, NBXplorer, BTCPay' (#531) from chore/upgrade_bitcoin_software into master
Reviewed-on: #531
2023-12-14 17:15:40 +00:00
Râu Cao
404f492e6e Update node info 2023-12-14 18:14:37 +01:00
Râu Cao
574f78f128 Upgrade bitcoind, LND, CLN, RTL, NBXplorer, BTCPay
Also required upgrading node.js and the .NET SDK.
2023-12-14 18:12:29 +01:00
f4d1009473 Merge pull request 'Switch to virtual domains/aliases/mailboxes' (#530) from feature/email_virtual_domains into feature/email
Reviewed-on: #530
2023-12-13 12:06:44 +00:00
Râu Cao
69af908f6b Virtual domain configs 2023-12-13 13:05:31 +01:00
Râu Cao
e8880ded90 Remove vagrant (dev) node config files
No need for sharing them, since the actual roles etc. are defined in the
Vagrantfile.
2023-12-07 10:37:09 +01:00
Râu Cao
10dd3bf16e Add new RSK testnet node, don't serve from current one 2023-12-07 09:55:29 +01:00
Râu Cao
ca580bcfe2 Set email report contact in production 2023-12-07 09:37:37 +01:00
5b0cb438ba Merge pull request 'Set up SpamAssassin' (#529) from feature/spamassassin into feature/email
Reviewed-on: #529
2023-12-06 11:28:14 +00:00
Râu Cao
5a4cdf9c30 Prevent local users from impersonating other local users 2023-12-06 12:27:38 +01:00
Râu Cao
b3f2ca415e Set up SpamAssassin
Scan incoming and outgoing email for spam. Use a local Unbound for DNS,
so we don't run into blocks for RBL queries.
2023-12-06 12:22:24 +01:00
Râu Cao
05ccbcc58f Merge branch 'master' into feature/email 2023-12-05 18:37:43 +01:00
Râu Cao
e3c4bf8969 Update node config 2023-12-05 18:21:26 +01:00
Râu Cao
cc6cebb8a2 Increase TURN throughput allowance 2023-12-05 18:20:27 +01:00
Râu Cao
4dbc960eed Switch ejabberd node handling TURN
Should use the same outgoing IP as for incoming
2023-12-05 18:19:48 +01:00
ce47072b0d Merge pull request 'Improve VM backups, configure backups on "her"' (#528) from feature/backup_improvements into master
Reviewed-on: #528
2023-12-05 17:18:40 +00:00
Râu Cao
7805182457 Change borg backup default interval to 3 hrs 2023-12-05 18:16:15 +01:00
Râu Cao
769ac4a081 Support node-specific borg repo config 2023-12-05 18:09:44 +01:00
Râu Cao
b1763cd032 Pattern-match node names for VM backup exclusion 2023-12-05 18:04:57 +01:00
Râu Cao
c746b38ebf Update node info 2023-12-05 14:19:52 +01:00
0a58cac0cf Merge pull request 'Set up DKIM signing and verification' (#527) from feature/email_dkim into feature/email
Reviewed-on: #527
2023-12-04 12:42:37 +00:00
Râu Cao
42c04538d8 Set up DKIM signing and verification 2023-12-04 13:40:37 +01:00
Râu Cao
c9ad3c2d18 Create/configure common default mailboxes 2023-12-04 13:33:23 +01:00
Râu Cao
fbad0bf896 More explicit postfix configs 2023-12-03 18:33:12 +01:00
Râu Cao
8a7eeb1dd9 Change INBOX location 2023-12-03 18:32:55 +01:00
Râu Cao
568197737a Fix SMTP connection delay when peer hostname cannot be resolved 2023-12-03 18:31:47 +01:00
Râu Cao
738e96f7e4 Fix auth for SMTP submission on port 465 2023-12-03 18:31:12 +01:00
Râu Cao
87411274ae Configure email domain for production 2023-12-03 18:29:35 +01:00
Râu Cao
ce00852bba Remove obsolete config file 2023-12-01 12:19:21 +01:00
Râu Cao
366c0c0d3c Add WIP email domain and hostname 2023-12-01 10:02:25 +01:00
Râu Cao
89d00afd1c Set up email proxy 2023-12-01 10:02:11 +01:00
Râu Cao
e4abfb1b75 Use more reasonable priority for attributes in recipe 2023-12-01 10:01:34 +01:00
Râu Cao
335a082171 Put an LDAP server in the production env 2023-12-01 10:00:35 +01:00
Râu Cao
9d0ff358ef Only use certbot deploy hook when applicable 2023-12-01 10:00:07 +01:00
Râu Cao
495a4231fb Add mail server node 2023-12-01 09:59:41 +01:00
Râu Cao
51068e5259 Add email credentials 2023-12-01 09:58:25 +01:00
Râu Cao
fbcf1ed5e7 WIP Add initial cookbook and roles for email service 2023-12-01 09:56:54 +01:00
Râu Cao
158a9c2fbe Update postfix cookbook 2023-11-29 22:26:59 +01:00
Râu Cao
1e9878d17e Remove obsolete clients 2023-11-28 22:43:21 +01:00
Râu Cao
3df7a386e6 Remove rsk-testnet-3 2023-11-28 22:43:21 +01:00
cbeddefa34 Merge pull request 'Set max size for external S3 upload requests' (#525) from bugfix/s3_nginx_max_upload_size into master
Reviewed-on: #525
2023-11-15 13:04:34 +00:00
Râu Cao
aefd01d38d Remove old RSK mainnet node 2023-11-15 13:22:15 +01:00
Râu Cao
5765c08d6e Fail over to next node when and RSK backend is down 2023-11-15 13:21:46 +01:00
Râu Cao
aaae90bc0d Don't exit VM backup scripts immediately on failures 2023-11-15 13:20:42 +01:00
Râu Cao
087616b6b6 Set max size for external S3 upload requests
Fix uploads failing when exceeding the default nginx limit
2023-11-08 21:44:49 +01:00
Râu Cao
390753faa3 Increase update delay for Gandi DNS records 2023-11-05 01:01:16 +01:00
Râu Cao
1a3516904d Update node info 2023-11-05 01:01:04 +01:00
adafb132ee Merge pull request 'Upgrade Mastodon to 4.2.1' (#524) from chore/upgrade_mastodon into master
Reviewed-on: #524
2023-11-05 00:00:51 +00:00
Râu Cao
8071f44f41 Upgrade Mastodon to 4.2.1 2023-11-05 00:57:43 +01:00
Râu Cao
05d04fe76c Update node info 2023-11-04 15:25:01 +01:00
231811f9d0 Merge pull request 'Upgrade Gitea to 1.20.5' (#523) from chore/upgrade_gitea into master
Reviewed-on: #523
2023-11-04 14:15:47 +00:00
Râu Cao
9fa7d8b28f Upgrade Gitea to 1.20.5 2023-11-04 15:14:58 +01:00
5fbc48df9a Merge pull request 'Upgrade RSKj to 5.3.0, deploy new nodes' (#522) from chore/upgrade_rskj_jammy into master
Reviewed-on: #522
2023-11-04 14:09:30 +00:00
Râu Cao
925a5da239 Upgrade RSKj to 5.3.0, deploy new nodes
Adapted the cookbook for new nodes running on Jammy.
2023-11-04 15:06:31 +01:00
Râu Cao
3d3156a031 Add new host 2023-11-01 12:39:17 +01:00
2c33ee79f2 Merge pull request 'Upgrade ejabberd to 23.10, enable anonymous occupant IDs' (#520) from chore/upgrade_ejabberd into master
Reviewed-on: #520
2023-11-01 11:32:18 +00:00
Râu Cao
abc168ebf1 Upgrade ejabberd to 23.10, enable anonymous occupant IDs 2023-11-01 12:29:23 +01:00
873c235539 Merge pull request 'Migrate ejabberd uploads to mod_s3_upload and Garage' (#518) from feature/469-ejabberd_s3 into master
Reviewed-on: #518
2023-10-17 19:07:23 +00:00
Râu Cao
65d71d6a73 Migrate ejabberd uploads to mod_s3_upload and Garage
In addition to installing and configuring the new module, this also
enables public access to the S3 API via `bucket-name.s3.kosmos.org` as
well as Web access on `bucket-name.web.s3.kosmos.org` (when enabled).

Also includes some drive-by improvements to Chef attribute naming and
usage.

Co-authored-by: Greg Karékinian <greg@karekinian.com>
2023-10-10 17:55:55 +02:00
Râu Cao
832075dfb2 Shorten root domains for external Garage S3 and Web access
And move the configuration-specific preceding dot to the config
template.
2023-10-10 16:34:23 +02:00
1c9e28448f Merge pull request 'Improve PostgreSQL streaming replication in production' (#516) from feature/keep_wal_segments into master
Reviewed-on: #516
2023-10-07 08:18:24 +00:00
Râu Cao
3505212e92 Add missing header to RS discourse proxy config 2023-10-04 12:36:07 +02:00
Râu Cao
2d3872a692 Update chef client on postgres-4
refs #500
2023-10-02 15:48:50 +02:00
Râu Cao
eb1303a8da Fix postgres primary not holding onto any WAL segments for later sync
closes #515
2023-10-02 15:46:26 +02:00
9af38219af Merge pull request 'Upgrade bitcoind, LND, .NET, NBXplorer, and BTCPay' (#514) from chore/upgrade_btc_things into master
Reviewed-on: #514
2023-09-28 14:44:00 +00:00
Râu Cao
08d9819fd2 Upgrade bitcoind, LND, dotnet, NBXplorer, and BTCPay 2023-09-28 16:41:44 +02:00
Râu Cao
f0968aae5b Add Drone CI config for akkounts 2023-09-01 12:51:40 +02:00
b4ce426ce9 Merge pull request 'Upgrade Gitea to 1.20.3, Chef client to 18.x' (#512) from chore/upgrade_gitea into master
Reviewed-on: #512
2023-08-25 15:14:46 +00:00
Râu Cao
e65c58ff6c Upgrade Gitea to 1.20.3, Chef client to 18.x 2023-08-25 17:12:33 +02:00
cc8264432c Merge pull request 'Migrate nginx sites to openresty' (#511) from chore/migrate_nginx_sites_to_openresty into master
Reviewed-on: #511
2023-08-01 13:02:32 +00:00
Râu Cao
1650e429a8 Migrate fornax nginx to openresty 2023-07-31 15:57:13 +02:00
Râu Cao
123b304dd0 Use correct node attributes 2023-07-31 15:57:07 +02:00
Râu Cao
bbd25ebb9c Add nginx logs for gitea 2023-07-31 15:56:40 +02:00
Râu Cao
ec43f4ee0f Update openresty cookbook 2023-07-31 15:56:20 +02:00
Râu Cao
eab94090e8 Use openresty node attributes in openresty templates 2023-07-31 15:07:35 +02:00
Râu Cao
7f2805831c Remove obsolete cookbook 2023-07-31 15:07:18 +02:00
Râu Cao
0f12a54eab Refactor tor usage entirely
Use a custom resource and separate recipe for service configs with
pre-set keys and hostnames
2023-07-30 12:39:41 +02:00
Râu Cao
68b56789c5 Migrate ejabberd UDP streams to openresty
And remove the other streams in the process, in favor of running haproxy
on all LBs.
2023-07-30 12:39:36 +02:00
Râu Cao
438ee4ace0 Migrate Gitea SSH stream to openresty 2023-07-30 12:35:21 +02:00
Râu Cao
27bdc1f60d Update openresty cookbook 2023-07-30 12:34:21 +02:00
Râu Cao
cb0fc27134 Refactor tor usage, set up new tor proxy on draco 2023-07-29 16:26:20 +02:00
Râu Cao
b149264919 Use paths from node attributes 2023-07-29 14:30:46 +02:00
Râu Cao
53c35fda51 Migrate garage proxies to openresty 2023-07-26 16:42:48 +02:00
Râu Cao
bb2f41fdb3 Migrate hubot proxies to openresty 2023-07-26 16:21:03 +02:00
Râu Cao
027d0ed570 Migrate IPFS proxies to openresty 2023-07-26 16:12:33 +02:00
Râu Cao
1362da0add Migrate RS Discourse proxy to openresty 2023-07-26 15:57:08 +02:00
Râu Cao
15b2ea284a Migrate mastodon proxy to openresty 2023-07-26 15:44:04 +02:00
Râu Cao
ad59913555 Migrate lndhub proxy to openresty 2023-07-26 15:00:55 +02:00
Râu Cao
1bad2939de Migrate accounts API proxy to openresty 2023-07-26 15:00:43 +02:00
Râu Cao
7b5d46c813 Update openresty cookbook 2023-07-26 14:52:16 +02:00
Râu Cao
98d423aa70 Update roles 2023-07-26 14:16:33 +02:00
Râu Cao
4b14297f83 WIP Migrate Gitea proxy to openresty
TODO: Make nginx_ssh stream resource work with openresty cookbook
2023-07-26 14:15:46 +02:00
Râu Cao
1681942fb1 Migrate static website to openresty 2023-07-26 14:15:22 +02:00
Râu Cao
4d528d67ef Migrate RSK proxies to openresty 2023-07-26 14:08:44 +02:00
Râu Cao
53abc2ec9a Migrate Drone CI proxy to openresty 2023-07-26 14:07:48 +02:00
Râu Cao
543b482adb Migrate discourse proxy to openresty 2023-07-26 13:40:19 +02:00
Râu Cao
87657db8a7 Update openresty cookbook 2023-07-26 13:39:07 +02:00
Râu Cao
4b0b4b8d80 Migrate akkounts proxy to openresty 2023-07-26 13:31:28 +02:00
Râu Cao
77c97607d5 Update openresty cookbook 2023-07-26 13:31:27 +02:00
Râu Cao
4b08e4fc8c Add JSON log format to openresty 2023-07-26 13:31:23 +02:00
507a812f33 Merge pull request 'Exclude specified VMs from image backups' (#509) from feature/kvm_backup_exceptions into master
Reviewed-on: #509
2023-07-26 08:58:45 +00:00
Râu Cao
fb708743cc Remove obsolete node 2023-07-26 09:31:38 +02:00
Râu Cao
9568b7072d Exclude specified nodes/VMs from image backups 2023-07-25 16:58:16 +02:00
Râu Cao
a85bbc4a3e Add kvm host role 2023-07-25 16:38:52 +02:00
266b17eb98 Merge pull request 'Set up openresty' (#502) from feature/501-openresty into master
Reviewed-on: #502
2023-07-25 11:24:39 +00:00
7d9faf40d8 Merge pull request 'Upgrade Gitea to 1.20.1' (#508) from chore/upgrade_gitea_to_1.20.1 into master
Reviewed-on: #508
2023-07-23 10:59:11 +00:00
Râu Cao
149760702b Upgrade Gitea to 1.20.1 2023-07-23 12:58:02 +02:00
Râu Cao
ec77e19ab0 Update SMTP credentials 2023-07-23 12:56:46 +02:00
Râu Cao
baab02515c Remove attributes from node config 2023-07-23 12:56:27 +02:00
Râu Cao
c48dd4c997 Replace postgresql primary, add new replica 2023-07-21 14:56:14 +02:00
Râu Cao
e5805169f5 Improve script for switching postgres primary 2023-07-21 14:55:43 +02:00
Greg Karékinian
be072fb985 Update vagrant-openresty node file 2023-07-19 10:01:51 +02:00
Greg Karékinian
0fc388f43c Don't redirect http for the hello_world openresty app 2023-07-19 10:01:10 +02:00
Greg Karékinian
27b466f30d Add new architecture to Gemfile.lock 2023-07-17 18:09:55 +02:00
Greg Karékinian
1a19fa012d Deploy openresty proxy on draco
Also update Chef to 18.2.7
2023-07-17 18:09:13 +02:00
Greg Karékinian
7b0313fbd4 Add access and error logs for the assets vhost 2023-07-17 18:08:32 +02:00
Greg Karékinian
1183f6a621 Add missing dependency on git to deploy the assets 2023-07-17 18:08:21 +02:00
Greg Karékinian
05daff9029 Install certbot when using the tls_cert_for resource 2023-07-17 18:07:50 +02:00
Greg Karékinian
307ccbd561 Set a production run list for the openresty_proxy role
It only contains the assets for now
2023-07-17 18:06:58 +02:00
Greg Karékinian
cc91aab155 Use the new way of setting attribute whitelists 2023-07-17 18:06:23 +02:00
Greg Karékinian
bf72367cf2 Add a firewall rule to the kosmos_openresty cookbook
It is part of the run list in production
2023-07-17 18:05:34 +02:00
Greg Karékinian
4e0bd191c3 Move the Hello World lua app to its own recipe
Use it in the development environment
2023-07-17 18:04:35 +02:00
Greg Karékinian
96f45b1f63 Set the required Chef version to 18 2023-07-17 18:03:02 +02:00
Greg Karékinian
030dbc3584 Update the openresty cookbook submodule 2023-07-17 18:00:38 +02:00
Greg Karékinian
84ffb46ed5 Add Chef node file for openresty VM 2023-07-17 14:46:38 +02:00
Greg Karékinian
491cd31fac Add openresty Vagrant box 2023-07-15 17:20:06 +02:00
Greg Karékinian
2acf4c2b59 Update Chef in Vagrant setup 2023-07-15 17:19:50 +02:00
Greg Karékinian
df1143525d Add openresty roles 2023-07-12 20:37:03 +02:00
Greg Karékinian
d79dcd8e65 Deploy kosmos assets with Openresty 2023-07-12 20:36:12 +02:00
Greg Karékinian
c1e2145ba1 Create a resource to get a Let's Encrypt cert with DNS validation 2023-07-12 20:35:15 +02:00
Greg Karékinian
d077dfdcf2 Deploy a hello world openresty app 2023-07-12 20:34:00 +02:00
Greg Karékinian
8a3c519a6c Update our fork of the openresty cookbook 2023-07-12 20:32:53 +02:00
Greg Karékinian
abb652cc2b Fix the openresty submodule 2023-07-08 15:37:12 +02:00
Greg Karékinian
b7c36d427e Add jemalloc and yum cookbooks 2023-07-08 15:12:30 +02:00
Greg Karékinian
1bdcda0e97 Initial kosmos_openresty wrapper cookbook 2023-07-06 10:17:11 +02:00
Greg Karékinian
0a15199364 Add cookbook dependencies for openresty 2023-07-06 10:14:23 +02:00
Greg Karékinian
aebf0a12e8 Don't use AIO in development
This was needed in my Vagrant setup (VirtualBox)
2023-07-06 10:13:52 +02:00
Greg Karékinian
2950ab5bfc Add openresty cookbook fork as a submodule 2023-07-05 15:50:46 +02:00
8072fafa46 Merge pull request 'Set up Redis VM, upgrade all cookbooks for Chef 18, major cleanup' (#496) from feature/488-redis_server into master
Reviewed-on: #496
2023-07-01 12:22:38 +00:00
Greg Karékinian
2637d755af Remove old server 2023-06-29 17:17:06 +02:00
Greg Karékinian
b550c1b79e Remove deleted servers 2023-06-29 16:58:28 +02:00
Greg Karékinian
1f29d8a01a Get rid of compat_resource and mariadb 2023-06-29 16:49:06 +02:00
Greg Karékinian
462bdabf01 Get rid of the chef-sugar dependency
It's now deprecated
2023-06-29 16:41:08 +02:00
Greg Karékinian
7683de09a2 Update the elasticsearch cookbook 2023-06-29 16:39:09 +02:00
Greg Karékinian
68ce3c4834 Update the firewall cookbook to the latest version
This gives us comments from the named resources
2023-06-29 15:08:44 +02:00
Greg Karékinian
916ae8094c Get rid of the build-essential cookbook
The build_essential resource has been part of Chef since 14.0
2023-06-29 14:48:49 +02:00
708 changed files with 16206 additions and 27432 deletions

View File

@@ -26,8 +26,7 @@ knife[:automatic_attribute_whitelist] = %w[
chef_packages chef_packages
] ]
knife[:default_attribute_whitelist] = [] # Added to /etc/chef/client.rb on node bootstrap
knife[:normal_attribute_whitelist] = ['knife_zero', 'kosmos_kvm', 'kosmos-ejabberd'] # https://docs.chef.io/attribute_persistence/
knife[:override_attribute_whitelist] = [] knife[:normal_attribute_allowlist] = ['knife_zero', 'kosmos_kvm', 'kosmos-ejabberd', 'openresty']
knife[:allowed_normal_attributes] = ['knife_zero', 'kosmos_kvm', 'kosmos-ejabberd', 'openresty']
knife[:allowed_normal_attributes] = ['knife_zero', 'kosmos_kvm', 'kosmos-ejabberd']

9
.gitmodules vendored
View File

@@ -1,3 +1,12 @@
[submodule "site-cookbooks/postgresql"] [submodule "site-cookbooks/postgresql"]
path = site-cookbooks/postgresql path = site-cookbooks/postgresql
url = git@github.com:67P/postgresql.git url = git@github.com:67P/postgresql.git
[submodule "site-cookbooks/openresty"]
path = site-cookbooks/openresty
url = https://github.com/67P/chef-openresty.git
[submodule "site-cookbooks/strfry"]
path = site-cookbooks/strfry
url = git@gitea.kosmos.org:kosmos/strfry-cookbook.git
[submodule "site-cookbooks/deno"]
path = site-cookbooks/deno
url = git@gitea.kosmos.org:kosmos/deno-cookbook.git

View File

@@ -2,44 +2,45 @@
source 'https://supermarket.chef.io' source 'https://supermarket.chef.io'
cookbook 'mediawiki', cookbook 'elasticsearch', '~> 5.1.3'
git: 'https://github.com/67P/mediawiki-cookbook.git', cookbook 'firewall', '~> 6.2.16'
ref: 'nginx' cookbook 'redisio', '~> 6.4.1'
cookbook 'redisio', '~> 6.4.1' cookbook 'ruby_build', '~> 2.5.0'
cookbook 'postfix', '= 5.0.2'
cookbook 'php', '~> 8.0.0'
cookbook 'composer', '~> 2.7.0'
cookbook 'users', '~> 5.3.1'
cookbook 'hostname', '= 0.4.2'
cookbook 'firewall', '~> 2.6.3'
cookbook 'nginx', '= 9.0.0'
cookbook 'fail2ban', '~> 7.0.4'
# Remove when cookbooks stop depending on it, the build_essential resource is
# part of Chef 14 (https://docs.chef.io/resource_build_essential.html)
cookbook 'build-essential', '~> 8.2.1'
cookbook 'mysql', '~> 8.7.3'
# cookbook 'postgresql', '= 7.1.8'
cookbook 'apt', '~> 7.3.0'
cookbook 'git', '~> 10.0.0'
cookbook 'hostsfile', '~> 3.0.1'
cookbook 'ohai', '~> 5.2.5'
cookbook 'nodejs', '~> 7.3.1'
cookbook 'timezone_iii', '= 1.0.4'
cookbook 'ark', '>= 5.0.0'
cookbook 'logrotate', '= 2.2.0'
cookbook 'openssl', '~> 8.5.5'
cookbook 'ntp', '= 3.4.0'
cookbook 'apache2', '= 3.3.0'
cookbook 'chef-sugar', '= 5.1.12'
cookbook 'compat_resource', '= 12.19.0'
cookbook 'homebrew', '= 3.0.0'
cookbook 'mariadb', '= 0.3.1'
cookbook 'ipfs', cookbook 'ipfs',
git: 'https://gitea.kosmos.org/kosmos/ipfs-cookbook.git', git: 'https://gitea.kosmos.org/kosmos/ipfs-cookbook.git',
ref: 'v0.7.0' ref: 'v0.7.0'
cookbook 'elasticsearch', '= 4.3.0' cookbook 'mediawiki',
cookbook 'java', '~> 4.3.0' git: 'https://github.com/67P/mediawiki-cookbook.git',
cookbook 'ulimit', '~> 1.0.0' ref: 'nginx'
cookbook 'postfix',
git: 'https://gitea.kosmos.org/kosmos/postfix-cookbook.git',
ref: 'bugfix/sasl_attributes'
cookbook 'apache2', '= 3.3.0'
cookbook 'apt', '~> 7.3.0'
cookbook 'ark', '>= 5.0.0'
cookbook 'composer', '~> 2.7.0'
cookbook 'fail2ban', '~> 7.0.4'
cookbook 'git', '~> 10.0.0'
cookbook 'golang', '~> 5.3.1' cookbook 'golang', '~> 5.3.1'
cookbook 'hostname', '= 0.4.2'
cookbook 'hostsfile', '~> 3.0.1'
cookbook 'java', '~> 4.3.0'
cookbook 'logrotate', '= 2.2.0'
cookbook 'mysql', '~> 8.7.3'
cookbook 'nginx', '= 9.0.0'
cookbook 'nodejs', '~> 7.3.1'
cookbook 'ntp', '= 3.4.0'
cookbook 'ohai', '~> 5.2.5'
cookbook 'openssl', '~> 8.5.5'
cookbook 'php', '~> 8.0.0'
cookbook 'timezone_iii', '= 1.0.4'
cookbook 'ulimit', '~> 1.0.0'
cookbook 'users', '~> 5.3.1'
cookbook 'zerotier', '~> 1.0.7' cookbook 'zerotier', '~> 1.0.7'
cookbook 'ruby_build', '~> 2.5.0' cookbook 'unbound', '~> 3.0.2'
# openresty dependency
cookbook 'jemalloc', '~> 0.1.7'
cookbook 'yum'

View File

@@ -2,16 +2,12 @@ DEPENDENCIES
apache2 (= 3.3.0) apache2 (= 3.3.0)
apt (~> 7.3.0) apt (~> 7.3.0)
ark (>= 5.0.0) ark (>= 5.0.0)
build-essential (~> 8.2.1)
chef-sugar (= 5.1.12)
compat_resource (= 12.19.0)
composer (~> 2.7.0) composer (~> 2.7.0)
elasticsearch (= 4.3.0) elasticsearch (~> 5.1.3)
fail2ban (~> 7.0.4) fail2ban (~> 7.0.4)
firewall (~> 2.6.3) firewall (~> 6.2.16)
git (~> 10.0.0) git (~> 10.0.0)
golang (~> 5.3.1) golang (~> 5.3.1)
homebrew (= 3.0.0)
hostname (= 0.4.2) hostname (= 0.4.2)
hostsfile (~> 3.0.1) hostsfile (~> 3.0.1)
ipfs ipfs
@@ -19,8 +15,8 @@ DEPENDENCIES
revision: d7c25b6ce5fa490b6de3529fdc163fb64f1ece8a revision: d7c25b6ce5fa490b6de3529fdc163fb64f1ece8a
ref: v0.7.0 ref: v0.7.0
java (~> 4.3.0) java (~> 4.3.0)
jemalloc (~> 0.1.7)
logrotate (= 2.2.0) logrotate (= 2.2.0)
mariadb (= 0.3.1)
mediawiki mediawiki
git: https://github.com/67P/mediawiki-cookbook.git git: https://github.com/67P/mediawiki-cookbook.git
revision: 78641e53635ba6cbd4a2a51fd597adb8fef1e8ad revision: 78641e53635ba6cbd4a2a51fd597adb8fef1e8ad
@@ -32,12 +28,17 @@ DEPENDENCIES
ohai (~> 5.2.5) ohai (~> 5.2.5)
openssl (~> 8.5.5) openssl (~> 8.5.5)
php (~> 8.0.0) php (~> 8.0.0)
postfix (= 5.0.2) postfix
git: https://gitea.kosmos.org/kosmos/postfix-cookbook.git
revision: dd6598572a775ae73f17527260ec8097b52d385b
ref: bugfix/
redisio (~> 6.4.1) redisio (~> 6.4.1)
ruby_build (~> 2.5.0) ruby_build (~> 2.5.0)
timezone_iii (= 1.0.4) timezone_iii (= 1.0.4)
ulimit (~> 1.0.0) ulimit (~> 1.0.0)
unbound (~> 3.0.2)
users (~> 5.3.1) users (~> 5.3.1)
yum
zerotier (~> 1.0.7) zerotier (~> 1.0.7)
GRAPH GRAPH
@@ -48,26 +49,20 @@ GRAPH
build-essential (8.2.1) build-essential (8.2.1)
mingw (>= 1.1) mingw (>= 1.1)
seven_zip (>= 0.0.0) seven_zip (>= 0.0.0)
chef-sugar (5.1.12)
chocolatey (3.0.0) chocolatey (3.0.0)
compat_resource (12.19.0)
composer (2.7.0) composer (2.7.0)
apt (>= 0.0.0) apt (>= 0.0.0)
php (>= 0.0.0) php (>= 0.0.0)
windows (>= 0.0.0) windows (>= 0.0.0)
elasticsearch (4.3.0) elasticsearch (5.1.3)
apt (>= 0.0.0)
ark (>= 0.0.0) ark (>= 0.0.0)
chef-sugar (>= 0.0.0)
yum (>= 0.0.0)
fail2ban (7.0.4) fail2ban (7.0.4)
yum-epel (>= 0.0.0) yum-epel (>= 0.0.0)
firewall (2.6.5) firewall (6.2.16)
chef-sugar (>= 0.0.0)
git (10.0.0) git (10.0.0)
golang (5.3.1) golang (5.3.1)
ark (>= 6.0) ark (>= 6.0)
homebrew (3.0.0) homebrew (5.4.1)
hostname (0.4.2) hostname (0.4.2)
hostsfile (>= 0.0.0) hostsfile (>= 0.0.0)
hostsfile (3.0.1) hostsfile (3.0.1)
@@ -76,16 +71,14 @@ GRAPH
java (4.3.0) java (4.3.0)
homebrew (>= 0.0.0) homebrew (>= 0.0.0)
windows (>= 0.0.0) windows (>= 0.0.0)
jemalloc (0.1.7)
build-essential (>= 0.0.0)
logrotate (2.2.0) logrotate (2.2.0)
mariadb (0.3.1)
apt (>= 0.0.0)
yum (>= 0.0.0)
yum-epel (>= 0.0.0)
mediawiki (0.5.0) mediawiki (0.5.0)
apache2 (>= 0.0.0) apache2 (>= 0.0.0)
nginx (>= 0.0.0) nginx (>= 0.0.0)
php (>= 0.0.0) php (>= 0.0.0)
mingw (2.1.3) mingw (2.1.7)
seven_zip (>= 0.0.0) seven_zip (>= 0.0.0)
mysql (8.7.4) mysql (8.7.4)
nginx (9.0.0) nginx (9.0.0)
@@ -100,7 +93,7 @@ GRAPH
openssl (8.5.5) openssl (8.5.5)
php (8.0.1) php (8.0.1)
yum-epel (>= 0.0.0) yum-epel (>= 0.0.0)
postfix (5.0.2) postfix (6.4.1)
redisio (6.4.1) redisio (6.4.1)
selinux (>= 0.0.0) selinux (>= 0.0.0)
ruby_build (2.5.0) ruby_build (2.5.0)
@@ -110,9 +103,10 @@ GRAPH
seven_zip (4.2.2) seven_zip (4.2.2)
timezone_iii (1.0.4) timezone_iii (1.0.4)
ulimit (1.0.0) ulimit (1.0.0)
unbound (3.0.2)
users (5.3.1) users (5.3.1)
windows (7.0.2) windows (7.0.2)
yum (7.2.0) yum (7.4.13)
yum-epel (4.2.3) yum-epel (4.2.3)
zerotier (1.0.7) zerotier (1.0.7)
ohai (>= 0.0.0) ohai (>= 0.0.0)

View File

@@ -306,6 +306,7 @@ GEM
PLATFORMS PLATFORMS
x86_64-darwin-18 x86_64-darwin-18
x86_64-darwin-19
x86_64-linux x86_64-linux
DEPENDENCIES DEPENDENCIES

View File

@@ -38,6 +38,10 @@ Clone this repository, `cd` into it, and run:
knife zero bootstrap ubuntu@zerotier-ip-address -x ubuntu --sudo --run-list "role[base],role[kvm_guest]" --secret-file .chef/encrypted_data_bag_secret knife zero bootstrap ubuntu@zerotier-ip-address -x ubuntu --sudo --run-list "role[base],role[kvm_guest]" --secret-file .chef/encrypted_data_bag_secret
### Bootstrap a new VM with environment and role/app (postgres replica as example)
knife zero bootstrap ubuntu@10.1.1.134 -x ubuntu --sudo --environment production --run-list "role[base],role[kvm_guest],role[postgresql_replica]" --secret-file .chef/encrypted_data_bag_secret
### Run Chef Zero on a host server ### Run Chef Zero on a host server
knife zero converge -p2222 name:server-name.kosmos.org knife zero converge -p2222 name:server-name.kosmos.org

27
Vagrantfile vendored
View File

@@ -26,7 +26,7 @@ Vagrant.configure(2) do |config|
ldap.vm.network "private_network", ip: "192.168.56.5" ldap.vm.network "private_network", ip: "192.168.56.5"
ldap.vm.provision :chef_zero do |chef| ldap.vm.provision :chef_zero do |chef|
chef.version = "17.10.0" chef.version = "18.2.7"
chef.node_name = "vagrant-node-ldap" chef.node_name = "vagrant-node-ldap"
chef.arguments = "--chef-license accept" chef.arguments = "--chef-license accept"
chef.cookbooks_path = ["cookbooks", "site-cookbooks"] chef.cookbooks_path = ["cookbooks", "site-cookbooks"]
@@ -49,7 +49,7 @@ Vagrant.configure(2) do |config|
# bitcoin.vm.synced_folder "../kredits/yap/", "/opt/yap" # bitcoin.vm.synced_folder "../kredits/yap/", "/opt/yap"
bitcoin.vm.provision :chef_zero do |chef| bitcoin.vm.provision :chef_zero do |chef|
chef.version = "15.13.8" chef.version = "18.2.7"
chef.node_name = "vagrant-node-bitcoin" chef.node_name = "vagrant-node-bitcoin"
chef.arguments = "--chef-license accept" chef.arguments = "--chef-license accept"
chef.cookbooks_path = ["cookbooks", "site-cookbooks"] chef.cookbooks_path = ["cookbooks", "site-cookbooks"]
@@ -66,4 +66,27 @@ Vagrant.configure(2) do |config|
end end
end end
config.vm.define "openresty" do |openresty|
openresty.vm.box = "bento/ubuntu-20.04"
openresty.vm.network "forwarded_port", guest: 6379, host: 6379
openresty.vm.network "private_network", ip: "192.168.56.7"
openresty.vm.provision :chef_zero do |chef|
chef.version = "18.2.7"
chef.node_name = "vagrant-openresty"
chef.arguments = "--chef-license accept"
chef.cookbooks_path = ["cookbooks", "site-cookbooks"]
chef.data_bags_path = "data_bags"
chef.roles_path = "roles"
chef.nodes_path = "nodes"
chef.environments_path = "environments"
chef.encrypted_data_bag_secret_key_path = ".chef/encrypted_data_bag_secret"
chef.environment = "development"
chef.add_recipe "kosmos-base"
chef.add_role "openresty"
chef.add_role "openresty_proxy"
end
end
end end

View File

@@ -1,4 +0,0 @@
{
"name": "barnard.kosmos.org",
"public_key": "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA5Rr+3giLkr0xqZPRPn9Z\ngxvmAaUo6VSs1qnMfznNNN/CGCYett0ndEJp4wI8xp2fq75b2TSm4jqhqjtgYVVD\nEeSOKTZEnoE7YSssodGTAK5YnrVIPNyWd61Ih/NkHzCjlcuVX6sJD7z/pgK+WMao\nAAxzMrefvHALFBmJIxbugakru/nvDcQeV8DOF+UjzsO5CTC0BUzCFeXBG7HD3W+6\nP2wQlMKteM9uQU6Agx7XegeWS2Lfnxg1em5TNbw1PbLofROwr1pCUPfVzQ0CAVxm\nXLzmA2xtMqCT2j83DU9WleZPYiS0rg+r9T1jsDX0TyH4NTV8gO2SJ9BMUNcX+3Ox\nmQIDAQAB\n-----END PUBLIC KEY-----\n"
}

View File

@@ -1,4 +0,0 @@
{
"name": "centaurus.kosmos.org",
"public_key": "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAsVV0j8DQSlefAAAmafjx\nyT1j1idLQF0oltTp2p4jFEsnEdFeP4Plpluy+detra1gM9sBBBuvRKGt8NP+Yoc7\nbnn7qU13E/nWUQh9n15+jjgUirXg7CxluKfj2VvsdchJRIvzDwwZz5sqITiGG7/S\n2r2KBBBnuGlGShQJZhhcLW4P+3YgxW8DUgUsRdvreVuvF1hcnaSymldfos1CqYL8\nawtsZ2rtdZHmZxfguXl91WBCu2OxsT13i3kInnDQsFB0tYKq+TFSLAHxneKTYPRW\ngYgP9RSBZ51iQ+6R1CenYsr4SePVCmwaZGb8bmd0QLvGKlBhjX29a5bE5tjzeoBD\nuwIDAQAB\n-----END PUBLIC KEY-----\n"
}

View File

@@ -1,4 +0,0 @@
{
"name": "discourse-1",
"public_key": "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAxJBhKUtTcmjP8eG4aLNF\n9UfNU9lRIFhfywjFJjtXoYdNaUatZHE3s1HKND0SjJs5BRQbZBEKLxTHCgnPZD4U\nlRgZ65JtHwi+JNM6ac4TQm5JYKA++KxX7FtOiJV6oGX6foNoFVHrGi+fhTlLE9hL\npHRQWTpM8ErpUEj3VHez+k6KT1Mr3QO5T9L5kqu1BdTYwtyfXJE0VfyDKz/rwrvc\ngPvZd167p8YCTu/rWLG9X8tag+ySUR9cmlEn5sCsBLmq56Zurf0VIe/0tuGPI8DP\nAVc4dIXHsfGuKLwBfFPSDy9YbI7F8gbaD05UnUVn60IWPmWsE19K/iIc/OnJZwRO\nkQIDAQAB\n-----END PUBLIC KEY-----\n"
}

View File

@@ -1,4 +0,0 @@
{
"name": "ejabberd-6",
"public_key": "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAqvGOanDqJOhf0xl/TYcs\nqYhhGz4ptFzxmfxiCMWbnbDcICBLHni28dJHhP2ggfUKOGcp+OIqiy783eRUrPsf\nnH9VmvTnz4NdXIB5J45FgBtfYiF9ZseaPL+ufTSCbZj7Ih3lzTAbO5Ug+UOj852B\nnnqH2Ht2jXMp2v3NW4gAG9QyRpr6P5cyVWBrMFExjuhNWg119tJv+33oGnflrNRi\njV3yGbRFRpqAomAVCr6DAA9SX/R8J3yKTky6MdRGrXKH/7eXH0ehDi33Y9Pyy9Ci\nkQX/JRHffuJeBF3Tndiojqdx81C6oIh2s/H3JMew/DdRxjzlPP4nemYWXv1/YVcS\nCwIDAQAB\n-----END PUBLIC KEY-----\n"
}

View File

@@ -1,4 +0,0 @@
{
"name": "ejabberd-7",
"public_key": "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAzHfqcI/6w58gLwDFCKxw\n0TeKFOf4MFBnmUGsWyi8BEskkjh4QEDc4pUFeiVuEADFyBfCnALWh004nKhiwamc\nECybfAKlJryoQQEcYZC6H4rZf3SW7xPLk12X00YySNroYM50PM5Ly/G7MI9a669g\n6HNOgn1MYIEh8unpsAHjfKpx72bNutRYKKvBDaHXNvlJ459Jr8HNpERFk8IeaGcF\n4BKqf/MNxkQHOfy7R4ETXeLUBrgD13SmLbs6mM3lXS6IgkoeFyAvAPP4ZgwgiJ6w\nqIKsX4cRt8xnJJ+MTNBX4oc0f9+Gu8bUpr2JZ8tcwq3GUgDjv+JSJpk/uDzzbQUe\nIwIDAQAB\n-----END PUBLIC KEY-----\n"
}

4
clients/email-1.json Normal file
View File

@@ -0,0 +1,4 @@
{
"name": "email-1",
"public_key": "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAxDRdvMYKRjejoFsOxS6s\n4gj0Gsaxk/j25A5VPHBcEhr+NOh8W/6NnTTHuFMaorEIl/2kscgrcwriDN7xIFmO\nz/C1+spDLPMGSWd+422KSS3fjVfByLlMwxh171RDZBlZVze7H7CIV/rxCG7Ri85y\nPvyp2rT4ioyVGyYK3e8CiXwQckpFC1ex9VRk/GR8zbCYUIw+qbTFRcl/mQuxKqWK\n22vrgAR+6OL8lcyhssmKiQ1r3GtxwJusgffw4/5S8sRR1z8OB4wiwgOWR1E36EbF\nhTBjFzPiKVjVjP/TQpUoYdnBhuD223M8nPWJl1HMVQPMjL6R2BBOF+iK0Wx9SiFD\nJwIDAQAB\n-----END PUBLIC KEY-----\n"
}

4
clients/garage-10.json Normal file
View File

@@ -0,0 +1,4 @@
{
"name": "garage-10",
"public_key": "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAw2+3Wo+KkXVJCOX1SxT9\nSdwKXgPbCDM3EI9uwoxhMxQfRyN53dxIsBDsQUVOIe1Z8yqm4FenMQlNmeDR+QLE\nvNFf1fisinW+D9VVRm+CjcJy96i/Dyt786Z6YRrDlB860HxCbfTL2Zv5BRtbyIKg\nhz5gO+9PMEpPVR2ij9iue4K6jbM1AAL2ia/P6zDWLJqeIzUocCeHV5N0Z3jXH6qr\nf444v78x35MMJ+3tg5h95SU1/PDCpdSTct4uHEuKIosiN7p4DlYMoM5iSyvVoujr\nflRQPEpGzS9qEt3rDo/F4ltzYMx6bf1tB/0QaBKD+zwPZWTTwf61tSBo5/NkGvJc\nFQIDAQAB\n-----END PUBLIC KEY-----\n"
}

4
clients/garage-11.json Normal file
View File

@@ -0,0 +1,4 @@
{
"name": "garage-11",
"public_key": "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAzfZcNEQojtmaogd9vGP/\nMsVPhAOlQ4kxKgrUas+p+XT7lXRan6b3M8UZEleIaL1HWsjSVwtFWRnNl8kg8rF8\nNEkLeOX8kHf7IoXDFOQa2TXanY8tSqrfh9/heFunt4Q3DluVt7S3bBdwukbDXm/n\nXJS2EQP33eJT4reL6FpVR0oVlFCzI3Vmf7ieSHIBXrbXy7AIvGC2+NVXvQle6pqp\nx0rqU6Wc6ef/VtIv+vK3YFnt9ue3tC63mexyeNKgRYf1YjDx61wo2bOY2t8rqN8y\nHeZ3dmAN8/Vwjk5VGnZqK7kRQ92G4IcE+mEp7MuwXcLqQ9WB960o+evay+o1R5JS\nhwIDAQAB\n-----END PUBLIC KEY-----\n"
}

4
clients/garage-12.json Normal file
View File

@@ -0,0 +1,4 @@
{
"name": "garage-12",
"public_key": "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA9GtHHi298BjiIqpZ3WkT\nkYAPfWD60hFe/8icYcq/F/6cHLYKZQ4chek9X/hDCMq4tHEN6Oh58T5x/nuNdPrK\nIAMGyVAGk6ekWlmD4jwdEf6TGb/J3ffJTRDvwX/I8xD/DW3wtXsN+X24T59ByGTm\nrnwRmmmwHF3otRx9wnCsIgDQ0AjiUujsfNNv1FcLXD/WJLys9lEeU5aJ4XtHTwDv\ntJM8YyVEFhEnuvgdKmzn5+F5k9VGdUwForlFOBfvzbCnTZMDMmDVeiUtAUv/7xWQ\nQl2mLUGCtgWuYJYXsQacAJ6pa3h+7cQyshC6w3dwUG+1fS9lNO0Yp1GGX1AGYKpp\nPQIDAQAB\n-----END PUBLIC KEY-----\n"
}

4
clients/garage-13.json Normal file
View File

@@ -0,0 +1,4 @@
{
"name": "garage-13",
"public_key": "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAvbqWc6OwRxgHfsQuTNL4\naxeVvNen5d9srYpZSHjuBB/k9NHB+9P6vU5qF37XHkw1lVUGeYbPHzhYsx3O0/kZ\nH5f4+4SMy/P9jc6SE7AJF4qtYKgJ88koZdqCww07c6K9g+BnEGFFZui/h3hUBxWj\nTfhBHEWPyQ2bl/lr9sIJwsEz+EN0isGn/eIXkmw9J6LdLJ5Q0LLks33K28FNOU7q\nfeAN4MiBVMUtgCGyT2Voe6WrOXwQLSDXQONOp3sfSfFExsIJ1s24xdd7AMD7/9a7\n4sFDZ4swhqAWgWmW2giR7Kb8wTvGQLO/O/uUbmKz3DZXgkOKXHdHCEB/PZx1mRNM\nEwIDAQAB\n-----END PUBLIC KEY-----\n"
}

4
clients/garage-14.json Normal file
View File

@@ -0,0 +1,4 @@
{
"name": "garage-14",
"public_key": "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAqNY8AuaM4byhaTZacfRJ\nv/qyHxcDJOMX/ElF1H908spdbB2ZiLXHOH1Ucw1d+NV6/QUtWk+ikKFPpasnatD7\nmjE57noH+H47Rll0nD7oT+in+fOBDHF9R0P6/qyRSdJbJkHOh0iC0MG4LcUfv0AY\nnVBW5iLZSe/PC3+PvhCv7yrx3ikSs0mg1ZWppw0ka5Ek3ZCZp5FB4L6++GYWpM+1\n6YI0CjMoRcXsaEQsJWhxHXT8/KDhW0BR8woZUGm0/Yn4teLYJzioxRfBep3lbygx\nOIsDN9IJzo2zVTGPDZQLXhVemIhzaepqTC77ibH7F0gN/1vsQBc/qf7UhbwaF4rR\ndQIDAQAB\n-----END PUBLIC KEY-----\n"
}

View File

@@ -1,4 +0,0 @@
{
"name": "garage-3",
"public_key": "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAtRSB8/ObjvQq6WuOVS/f\nypdX/2fLsUlt5tQ8GNuSY9rSM8gdvcXUvnPlxthZO4yvcPX85wmtBZX8fRJFdkJg\nYRCJbuVKO9sLTq8OUWXYpfU1q10FUhl034zxOMslpxVB6toirnk025vyq9jbuKP+\nYO+c40KZr67mgm0hveJfylayfiKP1HGm4HrV0maFivCgC8D+MPDDv75CsqRe5WSc\nh2CoauDJwVlhKZ92yq87ugGBhJJRUGOQZcfEvkUGj/HNAS6tuHl8YmVmhO8hBdee\nNto6RF54E1zB80R9oT/qitw23miEyUcHHVxhTR4tTWflZgd8l4wDOhX3Nf20xknu\nFQIDAQAB\n-----END PUBLIC KEY-----\n"
}

View File

@@ -1,4 +0,0 @@
{
"name": "garage-4",
"public_key": "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA8it7QtT6zDiJJqlyHKfQ\nLqwu6bLblD15WWxlUSiOdhz3njWDv1BIDCAdkCR3HAXgxvk8sMj9QkvWS7u1+bc4\nxvHrY4Tgfg+Tk1h3gGa7ukll8s1WLIbGjj89vrK8PFr4iuDqRytYRMmcdMsNzPkS\nKcsOjFYWGV7KM/OwoQGVIOUPB+WtkrFAvNkXtIU6Wd5orzFMjt/9DPF2aO7QegL8\nG1mQmXcPGl9NSDUXptn/kzFKm/p4n7pjy6OypFT192ak7OA/s+CvQlaVE2tb/M3c\ne4J6A+PInV5AGKY6BxI3QRQLZIlqE0FXawFKr1iRU4JP4tVnICXZqy+SDXQU1zar\nTQIDAQAB\n-----END PUBLIC KEY-----\n"
}

4
clients/garage-7.json Normal file
View File

@@ -0,0 +1,4 @@
{
"name": "garage-7",
"public_key": "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAwoAigZUSwsfbBHx2PQ6W\n38Ght6eCvbpW1lsS58hTieRmRn+pgZVjvixhsBh57rUasCjaBywXk9BpNj2Foxck\nReHeoDI0RHsgniClyMrYj80y2NhoB6J8NB+cHkhdzIKplm6AH6M5xaAedtZU639a\n1nHMtpDlJhzgIYsiq1q06Aqd1w0Z9tf1RXQ1WvMDhTY4wlE5RZ2epBb6Usnlbjo2\nSqCIGIjRLmZxdsSWoiUUTlVPdUCzTNsN5G/ZVdRswhgseDmVJCIkK2Aji/XzhIrR\nh4RvUv9dhFemOVsFctJ/dQILXz5MZLUgakKf970M5R/Zggv//pqRSsYcB2UfaBpV\nLQIDAQAB\n-----END PUBLIC KEY-----\n"
}

4
clients/garage-8.json Normal file
View File

@@ -0,0 +1,4 @@
{
"name": "garage-8",
"public_key": "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAt4hXODzgHsIeWxXJm/F6\nSTFJ8JC89mWru7pOFzPWenOVMHgp4UpUB4rDTwQqojsWTDiq0x3ckUyOPw3Nj0jv\nxP4MMGS4SI0oRSJKzrYYss0hgUDTOBBd+Wxn0UiNEpN/PfQo9VZj9v/jak57cz7z\n5+rpl5v27fhgUIChjsHxdy+EamvCrYc+1JhyrLOlwlt8JxkZ8UPhoeZLWAbDgGLS\nEzHWSSVtBUPK+KYmVb2OK4lB56zPfek0U3gKN+04a1650jzOit8LzE6NaT180QDv\nX+gG6tk53vSXDmkBXsQ1mtB8aF+HaEG2Pra5HyihlweCPYdJT+e28wpq6+P5l3YR\ndQIDAQAB\n-----END PUBLIC KEY-----\n"
}

4
clients/garage-9.json Normal file
View File

@@ -0,0 +1,4 @@
{
"name": "garage-9",
"public_key": "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAnMHzKE8JBrsQkmRDeMjX\n71mBzvRzNM90cwA8xtvIkXesdTyGqohX9k/PJbCY5ySGK9PpMaYDPVAnwnUP8LFQ\n3G98aSbLxUjqU/PBzRsnWpihehr05uz9zYcNFzr4LTNvGQZsq47nN9Tk+LG3zHP7\nAZViv2mJ4ZRnukXf6KHlyoVvhuTu+tiBM8QzjTF97iP/aguNPzYHmrecy9Uf5bSA\nZrbNZT+ayxtgswC2OclhRucx7XLSuHXtpwFqsQzSAhiX1aQ3wwCyH9WJtVwpfUsE\nlxTjcQiSM9aPZ8iSC0shpBaKD1j3iF/2K2Jk+88++zMhJJPLermvaJxzsdePgvyk\nKQIDAQAB\n-----END PUBLIC KEY-----\n"
}

View File

@@ -1,4 +0,0 @@
{
"name": "gitea-1",
"public_key": "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA0bp4I/f5dLL22GRHanLV\nw57sNBEWT3Vx32B24hScKNP5nYDW0dIRkt1c7SLEpe+diNgyIwk7JlI20Vl+oaVo\njdCpmHSB18yXxQT2Ub6aI8ApwFLECVA6SckekcwxLJc/oGRMB52PonI8opJOVbPa\nF+heZ5NNDiMvn3E8qODdMWSjDiJNSVLJgsCPFHAt32aJgLaXQTqG5lrmltaamscW\njGlFqiBJw/5saCkKBPdPwdX4RcDqvGX1FdE1LVB42cskv8CrnvEVFLBxKXAhAr6s\nNhOhenzLGHpy58tNoUoUw3v4WiPRtcnlNxeSVG5LKkjaK04f2oxeZx3SiSU/1naY\nkwIDAQAB\n-----END PUBLIC KEY-----\n"
}

4
clients/her.json Normal file
View File

@@ -0,0 +1,4 @@
{
"name": "her",
"public_key": "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAsuj7OCWX2qz/WbsjMgpi\nI4CM13Pxrj+8Enrl4IorkK6O338rhdtfXmOJt2AuDuj6u12Xtnk0LN2n01hffXNu\nU0Hwy+szavnbjiqC8jw1nyCFwYgdy8lCj3WV4t/gRWFhiHZGkhBKaksAoo8jJqZv\nXi/4ZuRov01HJgT6CJBEfR5TUaRCHM4hz2Y60mmegmUNLTRUNIDy6rg5W8JplMlJ\ny0dJc6uEp8asKhPnEfMz1kXukjnsBLXZmxglqdAQeaZ1I78QvRV3rYh0Ge2ZPF8t\nv2c+mUMbH7e80lJPgp7rwqjKrjLfaYo/1ZqTqr3ArWw3253ttLp8KX1ltX69nIHq\nMwIDAQAB\n-----END PUBLIC KEY-----\n"
}

View File

@@ -1,4 +0,0 @@
{
"name": "jitsi-meet-1",
"public_key": "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAyNMD7N7s+JZM6PLlcrKN\n4jnr0jB5kU+Gr8EHtdpaBDGN5x8BahAkMuXcWfMQj4xIvUhTY4tTvDDYgcJGbrY4\ncmmt/YLX4t/OR6g2JxzIRWDBITTTlX7h5QUg10irjfPsyaU9O7lChDk4M3j5J4c2\nZFlZAar1+CeC5nwcEtNg4nL36I6bxUL5e/rEeeUGCGuqn3tAQ+GXj1G4uJYI18JQ\nhv43nIqbF+oVe5iRy58rXILd+zmbOq87cnF8O2ode44jRwtH4K0+uHTmq+83Q8Ld\n3wBZTnrQEnUDm6IuFuWfYhvNGlXAJrcmoH/wA1B5IAcuF3vhw9JY9axy+GDFszOX\nxwIDAQAB\n-----END PUBLIC KEY-----\n"
}

View File

@@ -1,4 +0,0 @@
{
"name": "mastodon-2",
"public_key": "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA27a8h17CCQLP8JY59n+M\nURsrbeVvRi3yIUe1IklOlRSTy0L3Z37rFuSNC3dC9rKl/pHDKtorgeukxbFADXQx\nkta2LNX8gf09jCWsUdga5lWIbfOdtlCLRDG1MVEUSA0f6Sxdqr8RbjM2ch31T6Me\n5Z6DYdggwBujcPHwZC1AugI1wJ0T5XHY9f2MDs/XjNEdw3ThYbAdbl1e09ql6Gtg\nSVCa4RlLg/KICdLJtVOLkX6049/XRxi41I6xvu9tXsqgV3+bs8dYbeGLsTWmpPIv\naAUMcf/A5t4B2DVpnlXDytPqfvZQPD3aBVyfEJRGI1yD6Vi9zL3RyIhDQ/I7PMNI\naQIDAQAB\n-----END PUBLIC KEY-----\n"
}

View File

@@ -1,4 +0,0 @@
{
"name": "nodejs-1",
"public_key": "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA9L4BQgLEpQSSbSLwXOab\nfFey5VSk8ynDmj2I9sOpPMIXkXpmbONkyXqZ4CqKrMRtesXAg1F1lIwzE/WJy0wP\n9CRhEgnclHRHE3TVqWt8dC6+u5kx5o48EF8X9UWgV1098c21gcn68NZ7+l/janws\ntLYrgMynikcadaGtAkRszGG0dX+qdeRx9hRzhTNUIG4AYe6bUA6/LfOEPyRyuo3Q\ncaN5fAJSK+RRMWr1d7Mzd8k+l3xXzcUTMUL2To+Zh0Fw2SIEocM4NS1W9nAm4+Cq\nhlQUhsoHDwk7bDsIQtRNfy3bX59PSIVMcWLNkWilLzZW1yRtFGPTJfPlR4Y1XJb5\nuwIDAQAB\n-----END PUBLIC KEY-----\n"
}

View File

@@ -1,4 +0,0 @@
{
"name": "nodejs-2",
"public_key": "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAuWyrBQXathrKzRO7HbX7\nZXqkeGo7X0q3qckO/Uh4Ht67bFb6iQDRo/gRkaVA0PM++2AhtW7wV2NYXR/3qowc\n1gGtO0zuQq56crcL7k9nVuFJ1IbYDyasEq+5nUKzEUVT0hK1/Vzh12gLFhDkBOX+\nCvISLTTQgEGljwNQLf1kZTraJcdDSN0R2k2jl+idJkeAuK5cjMEJa7Fog8scM2rR\nzGhB8gDRp+iq4HQ+yE3R1yXW9rBfWoConnXiNxholt3e2aAte2V1KnEmVLO/8ceo\nvqIp5xEcDKIAIrSqsmopRFXJ0PjS/nbS0Z2ynxpyh1BV4sqr/y4oOryrnwO+LqBB\nHwIDAQAB\n-----END PUBLIC KEY-----\n"
}

View File

@@ -1,4 +0,0 @@
{
"name": "nodejs-3",
"public_key": "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAyqP7aGx+S9Mdt6xmaGnJ\nfNWWQsg4BvLiP1qtVt3VRrcXF2cy1bhgfnmqoBqnDk4bGlRoTzF+rSOw284+O2UQ\ntUlsBRos4TOyGfbYHehF12Re6NX51K9LHwaprr3eN5h08wLI8pjVrRJlbce8pHST\nXQ/CZvU+CBg43LE08cXr5kRmhnZrgh70g7zTO8+1E6y74r1LEh77Ar4uaaB5jXw7\n6o9TyfaA1HgyqvfYbH+9KPrJfMX/DeLrYPMI3IG/j3fzDUQQ8o9Pb5B+G1Apl+I+\nsTcgWRei5u06aZHLMMd8MMo4O1yUhbt05kxfVhlDGUDWBdi3cvsMf95t6MNdz/eq\niwIDAQAB\n-----END PUBLIC KEY-----\n"
}

View File

@@ -1,4 +0,0 @@
{
"name": "postgres-2",
"public_key": "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAoQmrHoW5X6jpN6cJnafW\nWKz1LpT2DvOFPeRmrlSPOPIUSVPUMZI8ojdxzmri/dzC8C4quCIYaL5ssARhe17L\no16LG3z/wdPENYONBj/oH5GRvmG1/uCgzL5+QQENk3kAWVAUb7EL3EgHNx90b2oC\nDNoHcjuoi3ZkCUXxkX7BESvw1jII4hP+HyoIqGh8TZLIAQ25/mS9aNL3TbcLYp5d\npqoM0Ruc4DHVuZTamN+zBZwNRCBz6uxMmaEBD+piYTEPJOnf7yUT7d2l/QzLftfE\nkSo80KOyrPOFdIPCpqKJyPOJZgg7fSgpR0YC6BH7I/JgIsIwUsQcMS8/ELUC5+Zg\nfwIDAQAB\n-----END PUBLIC KEY-----\n"
}

View File

@@ -1,4 +0,0 @@
{
"name": "postgres-4",
"public_key": "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAu6fPxOZeKloF/EgYvU0k\nOwv8bJjsCQcWaMTPle5//mRTszA6PM2z9RI+Mfr45qxTlsL9pQY8WJOWF6QOK31x\nszuqcr7oOjtAhrLI8f/oNDEDjcx325FqG9gNKQEAD7d4zodh+PhDe6x7GIyIS7lG\nIcD5Zre9iDwv8FGLR+5GLqS8SJOPL/wJkQ8w+N0f8YDFw81kiTta5NLhAx3fMDs0\n2kmoNlbmKlNZTtLjCfCV+/pa9oY6wycjck3GvobiFE/4cWaNkeGlPc+uAwlfmrOv\nHy0tq1XBX/BCvE5kMXmhnMT23JXjm2s2PgCLgEVGAXilXk/T597KDm+z4oBpAQma\nnQIDAQAB\n-----END PUBLIC KEY-----\n"
}

4
clients/postgres-6.json Normal file
View File

@@ -0,0 +1,4 @@
{
"name": "postgres-6",
"public_key": "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAtVzM0fwlimmq11jTGTko\nK87LRYSar61tNF3qVWp9axNSMa6BSxVark9eYOqY4eLh/5vJVDqXDFq30/IUWg40\nH8hHWaOEvQrP2dm/XFw1RmunfbfN9gN07TuhaT3xFD5t+jFBuOSoJ4cPnFIABuVt\nFLrjgtYYjtZe5hGE9ZPmS7o2ATM5EU9mxeQ+TkgDbr8StvSPGdZ1ykhagf1pegGU\nRIfZ+4ZKzyDUAq+fYNhIbmlm5h2gP+XdtakPy43j7n0iN1vwDgBqJ2pdaVs/GcFf\nvaztoltguoknI2NPSez1N217asTTLuth0nHxVXiKCVXnqwDjxgWmuP6X2B7VYjyc\nxQIDAQAB\n-----END PUBLIC KEY-----\n"
}

4
clients/postgres-8.json Normal file
View File

@@ -0,0 +1,4 @@
{
"name": "postgres-8",
"public_key": "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAx88DgM/x1UbKRzgPexXE\nSyfrAsqaDVjqZz7yF3tqAc9A52Ol0KOM6NESoPWBVMbS86WtAjBcMHcOoQBJ+ovp\nXcjNlRtO1Il6/d4uCRr4CEDX+yeS0Qrt0SOORnoTbVlkq9VlVljyCmxk8VBCILzk\ndHvFr62mahMy6vOEcpCQgCwYE3ISH2jlTDz2agoK/CjIyyqFTlB1N7mJVGLrJdcA\nA2JOxDRE8HqOdpY7bHcHj4uyMWaKuM3zxXK04lhrvuPRfJUhXgsK9r5jeTEa8407\nqV9K+mB17R1dBeHmWEPDRt02HELe2SUjYmlmyVX73H2mWKDLBFpAFjOfz86CJ6jf\nDQIDAQAB\n-----END PUBLIC KEY-----\n"
}

4
clients/postgres-9.json Normal file
View File

@@ -0,0 +1,4 @@
{
"name": "postgres-9",
"public_key": "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA2dcE9HH0r5TBb/FGj2+e\nOw8ssoxeB61JmR4/psdZ6oPR08gxyqOY0ODziCmyIdXwFhjIcC44HjxCbcB8TU8G\nWGqlmfqWWIJW0x/2xOycHobAWDn5fC5ttTXkR3HC1TutX/2mH26mtfz9UjNdPaTo\nVZFMcxeaBCFSNlYC7hPUQ5f/qBdhhpLxP9uyzU+YFPqtwLP7g8EAUQObM4L+m6Q8\nqE7xgYpnhgaNrPsmvaVuoNylMGwyK0j1whOkcik8UgLprD70ISNSNxxcLehbvA3G\nPQPQRRuFF36fu2gECWGopbrFKwQGNfgJguQoXM1RQZQMQqWHPS933k5i6bi5pnhp\nzwIDAQAB\n-----END PUBLIC KEY-----\n"
}

View File

@@ -1,4 +0,0 @@
{
"name": "rsk-mainnet-1",
"public_key": "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAtavs6RQW6af9fWuEuhI1\nQa4Ff7Z1CfZ0fHz152UqUeUKatQ/psKVs5ULWDV/b69fSuNsUzkCny9OwtwyQB/F\n2U+vbv3/3As3z6i3V3q8q4ahCHd7tkMmxMLaWcdkfWbpupWTRkCEX+PSDKS0hdfp\n3EQKVA2FrqR0sSnnT+Q66kZw4/WJrNwtSLcps4D5OubG7xr/uUn3Vyv5qXvS/7kx\nGvMONs55qh64Gtc3FSFPEdVyZXasCMEWwXyadqzf+/qJtEYlK0Uy5E/u7CTsnmcH\n9TEiYVw0/6PomQ2HJfSlZVUUO007OliBHO9bWOwZ6qI5c53pt5KES0dyy6SQ4m+8\nawIDAQAB\n-----END PUBLIC KEY-----\n"
}

View File

@@ -1,4 +0,0 @@
{
"name": "rsk-mainnet-2",
"public_key": "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAu1cuvB3l7sBKJXqjhTih\nQloXteYOr/cQ24R5xUDnHZpCzM75khBjf9ZIX5fskManQ7MI4oFHAaKF6sCWT9QQ\nnL3ON0rCX8wDwBJpKY3iFisAK7f86GO5qkG2ovwG4wO1x69eKX52w33xGpPLPrmw\nBhFv+KfT56KZ3NCvDIQ6tew9VJ3g2V2zUtlL7xZIcdkgTXB06Ec8gbtoCAD3MVUQ\noxMCn+CK6QIAHGxpLIFEv5Y4hNRJ3+0RSuQikhhFzd7P2swnUgDSxDpbfoShroCC\neDw29sapOkQ+PwiHo2Zy8Qtr5m1ToGIhh8l1f/k2vi0Vf2xWVaTjbaeePEDMy9Fd\nKQIDAQAB\n-----END PUBLIC KEY-----\n"
}

View File

@@ -0,0 +1,4 @@
{
"name": "rsk-mainnet-3",
"public_key": "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAwdrYfy0Spmt8VETCdUgW\nHbxV3uYA3kn2swvOdIjIR29gNO+t6wWv6FHnV/pfefIweIPaNlr9VMoUejUKX809\ngzdsiVWh1T6s4Yzbbt+O8mF3my5RXiSvizda8c6U65vofBSL2WVzE1AW9v7lXRHX\nJ4auKrpgKWkNLU52QLIP9/X5YLUHQtpTnplO31eb+jSD185aN1qoIxugunxnWSgm\n2NgUPlVbNCFrhv0PVv4Ts10eX6smRX3LKyNBtRRXM3GIrQHlAYRohIpy3lt8tKm4\nE/v9qpXQHvqEmX9FH1/Sonea849cWX3LuxUYLT2XFpaNwUxJK56Ef0HsgZESaxL+\n3QIDAQAB\n-----END PUBLIC KEY-----\n"
}

View File

@@ -1,4 +0,0 @@
{
"name": "rsk-testnet-1",
"public_key": "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA0JU46rCyLGOi5OdeeE2M\nobUUxO+Jqd9t9bP75Pyj0uH8WaxNv1PIdWZJiR+fcE+draBV86/YLxHzOFvsnMi+\nE/qgeXLKErGtTSb12mWq0gYv/wz9uqRbtcsv40gpu2BtNv9ycdXYACB/s0ipnuUO\nX/os4YHDvWV1cshwzgsQ87ad7OdT/Nldggtp4go60TkBi49VaftiJzYqVm1ey3xz\nd7+EsQWqhQHAac6POEuPjwNuM2valf/8+nI4Uday/CiFrDDV1SffRG30sd4rJF15\nh1S1Kxyetr72EmQwIGbJuDJL7eUU7blXjg6UtTxDDsl6rYUO5s/j7wZLoFhmC854\npQIDAQAB\n-----END PUBLIC KEY-----\n"
}

View File

@@ -1,4 +0,0 @@
{
"name": "rsk-testnet-2",
"public_key": "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAzG2bgL0n5Q7bTR4WYHOB\nZNOuRem/jjarU/bL0VKKn0JqD3PPDAnhq9gRn7H8SwyGoVFN60YGzu45O4c+SqN3\nCXN+FeFabigH2tKLxBz3kNDYTT/F1ErLLi/6ydrCV3tpddR5KTqLSOntojG8KNzc\nyG4rMV9ebCE1wDVxAFdEA+YDZS8YjP0nO5sLWFacA0ZTx27t5ugqZP1acjSvKzWs\nZ+ekX5Pbws/oUHyaqEEPdz7er4MTBm0bdkCHZbM7132oBcH/huJZhmTXFEdoy4ML\nhP4MWWSvwo66HDYjnaID82a8W1RJZZu2irbPHrfVlaFAh8VQk1T1kkUu0bMovT3V\nYQIDAQAB\n-----END PUBLIC KEY-----\n"
}

View File

@@ -1,4 +0,0 @@
{
"name": "rsk-testnet-3",
"public_key": "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAxbo3GccgPZp8UWhb9l2w\n+o6Qe5s4Tf/1TMOw3ppLw+IGCZhq9LEe8s8kngbBX7dMywbyDuf8vLXwvAHFKvC+\nx4XOXq0r9xDX8ujTCfqJxiSYk1KTyqM4lmi7qno7F9/Nwo7h3HuVbpkT752ojf+/\nDCSXwHL+uHlF6z3jKZ8iYBRHFrWmudh8bOm6lVsp/Iv4pQ/btZf8W5zULlk/Z6lT\nb6GS538Lnaoeu7wPCf/awL5GBg9findY3oS1lsEE+PfAu6SAHmbJcItMkrON7Esd\ng9xtwsjX1VICpJhOSkVS1nmRfYohELVJMdiKSLq+b5UskscbCjkRGY6GAPH8cVGg\nSQIDAQAB\n-----END PUBLIC KEY-----\n"
}

View File

@@ -0,0 +1,4 @@
{
"name": "rsk-testnet-4",
"public_key": "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA1NgmlPomxGRtu5oyro+m\ndQwBXwrhEuE73aLrUsqGOVSezph6LnETiEMFUIe1weoG+xdcykcUUMt7o1+nKs+E\nl8dxMIgbXAxdpI4n8gOpii70Sh30BDbh8+qZHsKBq32UmkCpz2ViVe/Vb3ViqB3e\n0GIkknPle5G4IC612O8EUkCenwcD1jSXYyug5zWI2T/TwnTuw4JdxfhkMgBM7Y2n\nR1YY6GwAMkK97wE/yBM74+Tiv/6lDy/JDbYmUVcQ55C937oodSWLAEM24EcOOtMA\nKfGumnthbdHzmHjONmLIegD3OJGYC2ulcB9qmaL/7cyIRhf6fEQrBolCH5881fxl\nxwIDAQAB\n-----END PUBLIC KEY-----\n"
}

View File

@@ -0,0 +1,4 @@
{
"name": "rsk-testnet-5",
"public_key": "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAx/UHlgcSeh9Do7CTCKXC\n/4/aO2OvT+ijDVmrMYCNtE4sMeuFqKPnV1zxJZmRm4VNhkSQDkdWYD+6XvuFYW60\nyjB/N6D5lLlyjG4HD6fTkfh0K6f7t5mOYV7o4T59OoA3cBZuSROjtWmJ8jEFJ+k9\nII2kcyhPQcFN01ckzvZKRSPbVRccMoc+AKTjB3ZUfs/ERtlVoDrK4jEHluXOxUJO\nBKCcLonjJuLlpRLh7QfKrKFcR4idn5Ir43R6aSUesI/ipKwKsXnR3Bu7vXp74VF3\nMJ3EkdSBG+qJzy51fbRfQiUPAr/vSoVQZwW7FkIhIqqLkMaYCymn7qKfTGujoNU7\nlwIDAQAB\n-----END PUBLIC KEY-----\n"
}

4
clients/strfry-1.json Normal file
View File

@@ -0,0 +1,4 @@
{
"name": "strfry-1",
"public_key": "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAzDV/RMGMXVDbvoA6PNh8\nQzhtHwYDCFcUSkbrwP6tzh6GpVunGEOdOdhj2V63T2tF1H+lujxQXh5pK7C0D6VZ\niO04ftJlo7/svyxUcwWr+znyN5sFdQRh3cBZiGSBYolizwoqgtPFlbNhmWAzV0Du\n9t8mhz70IK3B+UdwWyHtoK0NNsJGnQ9YzAvcjyDmEO/3sCjAhNnxVpmXftpcSmd9\nMonzFtIDBbRRll4AHZYRbmXCzx63+VmelvdnufnbY82liol0zzBwJaBD1wyNlG0y\ni96p3Kx03bLNlIaYVGbjZeJi+6oo2VDWJ4OloLLAYoHDSipeHT9qWfUdnE6ge4Lm\nywIDAQAB\n-----END PUBLIC KEY-----\n"
}

View File

@@ -1,26 +0,0 @@
*~
*#
.#*
\#*#
.*.sw[a-z]
*.un~
*.tmp
*.bk
*.bkup
.kitchen.local.yml
Berksfile.lock
Gemfile.lock
.bundle/
.cache/
.kitchen/
.vagrant/
.vagrant.d/
.yardoc/
bin/
coverage/
doc/
pkg/
tmp/
vendor/
.rspec

View File

@@ -1,16 +0,0 @@
driver:
name: vagrant
provisioner:
name: chef_zero
deprecations_as_errors: true
platforms:
- name: centos-6
- name: centos-7
- name: ubuntu-16.04
- name: ubuntu-18.04
suites:
- name: default
run_list: chef-sugar::default

View File

@@ -1,309 +0,0 @@
# Chef Sugar Changelog
This file is used to list changes made in each version of the chef-sugar cookbook and gem.
<!-- latest_release -->
<!-- latest_release -->
<!-- release_rollup -->
<!-- release_rollup -->
<!-- latest_stable_release -->
## [v5.1.12](https://github.com/chef/chef-sugar/tree/v5.1.12) (2020-11-11)
#### Merged Pull Requests
- Don&#39;t define which helper on Chef 16+ to avoid conflicts [#21](https://github.com/chef/chef-sugar/pull/21) ([tas50](https://github.com/tas50))
<!-- latest_stable_release -->
## [v5.1.11](https://github.com/chef/chef-sugar/tree/v5.1.11) (2020-08-14)
#### Merged Pull Requests
- Fix Ruby 2.3 tests [#19](https://github.com/chef/chef-sugar/pull/19) ([tas50](https://github.com/tas50))
- Only require libs if we haven&#39;t already loaded them [#20](https://github.com/chef/chef-sugar/pull/20) ([tas50](https://github.com/tas50))
## [v5.1.9](https://github.com/chef/chef-sugar/tree/v5.1.9) (2019-11-13)
#### Merged Pull Requests
- Don&#39;t fail if Chef::VERSION isn&#39;t defined [#18](https://github.com/chef/chef-sugar/pull/18) ([lamont-granquist](https://github.com/lamont-granquist))
## [v5.1.8](https://github.com/chef/chef-sugar/tree/v5.1.8) (2019-11-13)
#### Merged Pull Requests
- Wire up Expeditor and support both chef-sugar and chef-sugar-ng [#8](https://github.com/chef/chef-sugar/pull/8) ([tas50](https://github.com/tas50))
- Add github templates and a code of conduct [#9](https://github.com/chef/chef-sugar/pull/9) ([tas50](https://github.com/tas50))
- Beginning of chef-sugar deprecation [#10](https://github.com/chef/chef-sugar/pull/10) ([lamont-granquist](https://github.com/lamont-granquist))
- Use Expeditor to set the version in the metadata.rb file [#11](https://github.com/chef/chef-sugar/pull/11) ([tas50](https://github.com/tas50))
- Switch gemfile back to chef-sugar [#12](https://github.com/chef/chef-sugar/pull/12) ([tas50](https://github.com/tas50))
- Fix metadata.rb version updatig logic and use SPDX compliant license strings [#14](https://github.com/chef/chef-sugar/pull/14) ([tas50](https://github.com/tas50))
- Additional Chef-15 greenification [#13](https://github.com/chef/chef-sugar/pull/13) ([lamont-granquist](https://github.com/lamont-granquist))
- Move test deps to the Gemfile [#15](https://github.com/chef/chef-sugar/pull/15) ([tas50](https://github.com/tas50))
- Get the tests green [#17](https://github.com/chef/chef-sugar/pull/17) ([tas50](https://github.com/tas50))
- Deprecate chef-sugar node API [#16](https://github.com/chef/chef-sugar/pull/16) ([lamont-granquist](https://github.com/lamont-granquist))
## v5.0.1 (2019-03-13)
- Modifies the behavior of `systemd?` so that it works equally well on physical/virtual
machines as well as within containers.
## v5.0.0 (2018-12-26)
- BREAKING CHANGE: Require Chef 13 or later
- Trim out test files and the cookbook from the gem artifact to slim install size
## v4.2.1 (2018-12-06)
- Repackaged with an older stove to remove the metadata.rb on the Supermarket for older chef-client releases
## v4.2.0 (2018-12-05)
- Added a new parallels? helper
- Added support for the Raspberry Pi 1 and Zero to armhf? helper
- Added a centos_final? helper
## v4.1.0 (2018-08-16)
- Improve the detection of linux hosts with the linux? helper. Amazon Linux and obscure distros will now be properly detected.
## v4.0.1 (2018-08-09)
- Add new Debian, Mint, macOS codenames
- Add new Ubuntu codenames: artful, bionic, cosmic
## v4.0.0 (2018-01-26)
- Require Ruby 2.2 or later and Chef 12.10 or later
- Cookbook now installs the chef-sugar gem via a metadata installation so chef-sugar::default on your runlist is no longer needed
- Added additional metadata to the cookbook: supports, issue_url, source_url, chef_version.
- Requirements improved in the readme
## v3.6.0 (2017-10-26)
- Add Ubuntu zesty and debian stretch detection
- Add softlayer? helper
- Add aarch64? helper
## v3.5.0 (2016-07-12)
- Improve the systemd check to not fail on older kernels or Windows hosts
- Add detection of macOS 10.11 and 10.12
## v3.4.0 (2016-07-18)
### Improvements
- Add `virtual?` and `physical?` methods
- Add Scaleway C1 server (arm arch) support
- Add IMB s390x support
- Add missing Ubuntu release names
### Bug Fixes
- Drop Ruby 2.0.0 support from Travis test matrix
- Pin to Rack 1.6 (dev dep)
## v3.3.0 (2016-01-11)
### Improvements
- Break up `Chef::Sugar::Constraints` into a class and a dsl file
- Add `platform_version` method with full constraints comparison support
## v3.2.0 (2015-12-10)
### Improvements
- Add platform matchers for `debian` and `fedora`
- Add `openvz` support under virtualization
- Add init system detection support
- Add support for `nexus`, `ios_xr` platforms and `wrlinux` platform_family
- Add additional `aix` helpers
### Bug Fixes
- Properly expose `Architecture#i386?` in the DSL
## v3.1.1 (2015-06-23)
### Improvements
- Update Intel CPU types based on existing Fauxhai data
- Update SPARC logic and 32/64-bit logic for x86 and i386
### Bug Fixes
- Fix 32-bit logic
- Fix default behavior to include chef-sugar at compile time
- Fix Chef 12.1.0 warnings for chef_gem compile time install
- Fix `redhat_enterprise_linux?` matcher
## v3.0.2 (2015-03-26)
### Improvements
- Add helpers for `ppc64` and `ppc64le` architecture
### Bug Fixes
- Adjustments to error message
## v3.0.1 (2015-03-20)
### Breaking Changes
- Rename `compile_time` `to at_compile_time` - if your recipes are affected by this breaking change, your Chef Client run will produce a verbose error message with details on how to fix the error.
## v3.0.0 (2015-03-17)
### Breaking Changes
- Drop support for Ruby 1.9 (it might still work, but it is no longer officially supported)
### Improvements
- Remove accidentially committed gem source
- Bump development dependencies
- Add `digitalocean?` matcher
- Expose the `rhel` platform as `el`
- Add `ppc64le` platform
- Add helper for determining if architecture is SPARC
- Add helper for determining if architecture is Intel
- Add dynamic platform/version matchers for Solaris
### Bug Fixes
- Reset namespace_options when reaching top-level resources
## v2.5.0 (2015-01-05)
### Improvements
- Add `data_bag_item_for_environment` function
- Add `kvm?` matcher
- Add `virtualbox?` matcher
### Bug Fixes
- Use `.key?` to check for hash key presence, raising an `AttributeDoesNotExist` error sooner
## v2.4.1 (2014-10-12)
- No changes from v2.4.0 - forced a new version upload to the Chef Supermarket
## v2.4.0 (2014-10-12)
### Improvements
- Add `docker?` matcher
## v2.3.2 (2014-10-07)
### Big Fixues
- Include `amd64` in `_64_bit?` check
## v2.3.1 (2014-10-07)
### Improvements
- Check all 64-bit architectures that may be reported by Ohai
### Bug Fixes
- Be more tolerant of `nil` values return from sub functions
- Check to make sure `node['domain']` is not `nil` before calling `#include?`
## v2.3.0 (2014-09-24)
### Improvements
- Add `vmware?` matcher
- Allow the attribute DSL to access parent attributes
### Bug Fixes
- Return `true` or `false` from all Boolean methods (instead of `nil` or truthy values)
## v2.2.0 (2014-08-20)
### Improvements
- Add `smartos?` matcher
- Add `omnios?` matcher
## v2.1.0 (2014-06-26)
### Improvements
- Add `solaris2?` matcher
- Add `aix?` matcher
- Add 'lxc?' matcher
### Bug Fixes
- Fix a bug in namespace memoization during attribute initialization
## v2.0.0 (2014-06-16)
### Breaking
- Remove `not_linux?` method
- Remove `not_windows?` method
### Improvements
- Miscellaneous spelling fixes
- Update a failing unit test for `installed?`
- Add Mac OS X to the list of platforms (Yosemite)
- Upgrade to RSpec 3
- Fix `which` (and `installed?` and `installed_at_version?`) when given an absolute path
- Fix `linux?` check to only return true on real linuxes
## v1.3.0 (2014-05-05)
- Check both `$stdout` and `$stderr` in `version_for`
- Add additional platform versions
- Make `includes_recipe?` a top-level API (instead of just Node)
- Match on the highest version number instead of direct equality checking on platform versions
- Define `Object#blank?` as a core extension
- Define `String#flush` as a core extension
- Remove Stove
## v1.2.6 (2014-03-16)
- Fix a bug in `vagrant?` returning false on newer Vagrant versions
- Remove Coveralls
## v1.2.4 (2014-03-13)
- See (1.2.2), but I botched the release
## v1.2.2 (2014-03-13)
- Fix a critical bug with `encrypted_data_bag_item` using the wrong key
## v1.2.0 (2014-03-09)
- Add `namespace` functionality for specifying attributes in a DSL
- Add constraints helpers for comparing version strings
- Add `require_chef_gem` to safely require and degrade if a gem is not installed
- Add `deep_fetch` and `deep_fetch!` to fetch deeply nested keys
- Accept an optional secret key in `encrypted_data_bag_item` helper and raise a helpful error if one is not set (NOTE: this changes the airity of the method, but it's backward-compatible because Ruby is magic)
- Add Stove for releasing
- Updated copyrights for 2014
## v1.1.0 (2013-12-10)
- Add `cloudstack?` helper
- Add data bag helpers
- Remove foodcritic checks
- Upgrade development gem versions
- Randomize spec order
## v1.0.1 (2013-10-15)
- Add development recipe
- Add `compile_time`, `before`, and `after` filters
## v1.0.0 (2013-10-15)
- First public release

View File

@@ -1 +0,0 @@
Please refer to the Chef Community Code of Conduct at https://www.chef.io/code-of-conduct/

View File

@@ -1,20 +0,0 @@
Contributing to Chef Sugar
===============================
The process for contributing to Chef sugar is rather straight-forward. It is unlikely that you'll need to modify the actual Chef recipe, so it's assumed that you want to work on the Gem itself.
1. Fork the repository on GitHub.
2. Clone your fork.
3. Create a new, semantically-named branch:
$ git checkout -b my_feature_branch
4. Make any changes, ensuring you write adequate test coverage.
5. Document your changes (YARD).
6. Run the tests (make sure they pass).
7. Submit a Pull Request on GitHub.
8. (optional) Ping me on Twitter (@sethvargo)
Additionally, please **DO NOT**:
- Modify the version of the cookbook or gem.
- Update the CHANGELOG
- Make unnecessary changes to the gemspec

View File

@@ -1,84 +0,0 @@
### Chef Sugar is being deprecated, this is the internal list of the TODO tasks
TASKS in order:
* ~~pull cloud.rb into core-chef~~
* pull data_bag.rb into core-chef
* ~~pull run_context.rb into core-chef~~
* ~~pull vagrant.rb into core-chef~~
* ~~pull virtualization.rb into core-chef~~
* deprecate ip.rb with no replacement (although maybe a new ohai attribute?)
* deprecate kernel.rb with no replacement
* ~~deprecate node.rb with no replacement~~
* deprecate ruby.rb with no replacement
* determine what to do about filters.rb
* determine what to do about remaining platform.rb
* determine what to do about shell.rb
* determine what to do about core_extensions
NOTES on files:
architecture.rb is COMPLETED
cloud.rb is COMPLETED
constraint.rb / constraint_dsl.rb tasks:
* replace with Chef::VersionString objects
core_extensions
* pile of monkeypatches that makes my eyes twitch a little bit. how much do we want to become activerecord? counter-argument is
that some activerecord-ish helpers are SUUUPER useful. but we should probably copy them from activerecord since those are more
likely to get pulled directly into core-chef.
data_bag
* we should pull this into core-chef or something comparable (TBD)
docker.rb is COMPLETED
filters.rb tasks
* incorporate the before/after syntax into the find_resource/edit_resource API (probably renamed, with deprecation done here)
* deprecate the at_compile_time helper in favor of moving the `compile_time true` property into Chef::Resource directly
init.rb is COMPLETED
* unless we get user complaints, runit is dead to us and this is done
ip.rb
* needs to be deprecated with no replacement (could push this into another ohai attribute -- or have we done it already?)
kernel.rb (the require_chef_gem trivial helper)
* needs to be deprecated with no replacement.
kitchen.rb is COMPLETED
node.rb (the method_missing syntax)
* needs to be deprecated with no replacement.
platform.rb tasks:
* decide what to do about the `debian_before_squeeze` platform version helpers.
* decide what to do about the `platform_version` helper (can we wire this up to a Chef::VersionString object instead?)
platform_family.rb is COMPLETED
ruby.rb tasks:
* needs to be deprecated with no replacement (nobody has used it since ruby 2.0, so its clearly not being used)
run_context.rb is COMPLETED
shell.rb: (collection of helpers including `which`)
* TBD
vagrant.rb is COMPLETED
virtualization.rb is COMPLETED

View File

@@ -1,34 +0,0 @@
source "https://rubygems.org"
gemspec name: "chef-sugar"
group :debug do
gem "pry"
gem "pry-byebug" unless Gem::Version.new(RUBY_VERSION) < Gem::Version.new("2.4")
gem "pry-stack_explorer", "~> 0.4.0" # pin until we drop ruby < 2.6
end
group :test do
if Gem::Version.new(RUBY_VERSION) < Gem::Version.new("2.5")
gem "chefspec", "~> 7.4.0" # supports Chef 13+ aka ruby 2.3+
gem "chef", "~> 13" # also needed to support Ruby 2.3
elsif Gem::Version.new(RUBY_VERSION) < Gem::Version.new("2.6")
gem "chefspec"
gem "chef-zero", "~> 14"
gem "chef", "~> 15" # also needed to support Ruby 2.3
else
gem "chefspec"
end
if Gem::Version.new(RUBY_VERSION) < Gem::Version.new("2.4")
gem "rubyzip", "< 2"
else
gem "rubyzip"
end
gem "rake"
gem "rspec"
end
group :kitchen do
gem "kitchen-vagrant"
gem "license-acceptance", "~> 1.0" if Gem::Version.new(RUBY_VERSION) < Gem::Version.new("2.4")
gem "test-kitchen"
end

View File

@@ -1,546 +0,0 @@
# Chef Sugar
[![Gem Version](http://img.shields.io/gem/v/chef-sugar.svg?style=flat-square)][gem]
[![Build status](https://badge.buildkite.com/f44140e4898b4935bfc3bba523efc2a7592d7c9a1bae3faf5c.svg?branch=master)](https://buildkite.com/chef-oss/chef-chef-sugar-master-verify)
# CHEF SUGAR DEPRECATION WARNING
Chef Sugar is in the process of being migrated into Chef Infra Client 15 and Chef Infra Client 16. The bulk of that work has already
been completed. After it is completed there will be no need for this cookbook and gem, and it will no longer be supported. No
issues or patches are being accepted at this time.
The final major version release of Chef Sugar will raise and will not be functional. Users on Chef Infra Client <= 14 or old versions of 15
will need to have a pessimistic pin on chef-sugar, or simply upgrade.
## Requirements
### Platforms
- any platform
### Chef
- Chef 13.0+
### Cookbooks
- none
## Installation
If you want to develop/hack on chef-sugar, please see the CONTRIBUTING.md.
If you are using Berkshelf, add `chef-sugar` to your `Berksfile`:
```ruby
cookbook 'chef-sugar'
```
Otherwise, you can use `knife` or download the tarball directly from the community site:
```ruby
knife cookbook site install chef-sugar
```
## Usage
Simply depend on this cookbook in the metadata of your cookbook and the gem will be installed and required..
Requiring the Chef Sugar Gem will automatically extend the Recipe DSL, `Chef::Resource`, and `Chef::Provider` with helpful convenience methods.
### Module Method
If you are working outside of the Recipe DSL, you can use the module methods instead of the Recipe DSL. In general, the module methods have the same name as their Recipe-DSL counterparts, but require the node object as a parameter. For example:
In a Recipe:
```ruby
# cookbook/recipes/default.rb
do_something if windows?
```
In a Library as a singleton:
```ruby
# cookbook/libraries/default.rb
def only_on_windows(&block)
yield if Chef::Sugar::PlatformFamily.windows?(@node)
end
```
In a Library as a Mixin:
```ruby
# cookbook/libraries/default.rb
include Chef::Sugar::PlatformFamily
def only_on_windows(&block)
yield if windows?(@node)
end
```
## API
**Note:** For the most extensive API documentation, please see the YARD documentation.
### Architecture
**Note:** Some of the architecture commands begin with an underscore (`_`) because Ruby does not permit methods to start with a numeric.
- `_64_bit?`
- `_32_bit?`
- `intel?`
- `sparc?`
- `ppc64?`
- `ppc64le?`
- `powerpc?`
#### Examples
```ruby
execute 'build[my binary]' do
command '...'
not_if { _64_bit? }
end
```
### Cloud
- `azure?`
- `cloud?`
- `digitalocean?`
- `ec2?`
- `eucalyptus?`
- `gce?`
- `linode?`
- `openstack?`
- `cloudstack?`
- `rackspace?`
- `softlayer?`
#### Examples
```ruby
template '/tmp/config' do
variables(
# See also: best_ip_for
ipaddress: cloud? ? node['local_ipv4'] : node['public_ipv4']
)
end
```
### Core Extensions
**Note:** Core extensions are **not** included by default. You must require the `chef/sugar/core_extensions` module manually to gain access to these APIs:
```ruby
require 'chef/sugar/core_extensions'
```
- `String#satisfies?`
- `String#satisfied_by?`
- `Array#satisfied_by?`
- `Object#blank?`
#### Examples
```ruby
# Checking version constraints
'1.0.0'.satisfies?('~> 1.0') #=> true
'~> 1.0'.satisfied_by?('1.0') #=> true
```
```ruby
# Check for an object's presence
''.blank? #=> true
['hello'].blank? #=> false
```
### Data Bag
- `encrypted_data_bag_item` - a handy DSL method for loading encrypted data bag items the same way you load a regular data bag item; this requires `Chef::Config[:encrypted_data_bag_secret]` is set!
- `encrypted_data_bag_item_for_environment` - find the encrypted data bag entry for the current node's Chef environment.
- `data_bag_item_for_environment` - find the data bag entry for the current node's Chef environment.
#### Examples
```ruby
encrypted_data_bag_item('accounts', 'hipchat')
```
```ruby
encrypted_data_bag_item_for_environment('accounts', 'github')
```
```ruby
data_bag_item_for_environment('accounts', 'github')
```
### Docker
Chef Sugar looks for hints to see if the node being converged is a Docker container. When [Ohai supports checking other nodes](https://github.com/opscode/ohai/pull/428), Chef Sugar will automatically pick up the information.
- `docker?`
#### Examples
```ruby
template '/runme' do
only_if { docker?(node) }
end
```
### Attributes
Chef Sugar adds more Chef-like DSL to attribute definitions. Instead of using the Ruby hash syntax, you can define attributes using nested namespaces. This DSL may be more friendly to non-Ruby developers. It can safely be mixed-and-matched with the standard syntax.
```ruby
# This is functionally the same as default['apache2']['config']['root'] = '/var/www'
namespace 'apache2' do
namespace 'config' do
root '/var/www'
end
end
```
```ruby
# Specify multiple keys instead of nesting namespaces
namespace 'apache2', 'config' do
root '/var/www'
end
```
```ruby
# Specify different nested precedence levels
namespace 'apache2', precedence: normal do
namespace 'config', precedence: override do
root '/var/www' #=> override['apache2']['config']['root'] = '/var/www'
end
end
```
### Constraints
- `constraints` - create a new constraint (or requirement) that can be used to test version validations.
- `chef_version` - (DSL only) a wrapper for `version(Chef::VERSION)`
- `version` - create a new version that can be used to test constraint validation.
#### Examples
```ruby
# Check if a version is satisfied by a constraint
version('1.2.3').satisfies?('~> 1.2.0')
```
```ruby
# Check if a constraint is satisfied by a version
constraint('~> 1.2.0').satisfied_by?('1.2.3')
```
```ruby
# Support multiple constraints
version('1.2.3').satisfies?('> 1.2', '< 2.0')
constraint('> 1.2', '< 2.0').satisfied_by?('1.2.3')
```
```ruby
# Only perform an operation if Chef is at a certain version
package 'apache2' do
not_if { chef_version.satisfies?('~> 11.0') } # Ignore Chef 11
end
```
### Kernel
- `require_chef_gem` - "safely" require a gem. Loading a gem with Chef is sometimes difficult and confusing. The errors that Chef produces are also sometimes not very intuitive. In the event you require a gem to exist on the system, you can use `require_chef_gem`, which will attempt to require the gem and then produce helpful output if the gem is not installed:
```
Chef could not load the gem `#{name}'! You may need to install the gem
manually with `gem install #{name}', or include a recipe before you can
use this resource. Please consult the documentation for this cookbook
for proper usage.
```
#### Examples
```ruby
# LWRP
require_chef_gem 'pry'
```
```ruby
class Chef
class Provider
class MyProvider > Provider
require_chef_gem 'pry'
end
end
end
```
### Init
- `systemd?` - detect if init system is systemd
- `upstart?` - detect if init system is upstart
- `runit?` - detect if init system is runit
#### Examples
```ruby
systemd_service 'my-service' do
description 'My Service'
install do
wanted_by 'multi-user.target'
end
service do
exec_start '/usr/bin/myserviced'
end
action [:create, :enable, :start]
only_if { systemd? }
end
cookbook_file '/etc/init/my-service.conf' do
source 'my-service.conf'
only_if { upstart? }
end
```
### IP
- `best_ip_for` - determine the best IP address for the given "other" node, preferring local IP addresses over public ones.
#### Examples
```ruby
redis = search('node', 'role:redis').first
template '/tmp/config' do
variables(
ipaddress: best_ip_for(redis)
)
end
```
### Node
Additional methods for the `node` object
- `deep_fetch` - safely fetch a nested attribute.
- `deep_fetch!` - fetch a nested attribute, raising a more semantic error if the key does not exist.
- `in?` - determine if the node is in the given Chef environment.
#### Examples
```ruby
credentials = if node.in?('production')
Chef::EncryptedDataBag.new('...')
else
data_bag('...')
end
```
```ruby
node.deep_fetch('apache2', 'config', 'root') => node['apache2']['config']['root']
```
### Platform
- `amazon_linux?`
- `centos?`
- `linux_mint?`
- `oracle_linux?`
- `redhat_enterprise_linux?`
- `scientific_linux?`
- `ubuntu?`
- `solaris2?`
- `aix?`
- `smartos?`
- `omnios?`
- `raspbian?`
- `nexus?`
- `ios_xr?`
There are also a series of dynamically defined matchers that map named operating system release versions and comparison operators in the form "#{platform}_#{operator}_#{name}?". For example:
- `debian_after_squeeze?`
- `linuxmint_after_or_at_olivia?`
- `mac_os_x_lion?`
- `centos_final?`
- `ubuntu_before_lucid?`
- `ubuntu_before_or_at_maverick?`
- `solaris_10?`
- `solaris_11?`
To get a full list, run the following in IRB:
```ruby
require 'chef/sugar'
puts Chef::Sugar::Platform.instance_methods
```
#### Examples
```ruby
if ubuntu?
execute 'apt-get update'
end
```
### Platform Family
- `arch_linux?`
- `debian?`
- `fedora?`
- `freebsd?`
- `gentoo?`
- `linux?`
- `mac_os_x?`
- `openbsd?`
- `rhel?`
- `slackware?`
- `suse?`
- `windows?`
- `wrlinux?`
#### Examples
```ruby
node['attribute'] = if windows?
'C:\Foo\BarDrive'
else
'/foo/bar_drive'
end
```
### Ruby
**Note:** The applies to the Ruby found at `node['languages']['ruby']`.
- `ruby_20?`
- `ruby_19?`
#### Examples
```ruby
log 'This has been known to fail on Ruby 2.0' if ruby_20?
```
### Run Context
- `includes_recipe?` - determines if the current run context includes the recipe
```ruby
if includes_recipe?('apache2::default')
apache_module 'my_module' do
# ...
end
end
```
### Shell
- `which`
- `dev_null`
- `installed?`
- `installed_at_version?`
- `version_for`
#### Examples
```ruby
log "Using `mongo` at `#{which('mongo')}`"
if installed?('apt')
execute 'apt-get update'
end
execute 'install[thing]' do
command "... 2>&1 #{dev_null}"
not_if { installed_at_version?('thing', node['thing']['version']) }
end
log "Skipping git install, version is at #{version_for('mongo', '-v')}"
```
### Vagrant
- `vagrant?`
#### Examples
```ruby
http_request 'http://...' do
not_if { vagrant? }
end
```
### Virtualization
- `kvm?`
- `lxc?`
- `parallels?`
- `virtualbox?`
- `vmware?`
- `openvz?`
#### Examples
```ruby
service 'ntpd' do
action [:enable, :start]
not_if { lxc? }
end
```
### Filters
- `at_compile_time` - accepts a block of resources to run at compile time
- `before` - insert resource in the collection before the given resource
- `after` - insert resource in the collection after the given resource
#### Examples
```ruby
at_compile_time do
package 'apache2'
end
# This is equivalent to
package 'apache2' do
action :nothing
end.run_action(:install)
```
```ruby
before 'service[apache2]' do
log 'I am before the apache 2 service fires!'
end
```
```ruby
after 'service[apache2]' do
log 'I am after the apache 2 service fires!'
end
```
## License & Authors
- Author: Seth Vargo (sethvargo@gmail.com)
```text
Copyright 2013-2015 Seth Vargo
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
```
[gem]: https://rubygems.org/gems/chef-sugar

View File

@@ -1,9 +0,0 @@
require 'rspec/core/rake_task'
RSpec::Core::RakeTask.new do |t|
t.rspec_opts = [
'--color',
'--format progress',
].join(' ')
end
task default: :spec

View File

@@ -1 +0,0 @@
5.1.12

View File

@@ -1,24 +0,0 @@
# coding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'chef/sugar/version'
Gem::Specification.new do |spec|
spec.name = 'chef-sugar-ng'
spec.version = Chef::Sugar::VERSION
spec.authors = ['Seth Vargo']
spec.email = ['sethvargo@gmail.com']
spec.description = 'A series of helpful sugar of the Chef core and ' \
'other resources to make a cleaner, more lean recipe ' \
'DSL, enforce DRY principles, and make writing Chef ' \
'recipes an awesome experience!'
spec.summary = 'A collection of helper methods and modules that ' \
'make working with Chef recipes awesome.'
spec.homepage = 'https://github.com/chef/chef-sugar'
spec.license = 'Apache-2.0'
spec.required_ruby_version = '>= 2.3'
spec.files = %w{LICENSE} + Dir.glob("lib/**/*", File::FNM_DOTMATCH).reject { |f| File.directory?(f) }
spec.require_paths = ['lib']
end

View File

@@ -1,24 +0,0 @@
# coding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'chef/sugar/version'
Gem::Specification.new do |spec|
spec.name = 'chef-sugar'
spec.version = Chef::Sugar::VERSION
spec.authors = ['Seth Vargo']
spec.email = ['sethvargo@gmail.com']
spec.description = 'A series of helpful sugar of the Chef core and ' \
'other resources to make a cleaner, more lean recipe ' \
'DSL, enforce DRY principles, and make writing Chef ' \
'recipes an awesome experience!'
spec.summary = 'A collection of helper methods and modules that ' \
'make working with Chef recipes awesome.'
spec.homepage = 'https://github.com/chef/chef-sugar'
spec.license = 'Apache-2.0'
spec.required_ruby_version = '>= 2.3'
spec.files = %w{LICENSE} + Dir.glob("lib/**/*", File::FNM_DOTMATCH).reject { |f| File.directory?(f) }
spec.require_paths = ['lib']
end

View File

@@ -1,51 +0,0 @@
#
# Copyright 2013-2015, Seth Vargo <sethvargo@gmail.com>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
require 'chef/recipe'
require 'chef/resource'
require 'chef/provider'
class Chef
module Sugar
require_relative 'sugar/architecture'
require_relative 'sugar/cloud'
require_relative 'sugar/constraints'
require_relative 'sugar/constraints_dsl'
require_relative 'sugar/data_bag'
require_relative 'sugar/docker'
require_relative 'sugar/filters'
require_relative 'sugar/init'
require_relative 'sugar/ip'
require_relative 'sugar/kernel'
require_relative 'sugar/kitchen'
require_relative 'sugar/node'
require_relative 'sugar/platform'
require_relative 'sugar/platform_family'
require_relative 'sugar/ruby'
require_relative 'sugar/run_context'
require_relative 'sugar/shell'
require_relative 'sugar/vagrant'
require_relative 'sugar/version'
require_relative 'sugar/virtualization'
end
end
Chef::Recipe.send(:include, Chef::Sugar::DSL)
Chef::Recipe.send(:include, Chef::Sugar::RecipeDSL) # TODO: this is a hack
Chef::Resource.send(:include, Chef::Sugar::DSL)
Chef::Provider.send(:include, Chef::Sugar::DSL)
Object.send(:include, Chef::Sugar::Kernel)

View File

@@ -1,176 +0,0 @@
#
# Copyright 2013-2015, Seth Vargo <sethvargo@gmail.com>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
class Chef
module Sugar
module Architecture
extend self
# these helpers have been moved to core-chef
if !defined?(Chef::VERSION) || Gem::Requirement.new("< 15.4.70").satisfied_by?(Gem::Version.new(Chef::VERSION))
#
# Determine if the current architecture is 64-bit
#
# @return [Boolean]
#
def _64_bit?(node)
%w(amd64 x86_64 ppc64 ppc64le s390x ia64 sparc64 aarch64 arch64 arm64 sun4v sun4u s390x)
.include?(node['kernel']['machine']) || ( node['kernel']['bits'] == '64' )
end
#
# Determine if the current architecture is 32-bit
#
# @todo Make this more than "not 64-bit"
#
# @return [Boolean]
#
def _32_bit?(node)
!_64_bit?(node)
end
#
# Determine if the current architecture is i386
#
# @return [Boolean]
#
def i386?(node)
_32_bit?(node) && intel?(node)
end
#
# Determine if the current architecture is Intel.
#
# @return [Boolean]
#
def intel?(node)
%w(i86pc i386 x86_64 amd64 i686)
.include?(node['kernel']['machine'])
end
#
# Determine if the current architecture is SPARC.
#
# @return [Boolean]
#
def sparc?(node)
%w(sun4u sun4v)
.include?(node['kernel']['machine'])
end
#
# Determine if the current architecture is Powerpc64 Big Endian
#
# @return [Boolean]
#
def ppc64?(node)
%w(ppc64)
.include?(node['kernel']['machine'])
end
#
# Determine if the current architecture is Powerpc64 Little Endian
#
# @return [Boolean]
#
def ppc64le?(node)
%w(ppc64le)
.include?(node['kernel']['machine'])
end
#
# Determine if the current architecture is PowerPC
#
# @return [Boolean]
#
def powerpc?(node)
%w(powerpc)
.include?(node['kernel']['machine'])
end
#
# Determine if the current architecture is ARM with Hard Float
#
# @return [Boolean]
#
def armhf?(node)
# Add more arm variants as needed here
%w(armv6l armv7l)
.include?(node['kernel']['machine'])
end
#
# Determine if the current architecture is AArch64
#
# @return [Boolean]
#
def aarch64?(node)
# Add more arm variants as needed here
%w(aarch64)
.include?(node['kernel']['machine'])
end
#
# Determine if the current architecture is s390x
#
# @return [Boolean]
#
def s390x?(node)
%w(s390x)
.include?(node['kernel']['machine'])
end
end
end
module DSL
if !defined?(Chef::VERSION) || Gem::Requirement.new("< 15.4.70").satisfied_by?(Gem::Version.new(Chef::VERSION))
# @see Chef::Sugar::Architecture#_64_bit?
def _64_bit?; Chef::Sugar::Architecture._64_bit?(node); end
# @see Chef::Sugar::Architecture#_32_bit?
def _32_bit?; Chef::Sugar::Architecture._32_bit?(node); end
# @see Chef::Sugar::Architecture#intel?
def i386?; Chef::Sugar::Architecture.i386?(node); end
# @see Chef::Sugar::Architecture#intel?
def intel?; Chef::Sugar::Architecture.intel?(node); end
# @see Chef::Sugar::Architecture#sparc?
def sparc?; Chef::Sugar::Architecture.sparc?(node); end
# @see Chef::Sugar::Architecture#ppc64?
def ppc64?; Chef::Sugar::Architecture.ppc64?(node); end
# @see Chef::Sugar::Architecture#ppc64le?
def ppc64le?; Chef::Sugar::Architecture.ppc64le?(node); end
# @see Chef::Sugar::Architecture#powerpc?
def powerpc?; Chef::Sugar::Architecture.powerpc?(node); end
# @see Chef::Sugar::Architecture#arm?
def armhf?; Chef::Sugar::Architecture.armhf?(node); end
# @see Chef::Sugar::Architecture#aarch64?
def aarch64?; Chef::Sugar::Architecture.aarch64?(node); end
# @see Chef::Sugar::Architecture#s390x?
def s390x?; Chef::Sugar::Architecture.s390x?(node); end
end
end
end
end

View File

@@ -1,192 +0,0 @@
#
# Copyright 2013-2015, Seth Vargo <sethvargo@gmail.com>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
class Chef
module Sugar
module Cloud
extend self
#
# Return true if the current current node is in "the cloud".
#
# @param [Chef::Node] node
# the node to check
#
# @return [Boolean]
#
def cloud?(node)
node.key?('cloud')
end
#
# Return true if the current current node is in EC2
#
# @param [Chef::Node] node
# the node to check
#
# @return [Boolean]
#
def ec2?(node)
node.key?('ec2')
end
#
# Return true if the current current node is in GCE
#
# @param [Chef::Node] node
# the node to check
#
# @return [Boolean]
#
def gce?(node)
node.key?('gce')
end
#
# Return true if the current current node is in Rackspace
#
# @param [Chef::Node] node
# the node to check
#
# @return [Boolean]
#
def rackspace?(node)
node.key?('rackspace')
end
#
# Return true if the current current node is in Eucalyptus
#
# @param [Chef::Node] node
# the node to check
#
# @return [Boolean]
#
def eucalyptus?(node)
node.key?('eucalyptus')
end
alias_method :euca?, :eucalyptus?
#
# Return true if the current current node is in Linode
#
# @param [Chef::Node] node
# the node to check
#
# @return [Boolean]
#
def linode?(node)
node.key?('linode')
end
#
# Return true if the current current node is in Openstack
#
# @param [Chef::Node] node
# the node to check
#
# @return [Boolean]
#
def openstack?(node)
node.key?('openstack')
end
#
# Return true if the current current node is in Cloudstack
#
# @param [Chef::Node] node
# the node to check
#
# @return [Boolean]
#
def cloudstack?(node)
node.key?('cloudstack')
end
#
# Return true if the current current node is in Azure
#
# @param [Chef::Node] node
# the node to check
#
# @return [Boolean]
#
def azure?(node)
node.key?('azure')
end
#
# Return true if the current current node is in DigitalOcean
#
# @param [Chef::Node] node
# the node to check
#
# @return [Boolean]
#
def digitalocean?(node)
node.key?('digital_ocean')
end
#
# Return true if the current current node is in SoftLayer
#
# @param [Chef::Node] node
# the node to check
#
# @return [Boolean]
#
def softlayer?(node)
node.key?('softlayer')
end
end
module DSL
# @see Chef::Sugar::Cloud#cloud?
def cloud?; Chef::Sugar::Cloud.cloud?(node); end
# @see Chef::Sugar::Cloud#ec2?
def ec2?; Chef::Sugar::Cloud.ec2?(node); end
# @see Chef::Sugar::Cloud#gce?
def gce?; Chef::Sugar::Cloud.gce?(node); end
# @see Chef::Sugar::Cloud#rackspace?
def rackspace?; Chef::Sugar::Cloud.rackspace?(node); end
# @see Chef::Sugar::Cloud#eucalyptus?
def eucalyptus?; Chef::Sugar::Cloud.eucalyptus?(node); end
alias_method :euca?, :eucalyptus?
# @see Chef::Sugar::Cloud#linode?
def linode?; Chef::Sugar::Cloud.linode?(node); end
# @see Chef::Sugar::Cloud#openstack?
def openstack?; Chef::Sugar::Cloud.openstack?(node); end
# @see Chef::Sugar::Cloud#cloudstack?
def cloudstack?; Chef::Sugar::Cloud.cloudstack?(node); end
# @see Chef::Sugar::Cloud#azure?
def azure?; Chef::Sugar::Cloud.azure?(node); end
# @see Chef::Sugar::Cloud#digitalocean?
def digitalocean?; Chef::Sugar::Cloud.digitalocean?(node); end
# @see Chef::Sugar::Cloud#softlayer?
def softlayer?; Chef::Sugar::Cloud.softlayer?(node); end
end
end
end

View File

@@ -1,108 +0,0 @@
#
# Copyright 2013-2015, Seth Vargo <sethvargo@gmail.com>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
class Chef
module Sugar
module Constraints
#
# This class is a wrapper around a version requirement that adds a nice
# DSL for comparing constraints:
#
# @example Comparing a single constraint
# Constraint.new('~> 1.2.3').satisfied_by?('1.2.7')
#
# @example Comparing multiple constraints
# Constraint.new('> 1.2.3', '< 2.0.0').satisfied_by?('1.2.7')
#
class Constraint
#
# Create a new constraint object.
#
# @param [String, Array<String>] constraints
# the list of constraints
#
def initialize(*constraints)
@requirement = Gem::Requirement.new(*constraints)
end
#
# Determine if the given version string is satisfied by this constraint
# or group of constraints.
#
# @example Given a satisified constraint
# Constraint.new('~> 1.2.0').satisfied_by?('1.2.5') #=> true
#
# @example Given an unsatisfied constraint
# Constraint.new('~> 1.2.0').satisfied_by?('2.0.0') #=> false
#
#
# @param [String] version
# the version to compare
#
# @return [Boolean]
# true if the constraint is satisfied, false otherwise
#
def satisfied_by?(version)
@requirement.satisfied_by?(Gem::Version.new(version))
end
end
#
# This class exposes a single version constraint object that wraps the
# string representation of a version string and proved helpful comparator
# methods.
#
# @example Create a new version
# Chef::Sugar::Version('1.2.3')
#
# @example Compare a version with constraints
# Chef::Sugar::Version('1.2.3').satisfies?('~> 1.3.4', '< 2.0.5')
#
class Version < String
#
# Create a new version object.
#
# @param [String] version
# the version to create
#
def initialize(version)
super
@version = Gem::Version.new(version)
end
#
# Determine if the given constraint is satisfied by this version.
#
# @example Given a satisified version
# Version.new('1.2.5').satisfies?('~> 1.2.0') #=> true
#
# @example Given an unsatisfied version
# Version.new('2.0.0').satisfies?('~> 1.2.0') #=> false
#
#
# @param [String, Array<String>] constraints
# the constraints to satisfy
#
# @return [Boolean]
# true if the version satisfies the constraints, false otherwise
#
def satisfies?(*constraints)
Gem::Requirement.new(*constraints).satisfied_by?(@version)
end
end
end
end
end

View File

@@ -1,83 +0,0 @@
#
# Copyright 2013-2015, Seth Vargo <sethvargo@gmail.com>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
require_relative 'constraints'
class Chef
module Sugar
#
# The Constraints DSL methods were broken out into this separate
# file to allow projects (such as Omnibus) to consume the
# Chef::Sugar::Constraints classes without the DSL methods
# stepping on existing methods of the same name.
#
module Constraints
extend self
#
# Shortcut method for creating a new {Version} object.
#
# @param [String] version
# the version (as a string) to create
#
# @return [Chef::Sugar::Constraints::Version]
# the new version object
#
def version(version)
Chef::Sugar::Constraints::Version.new(version)
end
#
# Shortcut method for creating a new {Constraint} object.
#
# @param [String, Array<String>] constraints
# the list of constraints to use
#
# @return [Chef::Sugar::Constraints::Constraint]
# the new constraint object
#
def constraint(*constraints)
Chef::Sugar::Constraints::Constraint.new(*constraints)
end
end
module DSL
# @see Chef::Sugar::Constraints#version
def version(version)
Chef::Sugar::Constraints::Version.new(version)
end
# @see Chef::Sugar::Constraints#constraint
def constraint(*constraints)
Chef::Sugar::Constraints.constraint(*constraints)
end
#
# This wrapper/convenience method is only available in the recipe DSL. It
# creates a new version object from the {Chef::VERSION}.
#
# @example Check if Chef 11+
# chef_version.satisfies?('>= 11.0.0')
#
# @return [Chef::Sugar::Constraints::Version]
# a version object, wrapping the current {Chef::VERSION}
#
def chef_version
version(Chef::VERSION)
end
end
end
end

View File

@@ -1,19 +0,0 @@
#
# Copyright 2013-2015, Seth Vargo <sethvargo@gmail.com>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
require_relative 'core_extensions/array'
require_relative 'core_extensions/string'
require_relative 'core_extensions/object'

View File

@@ -1,34 +0,0 @@
#
# Copyright 2013-2015, Seth Vargo <sethvargo@gmail.com>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
require_relative '../constraints'
class Array
#
# Treat an array of objects as version constraints.
#
# @see Chef::Sugar::Constraints::Constraint
#
# @example Using pure Array<String> objects like constraints
# ['> 2.0.0', '< 3.0.0'].satisfied_by?('2.1.0')
#
# @param [String] version
# the version to check if it is satisfied
#
def satisfied_by?(version)
Chef::Sugar::Constraints::Constraint.new(*dup).satisfied_by?(version)
end unless method_defined?(:satisfied_by?)
end

View File

@@ -1,27 +0,0 @@
#
# Copyright 2013-2015, Seth Vargo <sethvargo@gmail.com>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
class Object
# An object is blank if it's false, empty, or a whitespace string.
# This is implemented in rails.
#
# @example foo.nil? || foo.empty? can be replaced by foo.blank?
#
# @return [true, false]
def blank?
respond_to?(:empty?) ? empty? : !self
end unless method_defined?(:blank?)
end

View File

@@ -1,66 +0,0 @@
#
# Copyright 2013-2015, Seth Vargo <sethvargo@gmail.com>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# require_relative '../constraints'
class String
#
# Treat strings as version objects.
#
# @see Chef::Sugar::Constraints::Version
#
# @example Using pure string objects like versions
# '1.2.3'.satisfies?('~> 1.2.0')
#
# @param [String, Array<String>] constraints
# the list of constraints to satisfy
#
def satisfies?(*constraints)
Chef::Sugar::Constraints::Version.new(dup).satisfies?(*constraints)
end unless method_defined?(:satisfies?)
#
# Treat strings as version constraints.
#
# @see Chef::Sugar::Constraints::Constraint
#
# @example Using pure string objects like constraints
# '~> 1.2.0'.satisfied_by?('1.2.3')
#
# @param [String] version
# the version to check if it is satisfied
#
def satisfied_by?(version)
Chef::Sugar::Constraints::Constraint.new(dup).satisfied_by?(version)
end unless method_defined?(:satisfied_by?)
#
# Left-flush a string based off of the number of whitespace characters on the
# first line. This is especially useful for heredocs when whitespace matters.
#
# @example Remove leading whitespace and flush
# <<-EOH.flush
# def method
# 'This is a string!'
# end
# EOH #=>"def method\n 'This is a string!'\nend"
#
# @return [String]
#
def flush
gsub(/^#{self[/\A\s*/]}/, '').chomp
end unless method_defined?(:flush)
end

View File

@@ -1,146 +0,0 @@
#
# Copyright 2013-2015, Seth Vargo <sethvargo@gmail.com>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
class Chef
module Sugar
module DataBag
class EncryptedDataBagSecretNotGiven < StandardError
def initialize
super <<-EOH
You did not set your `encrypted_data_bag_secret'! In order to use the
`encrypted_data_bag_item' helper, you must load your encrypted data bag secret
into the `Chef::Config'.
Alternatively, you can pass the secret key as the last parameter to the method
call. For more information, please see
http://docs.opscode.com/chef/essentials_data_bags.html#access-from-recipe.
EOH
end
end
extend self
#
# Helper method for loading an encrypted data bag item in a similar
# syntax/recipe DSL method.
#
# @param [String] bag
# the name of the encrypted data bag
# @param [String] id
# the id of the encrypted data bag
# @param [String] secret
# the encrypted data bag secret raw value
#
# @return [Hash]
#
def encrypted_data_bag_item(bag, id, secret = nil)
Chef::Log.debug "Loading encrypted data bag item #{bag}/#{id}"
if secret.nil? && Chef::Config[:encrypted_data_bag_secret].nil?
raise EncryptedDataBagSecretNotGiven.new
end
secret ||= File.read(Chef::Config[:encrypted_data_bag_secret]).strip
Chef::EncryptedDataBagItem.load(bag, id, secret)
end
#
# This algorithm attempts to find the data bag entry for the current
# node's Chef environment. If there are no environment-specific
# values, the "default" bucket is used. The data bag must follow the
# schema:
#
# {
# "default": {...},
# "environment_name": {...},
# "other_environment": {...},
# }
#
# @param [Node] node
# the current Chef node
# @param [String] bag
# the name of the encrypted data bag
# @param [String] id
# the id of the encrypted data bag
# @param [String] secret
# the encrypted data bag secret (default's to the +Chef::Config+ value)
#
# @return [Hash]
#
def encrypted_data_bag_item_for_environment(node, bag, id, secret = nil)
data = encrypted_data_bag_item(bag, id, secret)
if data[node.chef_environment]
Chef::Log.debug "Using #{node.chef_environment} as the key"
data[node.chef_environment]
else
Chef::Log.debug "#{node.chef_environment} key does not exist, using `default`"
data['default']
end
end
#
# This algorithm attempts to find the data bag entry for the current
# node's Chef environment. If there are no environment-specific
# values, the "default" bucket is used. The data bag must follow the
# schema:
#
# {
# "default": {...},
# "environment_name": {...},
# "other_environment": {...},
# }
#
# @param [Node] node
# the current Chef node
# @param [String] bag
# the name of the data bag
# @param [String] id
# the id of the data bag
#
# @return [Hash]
#
def data_bag_item_for_environment(node, bag, id)
data = Chef::DataBagItem.load(bag, id)
if data[node.chef_environment]
Chef::Log.debug "Using #{node.chef_environment} as the key"
data[node.chef_environment]
else
Chef::Log.debug "#{node.chef_environment} key does not exist, using `default`"
data['default']
end
end
end
module DSL
# @see Chef::Sugar::DataBag#encrypted_data_bag_item
def encrypted_data_bag_item(bag, id, secret = nil)
Chef::Sugar::DataBag.encrypted_data_bag_item(bag, id, secret)
end
# @see Chef::Sugar::DataBag#encrypted_data_bag_item_for_environment
def encrypted_data_bag_item_for_environment(bag, id, secret = nil)
Chef::Sugar::DataBag.encrypted_data_bag_item_for_environment(node, bag, id, secret)
end
# @see Chef::Sugar::DataBag#data_bag_item_for_environment
def data_bag_item_for_environment(bag, id)
Chef::Sugar::DataBag.data_bag_item_for_environment(node, bag, id)
end
end
end
end

View File

@@ -1,45 +0,0 @@
#
# Copyright 2013-2015, Seth Vargo <sethvargo@gmail.com>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
class Chef
module Sugar
module Docker
extend self
# these helpers have been moved to core chef
if !defined?(Chef::VERSION) || Gem::Requirement.new("< 15.4.70").satisfied_by?(Gem::Version.new(Chef::VERSION))
#
# Returns true if the current node is a docker container.
#
# @param [Chef::Node] node
# the node to check
#
# @return [Boolean]
#
def docker?(node)
File.exist?('/.dockerinit') || File.exist?('/.dockerenv')
end
end
end
module DSL
if !defined?(Chef::VERSION) || Gem::Requirement.new("< 15.4.70").satisfied_by?(Gem::Version.new(Chef::VERSION))
# @see Chef::Sugar::Docker#docker?
def docker?; Chef::Sugar::Docker.docker?(node); end
end
end
end
end

View File

@@ -1,227 +0,0 @@
class Chef
module Sugar
module Filters
#
# Evaluate resources at compile time instead of converge time.
#
class AtCompileTime
def initialize(recipe)
@recipe = recipe
end
def evaluate(&block)
instance_eval(&block)
end
def method_missing(m, *args, &block)
resource = @recipe.send(m, *args, &block)
if resource.is_a?(Chef::Resource)
actions = Array(resource.action)
resource.action(:nothing)
actions.each do |action|
resource.run_action(action)
end
end
resource
end
end
#
# A top-level class for manipulation the resource collection.
#
class Injector
def initialize(recipe, identifier, placement)
@recipe = recipe
@resource_collection = @recipe.run_context.resource_collection
@resource = @resource_collection.lookup(identifier)
@placement = placement
end
def evaluate(&block)
instance_eval(&block)
end
def insert_before(resource, new_resource)
@resource_collection.instance_eval do
# Remove the resource because it's automatically created
@resources.delete_at(@resources_by_name[new_resource.to_s])
@resources_by_name.delete(new_resource.to_s)
index = @resources_by_name[resource.to_s]
@resources.insert(index, new_resource)
@resources_by_name[new_resource.to_s] = index
end
end
def insert_after(resource, new_resource)
@resource_collection.instance_eval do
# Remove the resource because it's automatically created
@resources.delete_at(@resources_by_name[new_resource.to_s])
@resources_by_name.delete(new_resource.to_s)
index = @resources_by_name[resource.to_s] + 2
@resources.insert(index, new_resource)
@resources_by_name[new_resource.to_s] = index
end
end
def method_missing(m, *args, &block)
new_resource = @recipe.send(m, *args, &block)
case @placement
when :before
insert_before(@resource, new_resource)
when :after
insert_after(@resource, new_resource)
else
super
end
end
end
end
module DSL
#
# Dynamically run resources specified in the block during the compilation
# phase, instead of the convergence phase.
#
# @example The old way
# package('apache2') do
# action :nothing
# end.run_action(:install)
#
# @example The new way
# at_compile_time do
# package('apache2')
# end
#
# @example Resource actions are run in order
# at_compile_time do
# service 'apache2' do
# action [:enable, :start] # run_action(:enable), run_action(:start)
# end
# end
#
def at_compile_time(&block)
Chef::Sugar::Filters::AtCompileTime.new(self).evaluate(&block)
end
#
# Dynamically insert resources before an existing resource in the
# resource_collection.
#
# @example Write a custom template before the apache2 service actions
# are run
# before 'service[apache2]' do
# template '/etc/apache2/thing.conf' do
# source '...'
# end
# end
#
#
# @param [String] identifier
# the +resource[name]+ identifier string
#
def before(identifier, &block)
Chef::Sugar::Filters::Injector.new(self, identifier, :before).evaluate(&block)
end
#
# Dynamically insert resources after an existing resource in the
# resource_collection.
#
# @example Write a custom template after the apache2 service actions
# are run
# after 'service[apache2]' do
# template '/etc/apache2/thing.conf' do
# source '...'
# end
# end
#
#
# @param [String] identifier
# the +resource[name]+ identifier string
#
def after(identifier, &block)
Chef::Sugar::Filters::Injector.new(self, identifier, :after).evaluate(&block)
end
end
module RecipeDSL
#
# @deprecated The description is in the method body pretty accurately...
#
def compile_time(&block)
message = <<-EOH
The Chef Sugar recipe DSL method `compile_time' has been renamed to
`at_compile_time'! This is a breaking change that was released in a patch
version, so please continue reading to understand the necessary semantic
versioning violation.
Chef Software implemented a version of `compile_time' in Chef 12.1, breaking any
cookbook that uses or depends on Chef Sugar on Chef 12.1:
https://www.chef.io/blog/2015/03/03/chef-12-1-0-released
In order to progress Chef Sugar forward, the DSL method has been renamed to
avoid the namespace collision.
In short, you should change this:
compile_time do
# ...
end
to this:
at_compile_time do
# ...
end
EOH
if Chef::Resource::ChefGem.instance_methods(false).include?(:compile_time)
message << <<-EOH
You are running a version of Chef Client that includes the `compile_time'
attribute on core Chef resources (most likely Chef 12.1+). Instead of continuing
and having Chef provide you with an obscure error message, I am going to error
here. There is no way for the Chef Recipe to successfully continue unless you
change the Chef Sugar `compile_time' method to `at_compile_time' in your Chef
recipes.
You should NOT change resource-level `compile_time' attributes:
package "foo" do
compile_time true # Do NOT change these
end
I truly apologize for the inconvienence and hope the reason for introducing this
breaking change is clear. I am sorry if it causes extra work, but I promise this
error message is much more informative than "wrong number of arguments".
If you have any questions, please feel free to open an issue on GitHub at:
https://github.com/sethvargo/chef-sugar
Thank you, and have a great day!
EOH
raise RuntimeError, message
else
message << <<-EOH
You are running a version of Chef Client that does not include the
`compile_time' attribute on core Chef resources (most likely less than
Chef 12.1), so this is just a warning. Please consider changing the Chef Sugar
`compile_time' method to `at_compile_time' in your Chef recipes. If you upgrade
Chef, your recipes WILL break.
EOH
Chef::Log.warn(message)
at_compile_time(&block)
end
end
end
end
end

View File

@@ -1,61 +0,0 @@
#
# Copyright 2015, Nathan Williams <nath.e.will@gmail.com>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
class Chef
module Sugar
module Init
extend self
#
# Determine if the current init system is systemd.
#
# @return [Boolean]
#
def systemd?(node)
File.exist?('/bin/systemctl')
end
#
# Determine if the current init system is upstart.
#
# @return [Boolean]
#
def upstart?(node)
File.executable?('/sbin/initctl')
end
#
# Determine if the current init system is runit.
#
# @return [Boolean]
#
def runit?(node)
File.executable?('/sbin/runit-init')
end
end
module DSL
# @see Chef::Sugar::Init#systemd?
def systemd?; Chef::Sugar::Init.systemd?(node); end
# @see Chef::Sugar::Init#upstart?
def upstart?; Chef::Sugar::Init.upstart?(node); end
# @see Chef::Sugar::Init#runit?
def runit?; Chef::Sugar::Init.runit?(node); end
end
end
end

View File

@@ -1,48 +0,0 @@
#
# Copyright 2013-2015, Seth Vargo <sethvargo@gmail.com>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
class Chef
module Sugar
module IP
extend self
#
# The best IP address for the given node, in the context of
# the current node. Useful for choosing a local IP address
# over a public one to limit bandwidth on cloud providers.
#
# @param [Chef::Node] other
# the node to calculate the best IP address for
#
def best_ip_for(node, other)
if other['cloud']
if node['cloud'] && other['cloud']['provider'] == node['cloud']['provider']
other['cloud']['local_ipv4']
else
other['cloud']['public_ipv4']
end
else
other['ipaddress']
end
end
end
module DSL
# @see Chef::Sugar::IP#best_ip_for
def best_ip_for(other); Chef::Sugar::IP.best_ip_for(node, other); end
end
end
end

View File

@@ -1,49 +0,0 @@
#
# Copyright 2013-2015, Seth Vargo <sethvargo@gmail.com>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
class Chef
module Sugar
module Kernel
class ChefGemLoadError < StandardError
def initialize(name)
super <<-EOH
Chef could not load the gem `#{name}'! You may need to install the gem manually
with `gem install #{name}', or include a recipe before you can use this
resource. Please consult the documentation for this cookbook for proper usage.
EOH
end
end
#
# Require a gem that should have been installed by Chef, such as in a
# recipes as a +chef_gem+. This method will gracefully degrade if the
# gem cannot be loaded.
#
# @param [String] name
# the name of the gem to install
#
# @return [Boolean]
# true if the require is successful and false if the gem is already
# loaded
#
def require_chef_gem(name)
require(name)
rescue LoadError
raise ChefGemLoadError.new(name)
end
end
end
end

View File

@@ -1,45 +0,0 @@
#
# Copyright 2013-2015, Seth Vargo <sethvargo@gmail.com>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
class Chef
module Sugar
module Kitchen
extend self
# these helpers have been moved to core-chef
if !defined?(Chef::VERSION) || Gem::Requirement.new("< 15.4.70").satisfied_by?(Gem::Version.new(Chef::VERSION))
#
# Returns true if the current node is provisioned by Test Kitchen.
#
# @param [Chef::Node] node
# the node to check
#
# @return [Boolean]
#
def kitchen?(node)
!ENV['TEST_KITCHEN'].nil?
end
end
end
module DSL
if !defined?(Chef::VERSION) || Gem::Requirement.new("< 15.4.70").satisfied_by?(Gem::Version.new(Chef::VERSION))
# @see Chef::Sugar::Kitchen#kitchen?
def kitchen?; Chef::Sugar::Kitchen.kitchen?(node); end
end
end
end
end

View File

@@ -1,219 +0,0 @@
#
# Copyright 2013-2015, Seth Vargo <sethvargo@gmail.com>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
require_relative "deprecation"
class Chef
class Node
class AttributeDoesNotExistError < StandardError
def initialize(keys, key)
hash = keys.map { |key| "['#{key}']" }
super <<-EOH
No attribute `node#{hash.join}' exists on
the current node. Specifically the `#{key}' attribute is not
defined. Please make sure you have spelled everything correctly.
EOH
end
end
#
# Determine if the current node is in the given Chef environment
# (or matches the given regular expression).
#
# @param [String, Regex] environment
#
# @return [Boolean]
#
def in?(environment)
Chef::Sugar::Deprecation.deprecated "the chef-sugar node.in? method is deprecated"
environment === chef_environment
end
#
# Safely fetch a deeply nested attribute by specifying a list of keys,
# bypassing Ruby's Hash notation. This method swallows +NoMethodError+
# exceptions, avoiding the most common error in Chef-land.
#
# This method will return +nil+ if any deeply nested key does not exist.
#
# @see [Node#deep_fetch!]
#
def deep_fetch(*keys)
Chef::Sugar::Deprecation.deprecated "the chef-sugar deep_fetch method is deprecated and should be replaced by node.read"
deep_fetch!(*keys)
rescue NoMethodError, AttributeDoesNotExistError
nil
end
#
# Deeply fetch a node attribute by specifying a list of keys, bypassing
# Ruby's Hash notation.
#
# This method will raise any exceptions, such as
# +undefined method `[]' for nil:NilClass+, just as if you used the native
# attribute notation. If you want a safely vivified hash, see {deep_fetch}.
#
# @example Fetch a deeply nested key
# node.deep_fetch(:foo, :bar, :zip) #=> node['foo']['bar']['zip']
#
# @param [Array<String, Symbol>] keys
# the list of keys to kdeep fetch
#
# @return [Object]
#
def deep_fetch!(*keys)
Chef::Sugar::Deprecation.deprecated "the chef-sugar deep_fetch method is deprecated and should be replaced by node.read!"
keys.map!(&:to_s)
keys.inject(attributes.to_hash) do |hash, key|
if hash.key?(key)
hash[key]
else
raise AttributeDoesNotExistError.new(keys, key)
end
end
end
#
# Dynamically define the current namespace. Multiple namespaces may be
# nested.
#
# @example Define a simple namespace
#
# namespace 'apache2' do
# # ...
# end
#
# @example Define a nested namespace
#
# namespace 'apache2', 'config' do
# # ...
# end
#
# @example Define a complex nested namespace
#
# namespace 'apache2' do
# namespace 'config' do
# # ...
# end
# end
#
# @example Define a namespace with a custom precedence level
#
# namespace 'apache2', precedence: normal do
# # Attributes here will use the "normal" level
# end
#
# @example Define different nested precedence levels
#
# namespace 'apache2', precedence: normal do
# # Attributes defined here will use the "normal" level
#
# namespace 'config', precedence: override do
# # Attributes defined here will use the "override" level
# end
# end
#
#
# @param [Array] args
# the list of arguments (such as the namespace and precedence levels)
# the user gave
# @param [Proc] block
# the nested evaluation context
#
# @return [nil]
# to prevent accidential method chaining if the block isn't closed
#
def namespace(*args, &block)
Chef::Sugar::Deprecation.deprecated "the chef-sugar attribute namespace setting is deprecated, please use traditional chef attribute notation"
@namespace_options = namespace_options.merge(args.last.is_a?(Hash) ? args.pop : {})
keys = args.map(&:to_s)
@current_namespace = current_namespace + keys
instance_eval(&block)
@current_namespace = current_namespace - keys
if @current_namespace.empty?
@namespace_options = nil
end
nil
end
alias_method :old_method_missing, :method_missing
#
# Provide a nice DSL for defining attributes. +method_missing+ is called
# on all the attribute names. For more information on how to use the DSL,
# see the class-level documentation.
#
# @return [nil]
# to prevent accidential method chaining if the block isn't closed
# @return [Object]
# If no argument is passed in, method becomes an attribute accessor
#
def method_missing(m, *args, &block)
old_method_missing(m, *args, &block)
rescue NoMethodError
# The Node Attribute's key is the method name
key = m.to_s
# If arguments are passed in, set node attribute with args as the value
if args.size > 0
vivified[key] = args.size == 1 ? args.first : args
return nil
# If no arguments are passed in, attempt to access corresponding attribute
else
deep_key = current_namespace.dup << key
return deep_fetch!(*deep_key)
end
end
private
#
# The namespace options.
#
# @return [Hash]
#
def namespace_options
@namespace_options ||= {
precedence: default
}
end
#
# The current namespace. This is actually a reverse-ordered array that
# vivifies the correct hash.#
#
# @return [Array<String>]
#
def current_namespace
@current_namespace ||= []
end
#
# The vivified (fake-filled) hash. It is assumed that the default value
# for non-existent keys in the hash is a new, empty hash.
#
# @return [Hash<String, Hash>]
#
def vivified
current_namespace.inject(namespace_options[:precedence]) do |hash, item|
hash[item] ||= {}
hash[item]
end
end
end
end

View File

@@ -1,331 +0,0 @@
#
# Copyright 2013-2015, Seth Vargo <sethvargo@gmail.com>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
require_relative 'constraints'
class Chef
module Sugar
module Platform
extend self
PLATFORM_VERSIONS = {
'debian' => {
'squeeze' => '6',
'wheezy' => '7',
'jessie' => '8',
'stretch' => '9',
'buster' => '10',
},
'linuxmint' => {
'tara' => '19',
'sarah' => '18',
'qiana' => '17',
'petra' => '16',
'olivia' => '15',
'nadia' => '14',
'maya' => '13',
'lisa' => '12',
},
'mac_os_x' => {
'lion' => '10.7',
'mountain_lion' => '10.8',
'mavericks' => '10.9',
'yosemite' => '10.10',
'el_capitan' => '10.11',
'sierra' => '10.12',
'high_sierra' => '10.13',
'mojave' => '10.14',
},
'redhat' => {
'santiago' => '6',
'6' => '6',
'maipo' => '7',
'7' => '7',
'oompa' => '8',
'8' => '8'
},
'centos' => {
'final' => '6',
'6' => '6',
'core' => '7',
'7' => '7'
},
'solaris' => {
'7' => '5.7',
'8' => '5.8',
'9' => '5.9',
'10' => '5.10',
'11' => '5.11',
},
'ubuntu' => {
'lucid' => '10.04',
'maverick' => '10.10',
'natty' => '11.04',
'oneiric' => '11.10',
'precise' => '12.04',
'quantal' => '12.10',
'raring' => '13.04',
'saucy' => '13.10',
'trusty' => '14.04',
'utopic' => '14.10',
'vivid' => '15.04',
'wily' => '15.10',
'xenial' => '16.04',
'zesty' => '17.04',
'artful' => '17.10',
'bionic' => '18.04',
'cosmic' => '18.10',
},
}
COMPARISON_OPERATORS = {
'after' => ->(a, b) { a > b },
'after_or_at' => ->(a, b) { a >= b },
'' => ->(a, b) { a == b },
'before' => ->(a, b) { a < b },
'before_or_at' => ->(a, b) { a <= b },
}
# Dynamically define custom matchers at runtime in a matrix. For each
# Platform, we create a map of named versions to their numerical
# equivalents (e.g. debian_before_squeeze?).
PLATFORM_VERSIONS.each do |platform, versions|
versions.each do |name, version|
COMPARISON_OPERATORS.each do |operator, block|
method_name = "#{platform}_#{operator}_#{name}?".squeeze('_').to_sym
define_method(method_name) do |node|
# Find the highest precedence that we actually care about based
# off of what was given to us in the list.
length = version.split('.').size
check = node['platform_version'].split('.')[0...length].join('.')
# Calling #to_f will ensure we only check major versions since
# '10.04.4'.to_f #=> 10.04. We also use a regex to match on
# platform so things like `solaris2` match on `solaris`.
node['platform'] =~ %r(^#{platform}) && block.call(check.to_f, version.to_f)
end
end
end
end
# these helpers have been moved to core chef
if !defined?(Chef::VERSION) || Gem::Requirement.new("< 15.4.70").satisfied_by?(Gem::Version.new(Chef::VERSION))
#
# Determine if the current node is linux mint.
#
# @param [Chef::Node] node
#
# @return [Boolean]
#
def linux_mint?(node)
node['platform'] == 'linuxmint'
end
alias_method :mint?, :linux_mint?
#
# Determine if the current node is ubuntu.
#
# @param [Chef::Node] node
#
# @return [Boolean]
#
def ubuntu?(node)
node['platform'] == 'ubuntu'
end
#
# Determine if the current node is debian (platform, not platform_family).
#
# @param [Chef::Node] node
#
# @return [Boolean]
#
def debian_platform?(node)
node['platform'] == 'debian'
end
#
# Determine if the current node is amazon linux.
#
# @param [Chef::Node] node
#
# @return [Boolean]
#
def amazon_linux?(node)
node['platform'] == 'amazon'
end
alias_method :amazon?, :amazon_linux?
#
# Determine if the current node is centos.
#
# @param [Chef::Node] node
#
# @return [Boolean]
#
def centos?(node)
node['platform'] == 'centos'
end
#
# Determine if the current node is oracle linux.
#
# @param [Chef::Node] node
#
# @return [Boolean]
#
def oracle_linux?(node)
node['platform'] == 'oracle'
end
alias_method :oracle?, :oracle_linux?
#
# Determine if the current node is scientific linux.
#
# @param [Chef::Node] node
#
# @return [Boolean]
#
def scientific_linux?(node)
node['platform'] == 'scientific'
end
alias_method :scientific?, :scientific_linux?
#
# Determine if the current node is redhat enterprise.
#
# @param [Chef::Node] node
#
# @return [Boolean]
#
def redhat_enterprise_linux?(node)
node['platform'] == 'redhat'
end
alias_method :redhat_enterprise?, :redhat_enterprise_linux?
#
# Determine if the current node is fedora (platform, not platform_family).
#
# @param [Chef::Node] node
#
# @return [Boolean]
#
def fedora_platform?(node)
node['platform'] == 'fedora'
end
#
# Determine if the current node is solaris2
#
# @param [Chef::Node] node
#
# @return [Boolean]
#
def solaris2?(node)
node['platform'] == 'solaris2'
end
alias_method :solaris?, :solaris2?
#
# Determine if the current node is aix
#
# @param [Chef::Node] node
#
# @return [Boolean]
#
def aix?(node)
node['platform'] == 'aix'
end
#
# Determine if the current node is smartos
#
# @param [Chef::Node] node
#
# @return [Boolean]
#
def smartos?(node)
node['platform'] == 'smartos'
end
#
# Determine if the current node is omnios
#
# @param [Chef::Node] node
#
# @return [Boolean]
#
def omnios?(node)
node['platform'] == 'omnios'
end
#
# Determine if the current node is raspbian
#
# @param [Chef::Node] node
#
# @return [Boolean]
#
def raspbian?(node)
node['platform'] == 'raspbian'
end
#
# Determine if the current node is a Cisco nexus device
#
# @param [Chef::Node] node
#
# @return [Boolean]
#
def nexus?(node)
node['platform'] == 'nexus'
end
#
# Determine if the current node is a Cisco IOS-XR device
#
# @param [Chef::Node] node
#
# @return [Boolean]
#
def ios_xr?(node)
node['platform'] == 'ios_xr'
end
end
#
# Return the platform_version for the node. Acts like a String
# but also provides a mechanism for checking version constraints.
#
# @param [Chef::Node] node
#
# @return [Chef::Sugar::Constraints::Version]
#
def platform_version(node)
Chef::Sugar::Constraints::Version.new(node['platform_version'])
end
end
module DSL
Chef::Sugar::Platform.instance_methods.each do |name|
define_method(name) do
Chef::Sugar::Platform.send(name, node)
end
end
end
end
end

View File

@@ -1,184 +0,0 @@
#
# Copyright 2013-2015, Seth Vargo <sethvargo@gmail.com>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
class Chef
module Sugar
module PlatformFamily
extend self
# these helpers have been moved to core chef
if !defined?(Chef::VERSION) || Gem::Requirement.new("< 15.4.70").satisfied_by?(Gem::Version.new(Chef::VERSION))
#
# Determine if the current node is a member of the arch family.
#
# @param [Chef::Node] node
#
# @return [Boolean]
#
def arch_linux?(node)
node['platform_family'] == 'arch'
end
alias_method :arch?, :arch_linux?
#
# Determine if the current node is a member of the debian family.
#
# @param [Chef::Node] node
#
# @return [Boolean]
#
def debian?(node)
node['platform_family'] == 'debian'
end
#
# Determine if the current node is a member of the fedora family.
#
# @param [Chef::Node] node
#
# @return [Boolean]
#
def fedora?(node)
node['platform_family'] == 'fedora'
end
#
# Determine if the current node is a member of the freebsd family.
#
# @param [Chef::Node] node
#
# @return [Boolean]
#
def freebsd?(node)
node['platform_family'] == 'freebsd'
end
#
# Determine if the current node is a member of the arch family.
#
# @param [Chef::Node] node
#
# @return [Boolean]
#
def gentoo?(node)
node['platform_family'] == 'gentoo'
end
#
# Determine if the current node is a member of the OSX family.
#
# @param [Chef::Node] node
#
# @return [Boolean]
#
def mac_os_x?(node)
node['platform_family'] == 'mac_os_x'
end
alias_method :osx?, :mac_os_x?
alias_method :mac?, :mac_os_x?
#
# Determine if the current node is a member of the openbsd family.
#
# @param [Chef::Node] node
#
# @return [Boolean]
#
def openbsd?(node)
node['platform_family'] == 'openbsd'
end
#
# Determine if the current node is a member of the redhat family.
#
# @param [Chef::Node] node
#
# @return [Boolean]
#
def rhel?(node)
node['platform_family'] == 'rhel'
end
alias_method :redhat?, :rhel?
alias_method :el?, :rhel?
#
# Determine if the current node is a member of the slackware family.
#
# @param [Chef::Node] node
#
# @return [Boolean]
#
def slackware?(node)
node['platform_family'] == 'slackware'
end
#
# Determine if the current node is a member of the suse family.
#
# @param [Chef::Node] node
#
# @return [Boolean]
#
def suse?(node)
node['platform_family'] == 'suse'
end
#
# Determine if the current node is a member of the windows family.
#
# @param [Chef::Node] node
#
# @return [Boolean]
#
def windows?(node)
node['platform_family'] == 'windows'
end
#
# Determine if the current node is a member of the wrlinux family.
#
# @param [Chef::Node] node
#
# @return [Boolean]
#
def wrlinux?(node)
node['platform_family'] == 'wrlinux'
end
#
# Determine if the current system is a linux derivative
#
# @param [Chef::Node] node
#
# @return [Boolean]
#
def linux?(node)
node['os'] == 'linux'
end
end
end
module DSL
Chef::Sugar::PlatformFamily.instance_methods.each do |name|
define_method(name) do
Chef::Sugar::PlatformFamily.send(name, node)
end
end
end
end
end

View File

@@ -1,51 +0,0 @@
#
# Copyright 2013-2015, Seth Vargo <sethvargo@gmail.com>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
class Chef
module Sugar
module Ruby
extend self
#
# Determine if the current Ruby version is 2.0.
#
# @return [Boolean]
#
def ruby_20?(node)
version = Gem::Version.new(node['languages']['ruby']['version'])
Gem::Requirement.new('~> 2.0.0').satisfied_by?(version)
end
#
# Determine if the current Ruby version is 1.9.
#
# @return [Boolean]
#
def ruby_19?(node)
version = Gem::Version.new(node['languages']['ruby']['version'])
Gem::Requirement.new('~> 1.9.0').satisfied_by?(version)
end
end
module DSL
# @see Chef::Sugar::Ruby#ruby_20?
def ruby_20?; Chef::Sugar::Ruby.ruby_20?(node); end
# @see Chef::Sugar::Ruby#ruby_19?
def ruby_19?; Chef::Sugar::Ruby.ruby_19?(node); end
end
end
end

View File

@@ -1,41 +0,0 @@
#
# Copyright 2013-2015, Seth Vargo <sethvargo@gmail.com>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
class Chef
module Sugar
module RunContext
extend self
#
# Determine if the current node includes the given recipe name.
#
# @param [String] recipe_name
#
def includes_recipe?(node, recipe_name)
node.recipe?(recipe_name)
end
alias_method :include_recipe?, :includes_recipe?
end
module DSL
# @see Chef::Sugar::IP#best_ip_for
def includes_recipe?(recipe_name)
Chef::Sugar::RunContext.includes_recipe?(node, recipe_name)
end
alias_method :include_recipe?, :includes_recipe?
end
end
end

View File

@@ -1,157 +0,0 @@
#
# Copyright 2013-2015, Seth Vargo <sethvargo@gmail.com>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
require 'mixlib/shellout' unless defined?(Mixlib::ShellOut)
require 'pathname' unless defined?(Pathname)
class Chef
module Sugar
module Shell
extend self
# this helper has been moved to core chef
if !defined?(Chef::VERSION) || Gem::Requirement.new("< 16.0.257").satisfied_by?(Gem::Version.new(Chef::VERSION))
#
# Finds a command in $PATH
#
# @param [String] cmd
# the command to find
#
# @return [String, nil]
#
def which(cmd)
if Pathname.new(cmd).absolute?
File.executable?(cmd) ? cmd : nil
else
paths = ENV['PATH'].split(::File::PATH_SEPARATOR) + %w(/bin /usr/bin /sbin /usr/sbin)
paths.each do |path|
possible = File.join(path, cmd)
return possible if File.executable?(possible)
end
nil
end
end
end
#
# The platform-specific output path to +/dev/null+.
#
# @return [String]
#
def dev_null(node)
if defined?(ChefUtils)
ChefUtils.windows?(node) ? 'NUL' : '/dev/null'
else
Chef::Sugar::PlatformFamily.windows?(node) ? 'NUL' : '/dev/null'
end
end
#
# Boolean method to check if a command line utility is installed.
#
# @param [String] cmd
# the command to find
#
# @return [Boolean]
# true if the command is found in the path, false otherwise
#
def installed?(cmd)
!which(cmd).nil?
end
#
# Checks if the given binary is installed and exists at the given
# version. Also see {version_for}.
#
# @param [String] cmd
# the command to check
# @param [String] expected_version
# the version to check
# @param [String] flag
# the flag to use to check the version of the binary
#
# @return [Boolean]
# true if the command exists and is at the given version, false
# otherwise
#
def installed_at_version?(cmd, expected_version, flag = '--version')
return false if !installed?(cmd)
version = version_for(cmd, flag)
return false if version.nil?
if expected_version.is_a?(Regexp)
!version.match(expected_version).nil?
else
version.include?(expected_version)
end
end
#
# The version for a given command. This method does NOT check if the
# command exists! It is assumed the command existence has been
# checked with +which+ or similar. To simply check if an installed
# version is acceptable, please see {installed_at_version}.
#
# Assumptions:
# 1. The command exists.
# 2. The command outputs version information to +$stdout+ or +$stderr+.
# Did you know that java outputs its version to $stderr?
#
#
# @param [String] cmd
# the command to find the version for
# @param [String] flag
# the flag to use to get the version
#
# @return [String]
# the entire output of the version command (stderr and stdout)
#
def version_for(cmd, flag = '--version')
cmd = Mixlib::ShellOut.new("#{cmd} #{flag}")
cmd.run_command
cmd.error!
[cmd.stdout.strip, cmd.stderr.strip].join("\n")
end
end
module DSL
# this helper has been moved to core chef
if !defined?(Chef::VERSION) || Gem::Requirement.new("< 16.0.257").satisfied_by?(Gem::Version.new(Chef::VERSION))
# @see Chef::Sugar::Shell#which
def which(cmd); Chef::Sugar::Shell.which(cmd); end
end
# @see Chef::Sugar::Shell#dev_null
def dev_null; Chef::Sugar::Shell.dev_null(node); end
# @see Chef::Sugar::Shell#installed?
def installed?(cmd); Chef::Sugar::Shell.installed?(cmd); end
# @see Chef::Sugar::Shell#installed_at_version?
def installed_at_version?(cmd, version, flag = '--version')
Chef::Sugar::Shell.installed_at_version?(cmd, version, flag)
end
# @see Chef::Sugar::Shell#version_for
def version_for(cmd, flag = '--version')
Chef::Sugar::Shell.version_for(cmd, flag)
end
end
end
end

View File

@@ -1,77 +0,0 @@
#
# Copyright 2013-2015, Seth Vargo <sethvargo@gmail.com>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
class Chef
module Sugar
module Vagrant
extend self
#
# Determine if the current node is running in vagrant mode.
#
# @param [Chef::Node] node
#
# @return [Boolean]
# true if the machine is currently running vagrant, false
# otherwise
#
def vagrant?(node)
vagrant_key?(node) || vagrant_domain?(node) || vagrant_user?(node)
end
private
#
# Check if the +vagrant+ key exists on the +node+ object. This key is no
# longer populated by vagrant, but it is kept around for legacy purposes.
#
# @param (see vagrant?)
# @return (see vagrant?)
#
def vagrant_key?(node)
node.key?('vagrant')
end
#
# Check if "vagrantup.com" is included in the node's domain. Technically,
# this would make Chef Sugar falsely detect +vagrant?+ on any of
# Hashicorp's servers. But if that edge case becomes a serious problem,
# @mitchellh has my phone number.
#
# @param (see vagrant?)
# @return (see vagrant?)
#
def vagrant_domain?(node)
node.key?('domain') && !node['domain'].nil? && node['domain'].include?('vagrantup.com')
end
#
# Check if the system contains a +vagrant+ user.
#
# @param (see vagrant?)
# @return (see vagrant?)
#
def vagrant_user?(node)
node.key?('etc') && node['etc'].key?('passwd') && node['etc']['passwd'].key?('vagrant')
end
end
module DSL
# @see Chef::Sugar::Vagrant#vagrant?
def vagrant?; Chef::Sugar::Vagrant.vagrant?(node); end
end
end
end

View File

@@ -1,151 +0,0 @@
#
# Copyright 2014, Joseph J. Nuspl Jr. <nuspl@nvwls.com>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
class Chef
module Sugar
module Virtualization
extend self
#
# Determine if the current node is running under KVM.
#
# @param [Chef::Node] node
#
# @return [Boolean]
# true if the machine is currently running under KVM, false
# otherwise
#
def kvm?(node)
node.key?('virtualization') && node['virtualization']['system'] == 'kvm'
end
#
# Determine if the current node is running in a linux container.
#
# @param [Chef::Node] node
#
# @return [Boolean]
# true if the machine is currently running in a container, false
# otherwise
#
def lxc?(node)
node.key?('virtualization') && node['virtualization']['system'] == 'lxc'
end
#
# Determine if the current node is running under Parallels Desktop.
#
# @param [Chef::Node] node
#
# @return [Boolean]
# true if the machine is currently running under Parallels Desktop, false
# otherwise
#
def parallels?(node)
node.key?('virtualization') && node['virtualization']['system'] == 'parallels'
end
#
# Determine if the current node is running under VirtualBox.
#
# @param [Chef::Node] node
#
# @return [Boolean]
# true if the machine is currently running under VirtualBox, false
# otherwise
#
def virtualbox?(node)
node.key?('virtualization') && node['virtualization']['system'] == 'vbox'
end
#
# Determine if the current node is running under VMware.
#
# @param [Chef::Node] node
#
# @return [Boolean]
# true if the machine is currently running under VMware, false
# otherwise
#
def vmware?(node)
node.key?('virtualization') && node['virtualization']['system'] == 'vmware'
end
#
# Determine if the current node is running under openvz.
#
# @param [Chef::Node] node
#
# @return [Boolean]
# true if the machine is currently running under openvz, false
# otherwise
#
def openvz?(node)
node.key?('virtualization') && node['virtualization']['system'] == 'openvz'
end
def virtual?(node)
openvz?(node) || vmware?(node) || virtualbox?(node) || parallels?(node) || lxc?(node) || kvm?(node)
end
def physical?(node)
!virtual?(node)
end
end
module DSL
# @see Chef::Sugar::Virtualization#kvm?
def kvm?
Chef::Sugar::Virtualization.kvm?(node)
end
# @see Chef::Sugar::Virtualization#lxc?
def lxc?
Chef::Sugar::Virtualization.lxc?(node)
end
# @see Chef::Sugar::Virtualization#parallels?
def parallels?
Chef::Sugar::Virtualization.parallels?(node)
end
# @see Chef::Sugar::Virtualization#virtualbox?
def virtualbox?
Chef::Sugar::Virtualization.virtualbox?(node)
end
# @see Chef::Sugar::Virtualization#vmware?
def vmware?
Chef::Sugar::Virtualization.vmware?(node)
end
# @see Chef::Sugar::Virtualization#openvz?
def openvz?
Chef::Sugar::Virtualization.openvz?(node)
end
# @see Chef::Sugar::Virtualization#virtual?
def virtual?
Chef::Sugar::Virtualization.virtual?(node)
end
# @see Chef::Sugar::Virtualization#physical?
def physical?
Chef::Sugar::Virtualization.physical?(node)
end
end
end
end

View File

@@ -1 +0,0 @@
require "chef/sugar"

View File

@@ -1,38 +0,0 @@
{
"name": "chef-sugar",
"description": "Installs chef-sugar. Please see the chef-sugar Ruby gem for more information.",
"long_description": "Chef Sugar is a Gem & Chef Recipe that includes series of helpful syntactic\nsugars on top of the Chef core and other resources to make a cleaner, more lean\nrecipe DSL, enforce DRY principles, and make writing Chef recipes an awesome and\nfun experience!\n\nFor the most up-to-date information and documentation, please visit the [Chef\nSugar project page on GitHub](https://github.com/chef/chef-sugar).\n",
"maintainer": "Chef Software, Inc",
"maintainer_email": "cookbooks@chef.io",
"license": "Apache-2.0",
"platforms": {
"any": ">= 0.0.0"
},
"dependencies": {
},
"providing": {
},
"recipes": {
},
"version": "5.1.12",
"source_url": "https://github.com/chef/chef-sugar",
"issues_url": "https://github.com/chef/chef-sugar/issues",
"privacy": false,
"chef_versions": [
[
">= 13.0"
]
],
"ohai_versions": [
],
"gems": [
[
"chef-sugar"
]
],
"eager_load_libraries": true
}

View File

@@ -1,22 +0,0 @@
name 'chef-sugar'
maintainer 'Chef Software, Inc'
maintainer_email 'cookbooks@chef.io'
license 'Apache-2.0'
description 'Installs chef-sugar. Please see the chef-sugar Ruby gem for more information.'
long_description <<-EOH
Chef Sugar is a Gem & Chef Recipe that includes series of helpful syntactic
sugars on top of the Chef core and other resources to make a cleaner, more lean
recipe DSL, enforce DRY principles, and make writing Chef recipes an awesome and
fun experience!
For the most up-to-date information and documentation, please visit the [Chef
Sugar project page on GitHub](https://github.com/chef/chef-sugar).
EOH
version '5.1.12'
supports 'any'
issues_url 'https://github.com/chef/chef-sugar/issues'
source_url 'https://github.com/chef/chef-sugar'
chef_version '>= 13.0'
gem 'chef-sugar'

View File

@@ -1,20 +0,0 @@
#
# Cookbook Name:: chef-sugar
# Recipe:: default
#
# Copyright 2013-2015, Seth Vargo <sethvargo@gmail.com>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
Chef::Log.warn('chef-sugar::default no longer needs to be included in your runlist. Instead simply depend on the chef-sugar cookbook and the gem will be installed and loaded automatically.')

View File

@@ -1,28 +0,0 @@
require 'rspec'
require 'chefspec'
require 'chef/sugar'
require 'chef/version'
require_relative 'support/shared_examples'
RSpec.configure do |config|
# Prohibit using the should syntax
config.expect_with :rspec do |spec|
spec.syntax = :expect
end
# Focus groups
config.filter_run(focus: true)
config.run_all_when_everything_filtered = true
# Run specs in random order to surface order dependencies. If you find an
# order dependency and want to debug it, you can fix the order by providing
# the seed, which is printed after each run.
# --seed 1234
config.order = 'random'
# ChefSpec configuration
config.log_level = :fatal
config.filter_run_excluding pre_chef16_only: Gem::Requirement.new(">= 16.0.257").satisfied_by?(Gem::Version.new(Chef::VERSION))
end

View File

@@ -1,20 +0,0 @@
module RSpec
shared_examples 'a chef sugar' do
it 'acts as a singleton' do
described_class.module_eval("def foo; 'result'; end")
klass = Class.new.tap { |k| k.send(:include, described_class) }
expect(described_class.foo).to eq(klass.new.foo)
end
described_class.instance_methods.each do |name|
it "defines a `#{name}` DSL method" do
expect(Chef::Sugar::DSL).to be_method_defined(name)
end
it 'has n-1 arity from the parent method' do
method = Chef::Sugar::DSL.instance_method(name)
expect(method.arity).to eq(described_class.method(name).arity - 1)
end
end
end
end

View File

@@ -1,149 +0,0 @@
require 'spec_helper'
describe Chef::Sugar::Cloud do
it_behaves_like 'a chef sugar'
describe '#cloud?' do
it 'is true when the node is on cloud' do
node = { 'cloud' => nil }
expect(described_class.cloud?(node)).to be true
end
it 'is false when the node is not on cloud' do
node = {}
expect(described_class.cloud?(node)).to be false
end
end
describe '#ec2?' do
it 'is true when the node is on ec2' do
node = { 'ec2' => nil }
expect(described_class.ec2?(node)).to be true
end
it 'is false when the node is not on ec2' do
node = {}
expect(described_class.ec2?(node)).to be false
end
end
describe '#gce?' do
it 'is true when the node is on gce' do
node = { 'gce' => nil }
expect(described_class.gce?(node)).to be true
end
it 'is false when the node is not on gce' do
node = {}
expect(described_class.gce?(node)).to be false
end
end
describe '#rackspace?' do
it 'is true when the node is on rackspace' do
node = { 'rackspace' => nil }
expect(described_class.rackspace?(node)).to be true
end
it 'is false when the node is not on rackspace' do
node = {}
expect(described_class.rackspace?(node)).to be false
end
end
describe '#eucalyptus?' do
it 'is true when the node is on eucalyptus' do
node = { 'eucalyptus' => nil }
expect(described_class.eucalyptus?(node)).to be true
end
it 'is false when the node is not on eucalyptus' do
node = {}
expect(described_class.eucalyptus?(node)).to be false
end
end
describe '#euca?' do
it 'is true when the node is on eucalyptus' do
node = { 'eucalyptus' => nil }
expect(described_class.euca?(node)).to be true
end
it 'is false when the node is not on eucalyptus' do
node = {}
expect(described_class.euca?(node)).to be false
end
end
describe '#linode?' do
it 'is true when the node is on linode' do
node = { 'linode' => nil }
expect(described_class.linode?(node)).to be true
end
it 'is false when the node is not on linode' do
node = {}
expect(described_class.linode?(node)).to be false
end
end
describe '#openstack?' do
it 'is true when the node is on openstack' do
node = { 'openstack' => nil }
expect(described_class.openstack?(node)).to be true
end
it 'is false when the node is not on openstack' do
node = {}
expect(described_class.openstack?(node)).to be false
end
end
describe '#cloudstack?' do
it 'is true when the node is on cloudstack' do
node = { 'cloudstack' => nil }
expect(described_class.cloudstack?(node)).to be true
end
it 'is false when the node is not on cloudstack' do
node = {}
expect(described_class.cloudstack?(node)).to be false
end
end
describe '#azure?' do
it 'is true when the node is on azure' do
node = { 'azure' => nil }
expect(described_class.azure?(node)).to be true
end
it 'is false when the node is not on azure' do
node = {}
expect(described_class.azure?(node)).to be false
end
end
describe '#digitalocean?' do
it 'is true when the node is on digitalocean' do
node = { 'digital_ocean' => nil }
expect(described_class.digitalocean?(node)).to be true
end
it 'is false when the node is not on digitalocean' do
node = {}
expect(described_class.digitalocean?(node)).to be false
end
end
describe '#softlayer?' do
it 'is true when the node is on softlayer' do
node = { 'softlayer' => nil }
expect(described_class.softlayer?(node)).to be true
end
it 'is false when the node is not on softlayer' do
node = {}
expect(described_class.softlayer?(node)).to be false
end
end
end

View File

@@ -1,45 +0,0 @@
require 'spec_helper'
describe Chef::Sugar::Constraints do
describe '#version' do
let(:version) { described_class.version('1.2.3') }
it 'returns a new version object' do
expect(version).to be_a(Chef::Sugar::Constraints::Version)
end
it 'behaves like a String' do
expect(version).to be_a(String)
end
it 'returns true with the version is satisifed' do
expect(version).to be_satisfies('~> 1.2.0')
end
it 'returns false when the version is not satisfed' do
expect(version).to_not be_satisfies('~> 2.0.0')
end
end
describe '#constraint' do
let(:constraint) { described_class.constraint('~> 1.2.0') }
it 'returns a new constraint object' do
expect(constraint).to be_a(Chef::Sugar::Constraints::Constraint)
end
it 'returns true when the constraint is satisfied' do
expect(constraint).to be_satisfied_by('1.2.3')
end
it 'returns false when the constraint is not satisfied' do
expect(constraint).to_not be_satisfied_by('2.0.0')
end
end
describe '#chef_version' do
it 'is a DSL method' do
expect(Chef::Sugar::DSL).to be_method_defined(:chef_version)
end
end
end

View File

@@ -1,10 +0,0 @@
require 'spec_helper'
require 'chef/sugar/core_extensions'
describe Array do
describe '#satisfied_by?' do
it 'includes the method' do
expect(described_class).to be_method_defined(:satisfied_by?)
end
end
end

View File

@@ -1,62 +0,0 @@
require 'spec_helper'
require 'chef/sugar/core_extensions'
describe Object do
describe '#blank?' do
it 'includes the method' do
expect(described_class).to be_method_defined(:blank?)
end
it 'returns true for nil' do
expect(nil).to be_blank
end
it 'returns true for false' do
expect(false).to be_blank
end
it 'returns true for the empty string' do
expect('').to be_blank
end
it 'returns true for the empty array' do
expect([]).to be_blank
end
it 'returns true for the empty hash' do
expect({}).to be_blank
end
it 'returns false for a non-empty string' do
expect(' ').to_not be_blank
end
it 'returns false for a non-empty string with unicode' do
expect("\u00a0").to_not be_blank
end
it 'returns false for a non-empty string with special characters' do
expect("\n\t").to_not be_blank
end
it 'returns false for any object' do
expect(Object.new).to_not be_blank
end
it 'returns false for true' do
expect(true).to_not be_blank
end
it 'returns false for a fixnum' do
expect(1).to_not be_blank
end
it 'returns false for an array with items' do
expect(['foo']).to_not be_blank
end
it 'returns false for an array with items' do
expect({'foo' => 'bar'}).to_not be_blank
end
end
end

View File

@@ -1,48 +0,0 @@
require 'spec_helper'
require 'chef/sugar/core_extensions'
describe String do
describe '#satisfies?' do
it 'includes the method' do
expect(described_class).to be_method_defined(:satisfies?)
end
end
describe '#satisfied_by?' do
it 'includes the method' do
expect(described_class).to be_method_defined(:satisfied_by?)
end
end
describe '#flush' do
context 'when given a single-line string' do
it 'strips trailing whitespace' do
string = <<-EOH
This is a string
EOH
expect(string.flush).to eq('This is a string')
end
end
context 'when given a multi-line string' do
it 'removes the leading number of whitespaces' do
string = <<-EOH
def method
"This is a string!"
end
EOH
expect(string.flush).to eq(%Q(def method\n "This is a string!"\nend))
end
it 'leaves a newline when given' do
string = <<-EOH
def method
"This is a string!"
end
EOH
expect(string.flush).to eq(%Q(def method\n "This is a string!"\nend\n))
end
end
end
end

View File

@@ -1,118 +0,0 @@
require 'spec_helper'
describe Chef::Sugar::DataBag do
describe '#encrypted_data_bag_item' do
before { allow(Chef::EncryptedDataBagItem).to receive(:load) }
it 'loads the encrypted data bag item' do
expect(Chef::EncryptedDataBagItem).to receive(:load)
.with('accounts', 'github', 'secret_key')
described_class.encrypted_data_bag_item('accounts', 'github', 'secret_key')
end
context 'when Chef::Config is set' do
it 'loads the secret key from the Chef::Config' do
allow(Chef::Config).to receive(:[]).with(:encrypted_data_bag_secret).and_return('/data/path')
allow(File).to receive(:read).with('/data/path').and_return('B@c0n')
expect(Chef::EncryptedDataBagItem).to receive(:load)
.with('accounts', 'github', 'B@c0n')
described_class.encrypted_data_bag_item('accounts', 'github')
end
end
context 'when Chef::Config is not set and no value is given' do
it 'raises an exception' do
expect {
described_class.encrypted_data_bag_item('accounts', 'github')
}.to raise_error(Chef::Sugar::DataBag::EncryptedDataBagSecretNotGiven)
end
end
end
describe '#encrypted_data_bag_item_for_environment' do
let(:node) { double(:node, chef_environment: 'production') }
context 'when the environment exists' do
it 'loads the data from the environment' do
allow(Chef::EncryptedDataBagItem).to receive(:load).and_return(
'production' => {
'username' => 'sethvargo',
'password' => 'bacon',
}
)
expect(described_class.encrypted_data_bag_item_for_environment(node, 'accounts', 'github', 'secret_key')).to eq(
'password' => 'bacon',
'username' => 'sethvargo',
)
end
end
context 'when the environment does not exist' do
it 'loads the data from the default bucket' do
allow(Chef::EncryptedDataBagItem).to receive(:load).and_return(
'staging' => {
'username' => 'sethvargo',
'password' => 'bacon',
},
'default' => {
'username' => 'schisamo',
'password' => 'ham',
}
)
expect(described_class.encrypted_data_bag_item_for_environment(node, 'accounts', 'github', 'secret_key')).to eq(
'password' => 'ham',
'username' => 'schisamo',
)
end
end
end
describe '#data_bag_item_for_environment' do
let(:node) { double(:node, chef_environment: 'production') }
context 'when the environment exists' do
it 'loads the data from the environment' do
allow(Chef::DataBagItem).to receive(:load).and_return(
'production' => {
'username' => 'sethvargo',
'comment' => 'loves bacon',
},
'default' => {
'username' => 'schisamo',
'comment' => 'more of a ham guy',
}
)
expect(described_class.data_bag_item_for_environment(node, 'accounts', 'github')).to eq(
'comment' => 'loves bacon',
'username' => 'sethvargo',
)
end
end
context 'when the environment does not exist' do
it 'loads the data from the default bucket' do
allow(Chef::DataBagItem).to receive(:load).and_return(
'staging' => {
'username' => 'sethvargo',
'comment' => 'loves bacon',
},
'default' => {
'username' => 'schisamo',
'comment' => 'more of a ham guy',
}
)
expect(described_class.data_bag_item_for_environment(node, 'accounts', 'github')).to eq(
'comment' => 'more of a ham guy',
'username' => 'schisamo',
)
end
end
end
end

View File

@@ -1,70 +0,0 @@
require 'spec_helper'
describe Chef::Sugar::Init do
it_behaves_like 'a chef sugar'
before(:each) do
allow(IO).to receive(:read)
.with("/proc/1/comm")
.and_return("init")
allow(File).to receive(:executable?)
.with("/sbin/initctl")
.and_return(false)
allow(File).to receive(:executable?)
.with("/sbin/runit-init")
.and_return(false)
end
describe '#systemd?' do
systemctl_path = '/bin/systemctl'
it "is true when #{systemctl_path} exists" do
allow(File).to receive(:exist?)
.with(systemctl_path)
.and_return(true)
node = {}
expect(described_class.systemd?(node)).to be true
end
it "is false when #{systemctl_path} does not exist" do
allow(File).to receive(:exist?)
.with(systemctl_path)
.and_return(false)
node = {}
expect(described_class.systemd?(node)).to be false
end
end
describe '#upstart?' do
it 'is true when /sbin/initctl is executable' do
allow(File).to receive(:executable?)
.with("/sbin/initctl")
.and_return(true)
node = {}
expect(described_class.upstart?(node)).to be true
end
it 'is false when /sbin/initctl is not executable' do
node = {}
expect(described_class.upstart?(node)).to be false
end
end
describe '#runit?' do
it 'is true when /sbin/runit-init is executable' do
allow(File).to receive(:executable?)
.with("/sbin/runit-init")
.and_return(true)
node = {}
expect(described_class.runit?(node)).to be true
end
it 'is false when /sbin/runit-init is not executable' do
node = {}
expect(described_class.runit?(node)).to be false
end
end
end

View File

@@ -1,53 +0,0 @@
require 'spec_helper'
describe Chef::Sugar::IP do
it_behaves_like 'a chef sugar'
let(:node) { { 'ipaddress' => '1.2.3.4' } }
let(:other) { { 'ipaddress' => '5.6.7.8' } }
context 'when not on a cloud' do
it 'returns the default IP address' do
expect(described_class.best_ip_for(node, other)).to eq(other['ipaddress'])
end
end
context 'when the target is on the cloud' do
before do
other['cloud'] = {}
other['cloud']['provider'] = 'ec2'
other['cloud']['local_ipv4'] = '9.10.11.12'
other['cloud']['public_ipv4'] = '13.14.15.16'
node['cloud'] = nil
end
context 'when the current node is not on the cloud' do
it 'uses the public ipv4' do
expect(described_class.best_ip_for(node, other)).to eq('13.14.15.16')
end
end
context 'when the current node is on a different cloud' do
before do
node['cloud'] = {}
node['cloud']['provider'] = 'rackspace'
end
it 'uses the public ipv4' do
expect(described_class.best_ip_for(node, other)).to eq('13.14.15.16')
end
end
context 'when the current node is on the same cloud' do
before do
node['cloud'] = {}
node['cloud']['provider'] = 'ec2'
end
it 'uses the local ipv4' do
expect(described_class.best_ip_for(node, other)).to eq('9.10.11.12')
end
end
end
end

View File

@@ -1,16 +0,0 @@
require 'spec_helper'
describe Chef::Sugar::Kernel do
describe '.require_chef_gem' do
it 'raises an exception when the gem is not installed' do
expect {
described_class.require_chef_gem('bacon')
}.to raise_error(Chef::Sugar::Kernel::ChefGemLoadError)
end
it 'loads the gem' do
allow(Chef::Sugar::Kernel).to receive(:require).and_return(true)
expect(described_class.require_chef_gem('bacon')).to be true
end
end
end

View File

@@ -1,172 +0,0 @@
require 'spec_helper'
describe Chef::Node do
describe '#in?' do
it 'returns true when the node is in the environment' do
allow(subject).to receive(:chef_environment).and_return('production')
expect(subject.in?('production')).to be true
expect(subject.in?(/production$/)).to be true
end
it 'returns false when the node is not in the environment' do
allow(subject).to receive(:chef_environment).and_return('staging')
expect(subject.in?('production')).to be false
expect(subject.in?(/production$/)).to be false
end
end
describe '#deep_fetch' do
let(:node) { described_class.new }
before { node.default['apache2']['config']['root'] = '/var/www' }
it 'fetches a deeply nested attribute' do
expect(node.deep_fetch('apache2', 'config', 'root')).to eq('/var/www')
end
it 'ignores symbols, strings, etc' do
expect(node.deep_fetch(:apache2, :config, :root)).to eq('/var/www')
end
it 'safely returns nil if a key does not exist' do
expect(node.deep_fetch(:apache2, :not_real, :nested, :yup)).to be_nil
end
end
describe '#deep_fetch!' do
let(:node) { described_class.new }
before { node.default['apache2']['config']['root'] = '/var/www' }
it 'fetches a deeply nested attribute' do
expect(node.deep_fetch!('apache2', 'config', 'root')).to eq('/var/www')
end
it 'ignores symbols, strings, etc' do
expect(node.deep_fetch!(:apache2, :config, :root)).to eq('/var/www')
end
it 'raises an error if a key does not exist' do
expect {
node.deep_fetch!(:apache2, :not_real)
}.to raise_error(Chef::Node::AttributeDoesNotExistError) { |e|
expect(e.message).to eq(<<-EOH.gsub(/^ {10}/, ''))
No attribute `node['apache2']['not_real']' exists on
the current node. Specifically the `not_real' attribute is not
defined. Please make sure you have spelled everything correctly.
EOH
}
end
end
describe '#namespace' do
let(:node) { described_class.new }
it 'defines the attributes' do
node.instance_eval do
namespace 'apache2' do
namespace 'config' do
root '/var/www'
end
end
end
expect(node.default).to eq({
'apache2' => {
'config' => { 'root' => '/var/www' }
}
})
end
it 'accepts multiple attributes' do
node.instance_eval do
namespace 'apache2', 'config' do
root '/var/www'
end
end
expect(node.default).to eq({
'apache2' => {
'config' => { 'root' => '/var/www' }
}
})
end
it 'accepts attribute precedence levels' do
node.instance_eval do
namespace 'apache2', precedence: normal do
namespace 'config', precedence: override do
root '/var/www'
end
end
end
expect(node.override).to eq({
'apache2' => {
'config' => { 'root' => '/var/www' }
}
})
end
it 'maintains precedence level into nested calls' do
node.instance_eval do
namespace 'apache2', precedence: override do
namespace 'config' do
root '/var/www'
end
end
end
expect(node.override).to eq({
'apache2' => {
'config' => { 'root' => '/var/www' }
}
})
end
it 'resets precedence to default in subsequent non-nested calls' do
node.instance_eval do
namespace 'apache2', precedence: override do
namespace 'config' do
root '/var/www'
end
end
namespace 'php' do
version '5.3'
end
end
expect(node.override).to eq({
'apache2' => {
'config' => { 'root' => '/var/www' }
}
})
expect(node.default).to eq({
'php' => {
'version' => '5.3'
}
})
end
it 'can access attributes within itself' do
node.instance_eval do
namespace 'apache2' do
namespace 'config' do
root '/var/www'
ssl File.join(root, 'ssl')
end
end
end
expect(node.default).to eq({
'apache2' => {
'config' => {
'root' => '/var/www',
'ssl' => '/var/www/ssl',
}
}
})
end
end
end

View File

@@ -1,174 +0,0 @@
require 'spec_helper'
describe Chef::Sugar::Platform do
it_behaves_like 'a chef sugar'
describe '#platform_version' do
it 'returns the platform version' do
node = { 'platform_version' => '1.2.3' }
expect(described_class.platform_version(node)).to eq('1.2.3')
end
end
context 'dynamic matchers' do
describe '#ubuntu_after_lucid?' do
it 'returns true when the version is later than 10.04' do
node = { 'platform' => 'ubuntu', 'platform_version' => '10.10' }
expect(described_class.ubuntu_after_lucid?(node)).to be true
end
it 'returns false when the version is 10.04' do
node = { 'platform' => 'ubuntu', 'platform_version' => '10.04' }
expect(described_class.ubuntu_after_lucid?(node)).to be false
end
it 'returns false when the version is a patch release higher than 10.04' do
node = { 'platform' => 'ubuntu', 'platform_version' => '10.04.4' }
expect(described_class.ubuntu_after_lucid?(node)).to be false
end
it 'returns false when the version is less than 10.04' do
node = { 'platform' => 'ubuntu', 'platform_version' => '9.10' }
expect(described_class.ubuntu_after_lucid?(node)).to be false
end
end
describe '#ubuntu_after_or_at_lucid?' do
it 'returns true when the version is later than 10.04' do
node = { 'platform' => 'ubuntu', 'platform_version' => '10.10' }
expect(described_class.ubuntu_after_or_at_lucid?(node)).to be true
end
it 'returns true when the version is 10.04' do
node = { 'platform' => 'ubuntu', 'platform_version' => '10.04' }
expect(described_class.ubuntu_after_or_at_lucid?(node)).to be true
end
it 'returns true when the version is a patch release higher than 10.04' do
node = { 'platform' => 'ubuntu', 'platform_version' => '10.04.4' }
expect(described_class.ubuntu_after_or_at_lucid?(node)).to be true
end
it 'returns false when the version is less than 10.04' do
node = { 'platform' => 'ubuntu', 'platform_version' => '9.10' }
expect(described_class.ubuntu_after_or_at_lucid?(node)).to be false
end
end
describe '#ubuntu_lucid?' do
it 'returns false when the version is later than 10.04' do
node = { 'platform' => 'ubuntu', 'platform_version' => '10.10' }
expect(described_class.ubuntu_lucid?(node)).to be false
end
it 'returns true when the version is 10.04' do
node = { 'platform' => 'ubuntu', 'platform_version' => '10.04' }
expect(described_class.ubuntu_lucid?(node)).to be true
end
it 'returns true when the version is a patch release higher than 10.04' do
node = { 'platform' => 'ubuntu', 'platform_version' => '10.04.4' }
expect(described_class.ubuntu_lucid?(node)).to be true
end
it 'returns false when the version is less than 10.04' do
node = { 'platform' => 'ubuntu', 'platform_version' => '9.10' }
expect(described_class.ubuntu_lucid?(node)).to be false
end
end
describe '#ubuntu_before_lucid?' do
it 'returns false when the version is later than 10.04' do
node = { 'platform' => 'ubuntu', 'platform_version' => '10.10' }
expect(described_class.ubuntu_before_lucid?(node)).to be false
end
it 'returns false when the version is 10.04' do
node = { 'platform' => 'ubuntu', 'platform_version' => '10.04' }
expect(described_class.ubuntu_before_lucid?(node)).to be false
end
it 'returns false when the version is a patch release higher than 10.04' do
node = { 'platform' => 'ubuntu', 'platform_version' => '10.04.4' }
expect(described_class.ubuntu_before_lucid?(node)).to be false
end
it 'returns true when the version is less than 10.04' do
node = { 'platform' => 'ubuntu', 'platform_version' => '9.10' }
expect(described_class.ubuntu_before_lucid?(node)).to be true
end
end
describe '#ubuntu_before_or_at_lucid?' do
it 'returns false when the version is later than 10.04' do
node = { 'platform' => 'ubuntu', 'platform_version' => '10.10' }
expect(described_class.ubuntu_before_or_at_lucid?(node)).to be false
end
it 'returns true when the version is 10.04' do
node = { 'platform' => 'ubuntu', 'platform_version' => '10.04' }
expect(described_class.ubuntu_before_or_at_lucid?(node)).to be true
end
it 'returns true when the version is a patch release higher than 10.04' do
node = { 'platform' => 'ubuntu', 'platform_version' => '10.04.4' }
expect(described_class.ubuntu_before_or_at_lucid?(node)).to be true
end
it 'returns true when the version is less than 10.04' do
node = { 'platform' => 'ubuntu', 'platform_version' => '9.10' }
expect(described_class.ubuntu_before_or_at_lucid?(node)).to be true
end
end
describe '#centos_final?' do
it 'returns true when the version is a subset of the major' do
node = { 'platform' => 'centos', 'platform_version' => '6.8' }
expect(described_class.centos_final?(node)).to be true
end
it 'returns false when the version is not the major' do
node = { 'platform' => 'centos', 'platform_version' => '7.4' }
expect(described_class.centos_final?(node)).to be false
end
end
describe '#debian_wheezy?' do
it 'returns true when the version is a subset of the major' do
node = { 'platform' => 'debian', 'platform_version' => '7.1' }
expect(described_class.debian_wheezy?(node)).to be true
end
it 'returns false when the version is not the major' do
node = { 'platform' => 'debian', 'platform_version' => '6.1' }
expect(described_class.debian_wheezy?(node)).to be false
end
end
describe '#debian_before_wheezy?' do
it 'returns true when the version is a less than the major' do
node = { 'platform' => 'debian', 'platform_version' => '6.5' }
expect(described_class.debian_before_wheezy?(node)).to be true
end
it 'returns false when the version is not less than the major' do
node = { 'platform' => 'debian', 'platform_version' => '8.0' }
expect(described_class.debian_before_wheezy?(node)).to be false
end
end
describe '#solaris_10?' do
it 'returns true when the version is 5.10' do
node = { 'platform' => 'solaris2', 'platform_version' => '5.10' }
expect(described_class.solaris_10?(node)).to be true
end
end
describe '#solaris_11?' do
it 'returns true when the version is 5.11' do
node = { 'platform' => 'solaris2', 'platform_version' => '5.11' }
expect(described_class.solaris_11?(node)).to be true
end
end
end
end

View File

@@ -1,39 +0,0 @@
require 'spec_helper'
describe Chef::Sugar::Ruby do
it_behaves_like 'a chef sugar'
describe '#ruby_20?' do
it 'returns true when the ruby version is 2.0' do
node = { 'languages' => { 'ruby' => { 'version' => '2.0.0' } } }
expect(described_class.ruby_20?(node)).to be true
end
it 'returns true when the ruby version is less than 2.0' do
node = { 'languages' => { 'ruby' => { 'version' => '1.9.3' } } }
expect(described_class.ruby_20?(node)).to be false
end
it 'returns false when the ruby version is higher than 2.0' do
node = { 'languages' => { 'ruby' => { 'version' => '3.0.0' } } }
expect(described_class.ruby_20?(node)).to be false
end
end
describe '#ruby_19?' do
it 'returns true when the ruby version is 1.9' do
node = { 'languages' => { 'ruby' => { 'version' => '1.9.1' } } }
expect(described_class.ruby_19?(node)).to be true
end
it 'returns true when the ruby version is less than 1.9' do
node = { 'languages' => { 'ruby' => { 'version' => '1.8.7' } } }
expect(described_class.ruby_19?(node)).to be false
end
it 'returns false when the ruby version is higher than 1.9' do
node = { 'languages' => { 'ruby' => { 'version' => '2.0.0' } } }
expect(described_class.ruby_19?(node)).to be false
end
end
end

View File

@@ -1,19 +0,0 @@
require 'spec_helper'
describe Chef::Sugar::RunContext do
it_behaves_like 'a chef sugar'
describe '#includes_recipe?' do
let(:node) { double(Chef::Node) }
it 'returns true when the recipe exists' do
allow(node).to receive(:recipe?).and_return(true)
expect(described_class.includes_recipe?(node, 'foo')).to be true
end
it 'returns false when the recipe does not exist' do
allow(node).to receive(:recipe?).and_return(false)
expect(described_class.includes_recipe?(node, 'bar')).to be false
end
end
end

View File

@@ -1,104 +0,0 @@
require 'spec_helper'
describe Chef::Sugar::Shell do
describe '#which', :pre_chef16_only do
it 'returns the first executable matching the command' do
allow(File).to receive(:executable?).and_return(false)
allow(File).to receive(:executable?).with('/usr/bin/mongo').and_return(true)
expect(described_class.which('mongo')).to eq('/usr/bin/mongo')
end
it 'returns nil when no command is found' do
allow(File).to receive(:executable?).and_return(false)
expect(described_class.which('node')).to be_nil
end
context 'with an absolute path' do
it 'returns the executable if it exists' do
allow(File).to receive(:executable?).with('/usr/local/bin/bash').and_return(true)
expect(described_class.which('/usr/local/bin/bash')).to eq('/usr/local/bin/bash')
end
it 'returns nil when the file is not executable' do
allow(File).to receive(:executable?).with('/usr/local/bin/bash').and_return(false)
expect(described_class.which('/usr/local/bin/bash')).to be_nil
end
end
end
describe '#dev_null' do
it 'returns NUL on Windows' do
node = { 'platform_family' => 'windows' }
expect(described_class.dev_null(node)).to eq('NUL')
end
it 'returns /dev/null on Linux' do
node = { 'platform_family' => 'debian' }
expect(described_class.dev_null(node)).to eq('/dev/null')
end
end
describe '#installed?' do
it 'returns true if the given binary exists' do
allow(described_class).to receive(:which).and_return(nil)
allow(described_class).to receive(:which).with('mongo').and_return(true)
expect(described_class.installed?('mongo')).to be true
end
it 'returns false if the given binary does not exist' do
allow(described_class).to receive(:which).with('node').and_return(nil)
expect(described_class.installed?('node')).to be false
end
end
describe '#installed_at_version?' do
it 'returns true if the command is installed at the correct version' do
allow(described_class).to receive(:which).and_return(true)
allow(described_class).to receive(:version_for).and_return('1.2.3')
expect(described_class.installed_at_version?('mongo', '1.2.3')).to be true
end
it 'returns true if the command is installed at the correct version and has additional output' do
allow(described_class).to receive(:which).and_return(true)
allow(described_class).to receive(:version_for).and_return('Mongo DB version 1.2.3. Some other text.')
expect(described_class.installed_at_version?('mongo', '1.2.3')).to be true
end
it 'returns true if the command is installed at the correct version with a regex' do
allow(described_class).to receive(:which).and_return(true)
allow(described_class).to receive(:version_for).and_return('1.2.3')
expect(described_class.installed_at_version?('mongo', /1\.2/)).to be true
end
it 'returns false if the command is installed at the wrong version' do
allow(described_class).to receive(:which).and_return(true)
allow(described_class).to receive(:version_for).and_return('1.2.3')
expect(described_class.installed_at_version?('mongo', '4.5.6')).to be false
end
it 'returns false if #version_for is nil' do
allow(described_class).to receive(:which).and_return(true)
allow(described_class).to receive(:version_for).and_return(nil)
expect(described_class.installed_at_version?('mongo', '4.5.6')).to be false
end
it 'returns false if the command is not installed' do
allow(described_class).to receive(:which).and_return(nil)
expect(described_class.installed_at_version?('mongo', '1.0.0')).to be false
end
end
describe '#version_for' do
let(:shell_out) { double('shell_out', run_command: nil, error!: nil, stdout: '1.2.3', stderr: 'Oh no!') }
before { allow(Mixlib::ShellOut).to receive(:new).and_return(shell_out) }
it 'runs the thing in shellout' do
expect(Mixlib::ShellOut).to receive(:new).with('mongo --version')
described_class.version_for('mongo')
end
it 'returns the combined stdout and stderr' do
expect(described_class.version_for('mongo')).to eq("1.2.3\nOh no!")
end
end
end

Some files were not shown because too many files have changed in this diff Show More