diff --git a/.dockerignore b/.dockerignore index e36a1d3..5b95c29 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,4 +1,4 @@ -.git +.git/ .gitignore AUTHORS LICENSE diff --git a/README.md b/README.md index 9a88983..2e3b5ab 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,8 @@ * [**Quay.io**](https://quay.io/repository/galexrt/zulip) * [**Docker Hub**](https://hub.docker.com/r/galexrt/zulip) +Current Version: `v1.3.11` + *** This is a container image for [Zulip](https://zulip.org) from [Dropbox](https://blogs.dropbox.com/tech/2015/09/open-sourcing-zulip-a-dropbox-hack-week-project/) @@ -23,9 +25,9 @@ See the [Configuration](https://github.com/Galexrt/docker-zulip/wiki/Configurati ## How to get the container: ### For docker use: -`docker pull quay.io/galexrt/zulip:v1.3.10-1` +`docker pull quay.io/galexrt/zulip:v1.3.11` or -`docker pull galexrt/zulip:v1.3.10-1` +`docker pull galexrt/zulip:v1.3.11` ### For the latest development image changes use: `docker pull quay.io/galexrt/zulip:dev` diff --git a/custom_zulip_files/puppet/apt/.bundle/config b/custom_zulip_files/puppet/apt/.bundle/config deleted file mode 100644 index 2ddd802..0000000 --- a/custom_zulip_files/puppet/apt/.bundle/config +++ /dev/null @@ -1,2 +0,0 @@ ---- -BUNDLE_WITHOUT: development diff --git a/custom_zulip_files/puppet/apt/.fixtures.yml b/custom_zulip_files/puppet/apt/.fixtures.yml deleted file mode 100644 index dbd5621..0000000 --- a/custom_zulip_files/puppet/apt/.fixtures.yml +++ /dev/null @@ -1,5 +0,0 @@ -fixtures: - repositories: - "stdlib": "git://github.com/puppetlabs/puppetlabs-stdlib.git" - symlinks: - "apt": "#{source_dir}" diff --git a/custom_zulip_files/puppet/apt/.forge-release/pom.xml b/custom_zulip_files/puppet/apt/.forge-release/pom.xml deleted file mode 100644 index b788e86..0000000 --- a/custom_zulip_files/puppet/apt/.forge-release/pom.xml +++ /dev/null @@ -1,29 +0,0 @@ - - 4.0.0 - puppetlabs - ghpublisher - 1.0.0 - puppet-module - ghpublisher - - - ${env.PUBLISHER_LOGIN} - ${env.PUBLISHER_PASSWORD} - - - - - - org.cloudsmith.geppetto - forge-maven-plugin - 3.2.0 - true - - false - ${project.build.directory}/forgeCache - - - - - diff --git a/custom_zulip_files/puppet/apt/.forge-release/publish b/custom_zulip_files/puppet/apt/.forge-release/publish deleted file mode 100644 index 7d8665f..0000000 --- a/custom_zulip_files/puppet/apt/.forge-release/publish +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/sh -# -# Perform GitHub publish -if [ -z "$PUBLISHER_LOGIN" ] -then - echo "Environment variable PUBLISHER_LOGIN must be set" - exit 1 -fi - -if [ -z "$PUBLISHER_PASSWORD" ] -then - echo "Environment variable PUBLISHER_PASSWORD must be set" - exit 1 -fi - -MODULES_ROOT=`pwd` -cd $(dirname $0) -mvn -q -s settings.xml -Dforge.modules.root="$MODULES_ROOT" deploy \ No newline at end of file diff --git a/custom_zulip_files/puppet/apt/.forge-release/settings.xml b/custom_zulip_files/puppet/apt/.forge-release/settings.xml deleted file mode 100644 index 3ec7de2..0000000 --- a/custom_zulip_files/puppet/apt/.forge-release/settings.xml +++ /dev/null @@ -1,34 +0,0 @@ - - - - cloudsmith - - - cloudsmith - https://am0.cloudsmith.com/nexus/content/repositories/releases/ - - true - - - false - - - - - - cloudsmith - https://am0.cloudsmith.com/nexus/content/repositories/releases/ - - true - - - false - - - - - - - cloudsmith - - diff --git a/custom_zulip_files/puppet/apt/.forge-release/validate b/custom_zulip_files/puppet/apt/.forge-release/validate deleted file mode 100644 index 190ed33..0000000 --- a/custom_zulip_files/puppet/apt/.forge-release/validate +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/sh -# -# Perform GitHub publish -MODULES_ROOT=`pwd` -cd $(dirname $0) -mvn -q -s settings.xml -Dforge.modules.root="$MODULES_ROOT" compile \ No newline at end of file diff --git a/custom_zulip_files/puppet/apt/.nodeset.yml b/custom_zulip_files/puppet/apt/.nodeset.yml deleted file mode 100644 index ad056fe..0000000 --- a/custom_zulip_files/puppet/apt/.nodeset.yml +++ /dev/null @@ -1,19 +0,0 @@ ---- -default_set: 'ubuntu-server-12042-x64' -sets: - 'debian-607-x64': - nodes: - "main.foo.vm": - prefab: 'debian-607-x64' - 'debian-70rc1-x64': - nodes: - "main.foo.vm": - prefab: 'debian-70rc1-x64' - 'ubuntu-server-10044-x64': - nodes: - "main.foo.vm": - prefab: 'ubuntu-server-10044-x64' - 'ubuntu-server-12042-x64': - nodes: - "main.foo.vm": - prefab: 'ubuntu-server-12042-x64' diff --git a/custom_zulip_files/puppet/apt/.travis.yml b/custom_zulip_files/puppet/apt/.travis.yml deleted file mode 100644 index 00924ba..0000000 --- a/custom_zulip_files/puppet/apt/.travis.yml +++ /dev/null @@ -1,40 +0,0 @@ ---- -branches: - only: - - master -language: ruby -bundler_args: --without development -script: bundle exec rake spec SPEC_OPTS='--format documentation' -after_success: - - git clone -q git://github.com/puppetlabs/ghpublisher.git .forge-release - - .forge-release/publish -rvm: - - 1.8.7 - - 1.9.3 - - 2.0.0 -env: - matrix: - - PUPPET_GEM_VERSION="~> 2.7.0" - - PUPPET_GEM_VERSION="~> 3.0.0" - - PUPPET_GEM_VERSION="~> 3.1.0" - - PUPPET_GEM_VERSION="~> 3.2.0" - global: - - PUBLISHER_LOGIN=puppetlabs - - secure: |- - ipB/CV1rVSTXU9ZDuzrFOlzJrRmJob36tKns2xszuH4r9s5P9qivNAngRGdV - msb69xvOlzQykM0WRF+4kJ6TZ7AbMiDI+VZ8GDtsRaU5/q3BpsvFe8aato+6 - QeyFtBG62OsosTEhGws4mqiFsPDu3dHlakuJc9zevlTuhNwbKSs= -matrix: - exclude: - - rvm: 1.9.3 - env: PUPPET_GEM_VERSION="~> 2.7.0" - - rvm: 2.0.0 - env: PUPPET_GEM_VERSION="~> 2.7.0" - - rvm: 2.0.0 - env: PUPPET_GEM_VERSION="~> 3.0.0" - - rvm: 2.0.0 - env: PUPPET_GEM_VERSION="~> 3.1.0" - - rvm: 1.8.7 - env: PUPPET_GEM_VERSION="~> 3.2.0" -notifications: - email: false diff --git a/custom_zulip_files/puppet/apt/CHANGELOG b/custom_zulip_files/puppet/apt/CHANGELOG deleted file mode 100644 index 0d321bc..0000000 --- a/custom_zulip_files/puppet/apt/CHANGELOG +++ /dev/null @@ -1,183 +0,0 @@ -2013-10-08 1.4.0 - -Summary: - -Minor bugfix and allow the timeout to be adjusted. - -Features: -- Add an `updates_timeout` to apt::params - -Fixes: -- Ensure apt::ppa can readd a ppa removed by hand. - -Summary - -1.3.0 -===== - -Summary: - -This major feature in this release is the new apt::unattended_upgrades class, -allowing you to handle Ubuntu's unattended feature. This allows you to select -specific packages to automatically upgrade without any further user -involvement. - -In addition we extend our Wheezy support, add proxy support to apt:ppa and do -various cleanups and tweaks. - -Features: -- Add apt::unattended_upgrades support for Ubuntu. -- Add wheezy backports support. -- Use the geoDNS http.debian.net instead of the main debian ftp server. -- Add `options` parameter to apt::ppa in order to pass options to apt-add-repository command. -- Add proxy support for apt::ppa (uses proxy_host and proxy_port from apt). - -Bugfixes: -- Fix regsubst() calls to quote single letters (for future parser). -- Fix lint warnings and other misc cleanup. - -1.2.0 -===== - -Features: -- Add geppetto `.project` natures -- Add GH auto-release -- Add `apt::key::key_options` parameter -- Add complex pin support using distribution properties for `apt::pin` via new properties: - - `apt::pin::codename` - - `apt::pin::release_version` - - `apt::pin::component` - - `apt::pin::originator` - - `apt::pin::label` -- Add source architecture support to `apt::source::architecture` - -Bugfixes: -- Use apt-get instead of aptitude in apt::force -- Update default backports location -- Add dependency for required packages before apt-get update - - -1.1.1 -===== - -This is a bug fix release that resolves a number of issues: - -* By changing template variable usage, we remove the deprecation warnings - for Puppet 3.2.x -* Fixed proxy file removal, when proxy absent - -Some documentation, style and whitespaces changes were also merged. This -release also introduced proper rspec-puppet unit testing on Travis-CI to help -reduce regression. - -Thanks to all the community contributors below that made this patch possible. - -#### Detail Changes - -* fix minor comment type (Chris Rutter) -* whitespace fixes (Michael Moll) -* Update travis config file (William Van Hevelingen) -* Build all branches on travis (William Van Hevelingen) -* Standardize travis.yml on pattern introduced in stdlib (William Van Hevelingen) -* Updated content to conform to README best practices template (Lauren Rother) -* Fix apt::release example in readme (Brian Galey) -* add @ to variables in template (Peter Hoeg) -* Remove deprecation warnings for pin.pref.erb as well (Ken Barber) -* Update travis.yml to latest versions of puppet (Ken Barber) -* Fix proxy file removal (Scott Barber) -* Add spec test for removing proxy configuration (Dean Reilly) -* Fix apt::key listing longer than 8 chars (Benjamin Knofe) - - ---------------------------------------- - -1.1.0 -===== - -This release includes Ubuntu 12.10 (Quantal) support for PPAs. - ---------------------------------------- - -2012-05-25 Puppet Labs - 0.0.4 - * Fix ppa list filename when there is a period in the PPA name - * Add .pref extension to apt preferences files - * Allow preferences to be purged - * Extend pin support - -2012-05-04 Puppet Labs - 0.0.3 - * only invoke apt-get update once - * only install python-software-properties if a ppa is added - * support 'ensure => absent' for all defined types - * add apt::conf - * add apt::backports - * fixed Modulefile for module tool dependency resolution - * configure proxy before doing apt-get update - * use apt-get update instead of aptitude for apt::ppa - * add support to pin release - - -2012-03-26 Puppet Labs - 0.0.2 -41cedbb (#13261) Add real examples to smoke tests. -d159a78 (#13261) Add key.pp smoke test -7116c7a (#13261) Replace foo source with puppetlabs source -1ead0bf Ignore pkg directory. -9c13872 (#13289) Fix some more style violations -0ea4ffa (#13289) Change test scaffolding to use a module & manifest dir fixture path -a758247 (#13289) Clean up style violations and fix corresponding tests -99c3fd3 (#13289) Add puppet lint tests to Rakefile -5148cbf (#13125) Apt keys should be case insensitive -b9607a4 Convert apt::key to use anchors - -2012-03-07 Puppet Labs - 0.0.1 -d4fec56 Modify apt::source release parameter test -1132a07 (#12917) Add contributors to README -8cdaf85 (#12823) Add apt::key defined type and modify apt::source to use it -7c0d10b (#12809) $release should use $lsbdistcodename and fall back to manual input -be2cc3e (#12522) Adjust spec test for splitting purge -7dc60ae (#12522) Split purge option to spare sources.list -9059c4e Fix source specs to test all key permutations -8acb202 Add test for python-software-properties package -a4af11f Check if python-software-properties is defined before attempting to define it. -1dcbf3d Add tests for required_packages change -f3735d2 Allow duplicate $required_packages -74c8371 (#12430) Add tests for changes to apt module -97ebb2d Test two sources with the same key -1160bcd (#12526) Add ability to reverse apt { disable_keys => true } -2842d73 Add Modulefile to puppet-apt -c657742 Allow the use of the same key in multiple sources -8c27963 (#12522) Adding purge option to apt class -997c9fd (#12529) Add unit test for apt proxy settings -50f3cca (#12529) Add parameter to support setting a proxy for apt -d522877 (#12094) Replace chained .with_* with a hash -8cf1bd0 (#12094) Remove deprecated spec.opts file -2d688f4 (#12094) Add rspec-puppet tests for apt -0fb5f78 (#12094) Replace name with path in file resources -f759bc0 (#11953) Apt::force passes $version to aptitude -f71db53 (#11413) Add spec test for apt::force to verify changes to unless -2f5d317 (#11413) Update dpkg query used by apt::force -cf6caa1 (#10451) Add test coverage to apt::ppa -0dd697d include_src parameter in example; Whitespace cleanup -b662eb8 fix typos in "repositories" -1be7457 Fix (#10451) - apt::ppa fails to "apt-get update" when new PPA source is added -864302a Set the pin priority before adding the source (Fix #10449) -1de4e0a Refactored as per mlitteken -1af9a13 Added some crazy bash madness to check if the ppa is installed already. Otherwise the manifest tries to add it on every run! -52ca73e (#8720) Replace Apt::Ppa with Apt::Builddep -5c05fa0 added builddep command. -a11af50 added the ability to specify the content of a key -c42db0f Fixes ppa test. -77d2b0d reformatted whitespace to match recommended style of 2 space indentation. -27ebdfc ignore swap files. -377d58a added smoke tests for module. -18f614b reformatted apt::ppa according to recommended style. -d8a1e4e Created a params class to hold global data. -636ae85 Added two params for apt class -148fc73 Update LICENSE. -ed2d19e Support ability to add more than one PPA -420d537 Add call to apt-update after add-apt-repository in apt::ppa -945be77 Add package definition for python-software-properties -71fc425 Abs paths for all commands -9d51cd1 Adding LICENSE -71796e3 Heading fix in README -87777d8 Typo in README -f848bac First commit diff --git a/custom_zulip_files/puppet/apt/Gemfile b/custom_zulip_files/puppet/apt/Gemfile deleted file mode 100644 index 15bd29d..0000000 --- a/custom_zulip_files/puppet/apt/Gemfile +++ /dev/null @@ -1,16 +0,0 @@ -source 'https://rubygems.org' - -group :development, :test do - gem 'rake', :require => false - gem 'rspec-puppet', :require => false - gem 'puppetlabs_spec_helper', :require => false - gem 'rspec-system', :require => false - gem 'rspec-system-puppet', :require => false - gem 'rspec-system-serverspec', :require => false -end - -if puppetversion = ENV['PUPPET_GEM_VERSION'] - gem 'puppet', puppetversion, :require => false -else - gem 'puppet', :require => false -end diff --git a/custom_zulip_files/puppet/apt/Gemfile.lock b/custom_zulip_files/puppet/apt/Gemfile.lock deleted file mode 100644 index 9932e16..0000000 --- a/custom_zulip_files/puppet/apt/Gemfile.lock +++ /dev/null @@ -1,70 +0,0 @@ -GEM - remote: https://rubygems.org/ - specs: - builder (3.2.2) - diff-lcs (1.2.4) - facter (1.6.18) - hiera (1.0.0) - highline (1.6.19) - kwalify (0.7.2) - metaclass (0.0.1) - mocha (0.14.0) - metaclass (~> 0.0.1) - net-scp (1.1.2) - net-ssh (>= 2.6.5) - net-ssh (2.7.0) - nokogiri (1.5.10) - puppet (3.0.2) - facter (~> 1.6.11) - hiera (~> 1.0.0) - puppetlabs_spec_helper (0.4.1) - mocha (>= 0.10.5) - rake - rspec (>= 2.9.0) - rspec-puppet (>= 0.1.1) - rake (10.1.0) - rbvmomi (1.6.0) - builder - nokogiri (>= 1.4.1) - trollop - rspec (2.14.1) - rspec-core (~> 2.14.0) - rspec-expectations (~> 2.14.0) - rspec-mocks (~> 2.14.0) - rspec-core (2.14.5) - rspec-expectations (2.14.3) - diff-lcs (>= 1.1.3, < 2.0) - rspec-mocks (2.14.3) - rspec-puppet (0.1.6) - rspec - rspec-system (2.3.0) - kwalify (~> 0.7.2) - net-scp (~> 1.1) - net-ssh (~> 2.6) - nokogiri (~> 1.5.9) - rbvmomi (~> 1.6) - rspec (~> 2.13) - systemu (~> 2.5) - rspec-system-puppet (2.2.0) - rspec-system (~> 2.0) - rspec-system-serverspec (1.0.1) - rspec-system (~> 2.0) - serverspec (~> 0.0) - serverspec (0.10.5) - highline - net-ssh - rspec (>= 2.13.0) - systemu (2.5.2) - trollop (2.0) - -PLATFORMS - ruby - -DEPENDENCIES - puppet (~> 3.0.0) - puppetlabs_spec_helper - rake - rspec-puppet - rspec-system - rspec-system-puppet - rspec-system-serverspec diff --git a/custom_zulip_files/puppet/apt/LICENSE b/custom_zulip_files/puppet/apt/LICENSE deleted file mode 100644 index 638c347..0000000 --- a/custom_zulip_files/puppet/apt/LICENSE +++ /dev/null @@ -1,19 +0,0 @@ -Copyright (c) 2011 Evolving Web Inc. - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/custom_zulip_files/puppet/apt/Modulefile b/custom_zulip_files/puppet/apt/Modulefile deleted file mode 100644 index 72aa142..0000000 --- a/custom_zulip_files/puppet/apt/Modulefile +++ /dev/null @@ -1,14 +0,0 @@ -name 'puppetlabs-apt' -version '1.4.0' -source 'https://github.com/puppetlabs/puppetlabs-apt' -author 'Evolving Web / Puppet Labs' -license 'Apache License 2.0' -summary 'Puppet Labs Apt Module' -description 'APT Module for Puppet' -project_page 'https://github.com/puppetlabs/puppetlabs-apt' - -## Add dependencies, if any: -#dependency 'puppetlabs/stdlib', '2.x' -# The dependency should be written as above but librarian-puppet -# does not support the expression as the PMT does. -dependency 'puppetlabs/stdlib', '>= 2.2.1' diff --git a/custom_zulip_files/puppet/apt/README.md b/custom_zulip_files/puppet/apt/README.md deleted file mode 100644 index 2ce5340..0000000 --- a/custom_zulip_files/puppet/apt/README.md +++ /dev/null @@ -1,226 +0,0 @@ -apt -=== - -[![Build Status](https://travis-ci.org/puppetlabs/puppetlabs-apt.png?branch=master)](https://travis-ci.org/puppetlabs/puppetlabs-apt) - -## Description -Provides helpful definitions for dealing with Apt. -======= -Overview --------- - -The APT module provides a simple interface for managing APT source, key, and definitions with Puppet. - -Module Description ------------------- - -APT automates obtaining and installing software packages on *nix systems. - -Setup ------ - -**What APT affects:** - -* package/service/configuration files for APT -* your system's `sources.list` file and `sources.list.d` directory - * NOTE: Setting the `purge_sources_list` and `purge_sources_list_d` parameters to 'true' will destroy any existing content that was not declared with Puppet. The default for these parameters is 'false'. -* system repositories -* authentication keys -* wget (optional) - -###Beginning with APT - -To begin using the APT module with default parameters, declare the class - - class { 'apt': } - -Puppet code that uses anything from the APT module requires that the core apt class be declared. - -Usage ------ - -Using the APT module consists predominantly in declaring classes that provide desired functionality and features. - -###apt - -`apt` provides a number of common resources and options that are shared by the various defined types in this module, so you MUST always include this class in your manifests. - -The parameters for `apt` are not required in general and are predominantly for development environment use-cases. - - class { 'apt': - always_apt_update => false, - disable_keys => undef, - proxy_host => false, - proxy_port => '8080', - purge_sources_list => false, - purge_sources_list_d => false, - purge_preferences_d => false, - update_timeout => undef - } - -Puppet will manage your system's `sources.list` file and `sources.list.d` directory but will do its best to respect existing content. - -If you declare your apt class with `purge_sources_list` and `purge_sources_list_d` set to 'true', Puppet will unapologetically purge any existing content it finds that wasn't declared with Puppet. - -###apt::builddep - -Installs the build depends of a specified package. - - apt::builddep { 'glusterfs-server': } - -###apt::force - -Forces a package to be installed from a specific release. This class is particularly useful when using repositories, like Debian, that are unstable in Ubuntu. - - apt::force { 'glusterfs-server': - release => 'unstable', - version => '3.0.3', - require => Apt::Source['debian_unstable'], - } - -###apt::key - -Adds a key to the list of keys used by APT to authenticate packages. - - apt::key { 'puppetlabs': - key => '4BD6EC30', - key_server => 'pgp.mit.edu', - } - - apt::key { 'jenkins': - key => 'D50582E6', - key_source => 'http://pkg.jenkins-ci.org/debian/jenkins-ci.org.key', - } - -Note that use of `key_source` requires wget to be installed and working. - -###apt::pin - -Adds an apt pin for a certain release. - - apt::pin { 'karmic': priority => 700 } - apt::pin { 'karmic-updates': priority => 700 } - apt::pin { 'karmic-security': priority => 700 } - -Note you can also specifying more complex pins using distribution properties. - - apt::pin { 'stable': - priority => -10, - originator => 'Debian', - release_version => '3.0', - component => 'main', - label => 'Debian' - } - -###apt::ppa - -Adds a ppa repository using `add-apt-repository`. - - apt::ppa { 'ppa:drizzle-developers/ppa': } - -###apt::release - -Sets the default apt release. This class is particularly useful when using repositories, like Debian, that are unstable in Ubuntu. - - class { 'apt::release': - release_id => 'precise', - } - -###apt::source - -Adds an apt source to `/etc/apt/sources.list.d/`. - - apt::source { 'debian_unstable': - location => 'http://debian.mirror.iweb.ca/debian/', - release => 'unstable', - repos => 'main contrib non-free', - required_packages => 'debian-keyring debian-archive-keyring', - key => '55BE302B', - key_server => 'subkeys.pgp.net', - pin => '-10', - include_src => true - } - -If you would like to configure your system so the source is the Puppet Labs APT repository - - apt::source { 'puppetlabs': - location => 'http://apt.puppetlabs.com', - repos => 'main', - key => '4BD6EC30', - key_server => 'pgp.mit.edu', - } - -###Testing - -The APT module is mostly a collection of defined resource types, which provide reusable logic that can be leveraged to manage APT. It does provide smoke tests for testing functionality on a target system, as well as spec tests for checking a compiled catalog against an expected set of resources. - -####Example Test - -This test will set up a Puppet Labs apt repository. Start by creating a new smoke test in the apt module's test folder. Call it puppetlabs-apt.pp. Inside, declare a single resource representing the Puppet Labs APT source and gpg key - - apt::source { 'puppetlabs': - location => 'http://apt.puppetlabs.com', - repos => 'main', - key => '4BD6EC30', - key_server => 'pgp.mit.edu', - } - -This resource creates an apt source named puppetlabs and gives Puppet information about the repository's location and key used to sign its packages. Puppet leverages Facter to determine the appropriate release, but you can set it directly by adding the release type. - -Check your smoke test for syntax errors - - $ puppet parser validate tests/puppetlabs-apt.pp - -If you receive no output from that command, it means nothing is wrong. Then apply the code - - $ puppet apply --verbose tests/puppetlabs-apt.pp - notice: /Stage[main]//Apt::Source[puppetlabs]/File[puppetlabs.list]/ensure: defined content as '{md5}3be1da4923fb910f1102a233b77e982e' - info: /Stage[main]//Apt::Source[puppetlabs]/File[puppetlabs.list]: Scheduling refresh of Exec[puppetlabs apt update] - notice: /Stage[main]//Apt::Source[puppetlabs]/Exec[puppetlabs apt update]: Triggered 'refresh' from 1 events> - -The above example used a smoke test to easily lay out a resource declaration and apply it on your system. In production, you may want to declare your APT sources inside the classes where they’re needed. - -Implementation --------------- - -###apt::backports - -Adds the necessary components to get backports for Ubuntu and Debian. The release name defaults to `$lsbdistcodename`. Setting this manually can cause undefined behavior (read: universe exploding). - -Limitations ------------ - -This module should work across all versions of Debian/Ubuntu and support all major APT repository management features. - -Development ------------- - -Puppet Labs modules on the Puppet Forge are open projects, and community contributions are essential for keeping them great. We can’t access the huge number of platforms and myriad of hardware, software, and deployment configurations that Puppet is intended to serve. - -We want to keep it as easy as possible to contribute changes so that our modules work in your environment. There are a few guidelines that we need contributors to follow so that we can have a chance of keeping on top of things. - -You can read the complete module contribution guide [on the Puppet Labs wiki.](http://projects.puppetlabs.com/projects/module-site/wiki/Module_contributing) - -Contributors ------------- - -A lot of great people have contributed to this module. A somewhat current list follows: - -* Ben Godfrey -* Branan Purvine-Riley -* Christian G. Warden -* Dan Bode -* Garrett Honeycutt -* Jeff Wallace -* Ken Barber -* Matthaus Litteken -* Matthias Pigulla -* Monty Taylor -* Peter Drake -* Reid Vandewiele -* Robert Navarro -* Ryan Coleman -* Scott McLeod -* Spencer Krum -* William Van Hevelingen -* Zach Leslie diff --git a/custom_zulip_files/puppet/apt/Rakefile b/custom_zulip_files/puppet/apt/Rakefile deleted file mode 100644 index bb60173..0000000 --- a/custom_zulip_files/puppet/apt/Rakefile +++ /dev/null @@ -1,2 +0,0 @@ -require 'puppetlabs_spec_helper/rake_tasks' -require 'rspec-system/rake_task' diff --git a/custom_zulip_files/puppet/apt/manifests/backports.pp b/custom_zulip_files/puppet/apt/manifests/backports.pp deleted file mode 100644 index e9180c4..0000000 --- a/custom_zulip_files/puppet/apt/manifests/backports.pp +++ /dev/null @@ -1,48 +0,0 @@ -# This adds the necessary components to get backports for ubuntu and debian -# -# == Parameters -# -# [*release*] -# The ubuntu/debian release name. Defaults to $lsbdistcodename. Setting this -# manually can cause undefined behavior. (Read: universe exploding) -# -# == Examples -# -# include apt::backports -# -# class { 'apt::backports': -# release => 'natty', -# } -# -# == Authors -# -# Ben Hughes, I think. At least blame him if this goes wrong. -# I just added puppet doc. -# -# == Copyright -# -# Copyright 2011 Puppet Labs Inc, unless otherwise noted. -class apt::backports( - $release = $::lsbdistcodename, - $location = $apt::params::backports_location -) inherits apt::params { - - $release_real = downcase($release) - $key = $::lsbdistid ? { - 'debian' => '55BE302B', - 'ubuntu' => '437D05B5', - } - $repos = $::lsbdistid ? { - 'debian' => 'main contrib non-free', - 'ubuntu' => 'main universe multiverse restricted', - } - - apt::source { 'backports': - location => $location, - release => "${release_real}-backports", - repos => $repos, - key => $key, - key_server => 'pgp.mit.edu', - pin => '200', - } -} diff --git a/custom_zulip_files/puppet/apt/manifests/builddep.pp b/custom_zulip_files/puppet/apt/manifests/builddep.pp deleted file mode 100644 index 3294f71..0000000 --- a/custom_zulip_files/puppet/apt/manifests/builddep.pp +++ /dev/null @@ -1,16 +0,0 @@ -# builddep.pp - -define apt::builddep() { - include apt::update - - exec { "apt-builddep-${name}": - command => "/usr/bin/apt-get -y --force-yes build-dep ${name}", - logoutput => 'on_failure', - notify => Exec['apt_update'], - } - - # Need anchor to provide containment for dependencies. - anchor { "apt::builddep::${name}": - require => Class['apt::update'], - } -} diff --git a/custom_zulip_files/puppet/apt/manifests/conf.pp b/custom_zulip_files/puppet/apt/manifests/conf.pp deleted file mode 100644 index 3c4cb19..0000000 --- a/custom_zulip_files/puppet/apt/manifests/conf.pp +++ /dev/null @@ -1,18 +0,0 @@ -define apt::conf ( - $content, - $ensure = present, - $priority = '50' -) { - - include apt::params - - $apt_conf_d = $apt::params::apt_conf_d - - file { "${apt_conf_d}/${priority}${name}": - ensure => $ensure, - content => $content, - owner => root, - group => root, - mode => '0644', - } -} diff --git a/custom_zulip_files/puppet/apt/manifests/debian/testing.pp b/custom_zulip_files/puppet/apt/manifests/debian/testing.pp deleted file mode 100644 index 4513347..0000000 --- a/custom_zulip_files/puppet/apt/manifests/debian/testing.pp +++ /dev/null @@ -1,21 +0,0 @@ -# testing.pp - -class apt::debian::testing { - include apt - - # deb http://debian.mirror.iweb.ca/debian/ testing main contrib non-free - # deb-src http://debian.mirror.iweb.ca/debian/ testing main contrib non-free - # Key: 55BE302B Server: subkeys.pgp.net - # debian-keyring - # debian-archive-keyring - - apt::source { 'debian_testing': - location => 'http://debian.mirror.iweb.ca/debian/', - release => 'testing', - repos => 'main contrib non-free', - required_packages => 'debian-keyring debian-archive-keyring', - key => '55BE302B', - key_server => 'subkeys.pgp.net', - pin => '-10', - } -} diff --git a/custom_zulip_files/puppet/apt/manifests/debian/unstable.pp b/custom_zulip_files/puppet/apt/manifests/debian/unstable.pp deleted file mode 100644 index 401c9c5..0000000 --- a/custom_zulip_files/puppet/apt/manifests/debian/unstable.pp +++ /dev/null @@ -1,21 +0,0 @@ -# unstable.pp - -class apt::debian::unstable { - include apt - - # deb http://debian.mirror.iweb.ca/debian/ unstable main contrib non-free - # deb-src http://debian.mirror.iweb.ca/debian/ unstable main contrib non-free - # Key: 55BE302B Server: subkeys.pgp.net - # debian-keyring - # debian-archive-keyring - - apt::source { 'debian_unstable': - location => 'http://debian.mirror.iweb.ca/debian/', - release => 'unstable', - repos => 'main contrib non-free', - required_packages => 'debian-keyring debian-archive-keyring', - key => '55BE302B', - key_server => 'subkeys.pgp.net', - pin => '-10', - } -} diff --git a/custom_zulip_files/puppet/apt/manifests/force.pp b/custom_zulip_files/puppet/apt/manifests/force.pp deleted file mode 100644 index 2d33e94..0000000 --- a/custom_zulip_files/puppet/apt/manifests/force.pp +++ /dev/null @@ -1,24 +0,0 @@ -# force.pp -# force a package from a specific release - -define apt::force( - $release = 'testing', - $version = false, - $timeout = 300 -) { - - $version_string = $version ? { - false => undef, - default => "=${version}", - } - - $install_check = $version ? { - false => "/usr/bin/dpkg -s ${name} | grep -q 'Status: install'", - default => "/usr/bin/dpkg -s ${name} | grep -q 'Version: ${version}'", - } - exec { "/usr/bin/apt-get -y -t ${release} install ${name}${version_string}": - unless => $install_check, - logoutput => 'on_failure', - timeout => $timeout, - } -} diff --git a/custom_zulip_files/puppet/apt/manifests/init.pp b/custom_zulip_files/puppet/apt/manifests/init.pp deleted file mode 100644 index b106ad4..0000000 --- a/custom_zulip_files/puppet/apt/manifests/init.pp +++ /dev/null @@ -1,121 +0,0 @@ -# Class: apt -# -# This module manages the initial configuration of apt. -# -# Parameters: -# The parameters listed here are not required in general and were -# added for use cases related to development environments. -# disable_keys - disables the requirement for all packages to be signed -# always_apt_update - rather apt should be updated on every run (intended -# for development environments where package updates are frequent) -# purge_sources_list - Accepts true or false. Defaults to false If set to -# true, Puppet will purge all unmanaged entries from sources.list -# purge_sources_list_d - Accepts true or false. Defaults to false. If set -# to true, Puppet will purge all unmanaged entries from sources.list.d -# update_timeout - Overrides the exec timeout in seconds for apt-get update. -# If not set defaults to Exec's default (300) -# -# Actions: -# -# Requires: -# puppetlabs/stdlib -# Sample Usage: -# class { 'apt': } - -class apt( - $always_apt_update = false, - $disable_keys = undef, - $proxy_host = false, - $proxy_port = '8080', - $purge_sources_list = false, - $purge_sources_list_d = false, - $purge_preferences_d = false, - $update_timeout = undef -) { - - include apt::params - include apt::update - - validate_bool($purge_sources_list, $purge_sources_list_d, $purge_preferences_d) - - $sources_list_content = $purge_sources_list ? { - false => undef, - true => "# Repos managed by puppet.\n", - } - - if $always_apt_update == true { - Exec <| title=='apt_update' |> { - refreshonly => false, - } - } - - $root = $apt::params::root - $apt_conf_d = $apt::params::apt_conf_d - $sources_list_d = $apt::params::sources_list_d - $preferences_d = $apt::params::preferences_d - $provider = $apt::params::provider - - file { 'sources.list': - ensure => present, - path => "${root}/sources.list", - owner => root, - group => root, - mode => '0644', - content => $sources_list_content, - notify => Exec['apt_update'], - } - - file { 'sources.list.d': - ensure => directory, - path => $sources_list_d, - owner => root, - group => root, - purge => $purge_sources_list_d, - recurse => $purge_sources_list_d, - notify => Exec['apt_update'], - } - - file { 'preferences.d': - ensure => directory, - path => $preferences_d, - owner => root, - group => root, - purge => $purge_preferences_d, - recurse => $purge_preferences_d, - } - - case $disable_keys { - true: { - file { '99unauth': - ensure => present, - content => "APT::Get::AllowUnauthenticated 1;\n", - path => "${apt_conf_d}/99unauth", - } - } - false: { - file { '99unauth': - ensure => absent, - path => "${apt_conf_d}/99unauth", - } - } - undef: { } # do nothing - default: { fail('Valid values for disable_keys are true or false') } - } - - $proxy_set = $proxy_host ? { - false => absent, - default => present - } - - file { 'configure-apt-proxy': - ensure => $proxy_set, - path => "${apt_conf_d}/proxy", - content => "Acquire::http::Proxy \"http://${proxy_host}:${proxy_port}\";", - notify => Exec['apt_update'], - } - - # Need anchor to provide containment for dependencies. - anchor { 'apt::update': - require => Class['apt::update'], - } -} diff --git a/custom_zulip_files/puppet/apt/manifests/key.pp b/custom_zulip_files/puppet/apt/manifests/key.pp deleted file mode 100644 index c78bf65..0000000 --- a/custom_zulip_files/puppet/apt/manifests/key.pp +++ /dev/null @@ -1,90 +0,0 @@ -define apt::key ( - $key = $title, - $ensure = present, - $key_content = false, - $key_source = false, - $key_server = 'keyserver.ubuntu.com', - $key_options = false -) { - - include apt::params - - $upkey = upcase($key) - # trim the key to the last 8 chars so we can match longer keys with apt-key list too - $trimmedkey = regsubst($upkey, '^.*(.{8})$', '\1') - - if $key_content { - $method = 'content' - } elsif $key_source { - $method = 'source' - } elsif $key_server { - $method = 'server' - } - - # This is a hash of the parts of the key definition that we care about. - # It is used as a unique identifier for this instance of apt::key. It gets - # hashed to ensure that the resource name doesn't end up being pages and - # pages (e.g. in the situation where key_content is specified). - $digest = sha1("${upkey}/${key_content}/${key_source}/${key_server}/") - - # Allow multiple ensure => present for the same key to account for many - # apt::source resources that all reference the same key. - case $ensure { - present: { - - anchor { "apt::key/${title}": } - - if defined(Exec["apt::key ${upkey} absent"]) { - fail("Cannot ensure Apt::Key[${upkey}] present; ${upkey} already ensured absent") - } - - if !defined(Anchor["apt::key ${upkey} present"]) { - anchor { "apt::key ${upkey} present": } - } - - if $key_options{ - $options_string = "--keyserver-options ${key_options}" - } - else{ - $options_string = '' - } - - if !defined(Exec[$digest]) { - $digest_command = $method ? { - 'content' => "echo '${key_content}' | /usr/bin/apt-key add -", - 'source' => "wget -q '${key_source}' -O- | apt-key add -", - 'server' => "apt-key adv --keyserver '${key_server}' ${options_string} --recv-keys '${upkey}'", - } - exec { $digest: - command => $digest_command, - path => '/bin:/usr/bin', - unless => "/usr/bin/apt-key list | /bin/grep '${trimmedkey}'", - logoutput => 'on_failure', - before => Anchor["apt::key ${upkey} present"], - } - } - - Anchor["apt::key ${upkey} present"] -> Anchor["apt::key/${title}"] - - } - absent: { - - if defined(Anchor["apt::key ${upkey} present"]) { - fail("Cannot ensure Apt::Key[${upkey}] absent; ${upkey} already ensured present") - } - - exec { "apt::key ${upkey} absent": - command => "apt-key del '${upkey}'", - path => '/bin:/usr/bin', - onlyif => "apt-key list | grep '${trimmedkey}'", - user => 'root', - group => 'root', - logoutput => 'on_failure', - } - } - - default: { - fail "Invalid 'ensure' value '${ensure}' for aptkey" - } - } -} diff --git a/custom_zulip_files/puppet/apt/manifests/params.pp b/custom_zulip_files/puppet/apt/manifests/params.pp deleted file mode 100644 index 955954f..0000000 --- a/custom_zulip_files/puppet/apt/manifests/params.pp +++ /dev/null @@ -1,33 +0,0 @@ -class apt::params { - $root = '/etc/apt' - $provider = '/usr/bin/apt-get' - $sources_list_d = "${root}/sources.list.d" - $apt_conf_d = "${root}/apt.conf.d" - $preferences_d = "${root}/preferences.d" - - case $::lsbdistid { - 'debian': { - case $::lsbdistcodename { - 'squeeze': { - $backports_location = 'http://backports.debian.org/debian-backports' - } - 'wheezy': { - $backports_location = 'http://ftp.debian.org/debian/' - } - default: { - $backports_location = 'http://http.debian.net/debian/' - } - } - } - 'ubuntu': { - case $::lsbdistcodename { - 'hardy','lucid','maverick','natty','oneiric','precise': { - $backports_location = 'http://us.archive.ubuntu.com/ubuntu' - } - default: { - $backports_location = 'http://old-releases.ubuntu.com/ubuntu' - } - } - } - } -} diff --git a/custom_zulip_files/puppet/apt/manifests/pin.pp b/custom_zulip_files/puppet/apt/manifests/pin.pp deleted file mode 100644 index 402e79e..0000000 --- a/custom_zulip_files/puppet/apt/manifests/pin.pp +++ /dev/null @@ -1,73 +0,0 @@ -# pin.pp -# pin a release in apt, useful for unstable repositories - -define apt::pin( - $ensure = present, - $explanation = "${::caller_module_name}: ${name}", - $order = '', - $packages = '*', - $priority = 0, - $release = '', # a= - $origin = '', - $version = '', - $codename = '', # n= - $release_version = '', # v= - $component = '', # c= - $originator = '', # o= - $label = '' # l= -) { - - include apt::params - - $preferences_d = $apt::params::preferences_d - - if $order != '' and !is_integer($order) { - fail('Only integers are allowed in the apt::pin order param') - } - - $pin_release_array = [ - $release, - $codename, - $release_version, - $component, - $originator, - $label] - $pin_release = join($pin_release_array, '') - - # Read the manpage 'apt_preferences(5)', especially the chapter - # 'Thea Effect of APT Preferences' to understand the following logic - # and the difference between specific and general form - if $packages != '*' { # specific form - - if ( $pin_release != '' and ( $origin != '' or $version != '' )) or - ( $origin != '' and ( $pin_release != '' or $version != '' )) or - ( $version != '' and ( $pin_release != '' or $origin != '' )) { - fail('parameters release, origin, and version are mutually exclusive') - } - - } else { # general form - - if $version != '' { - fail('parameter version cannot be used in general form') - } - - if ( $pin_release != '' and $origin != '' ) or - ( $origin != '' and $pin_release != '' ) { - fail('parmeters release and origin are mutually exclusive') - } - - } - - $path = $order ? { - '' => "${preferences_d}/${name}.pref", - default => "${preferences_d}/${order}-${name}.pref", - } - file { "${name}.pref": - ensure => $ensure, - path => $path, - owner => root, - group => root, - mode => '0644', - content => template('apt/pin.pref.erb'), - } -} diff --git a/custom_zulip_files/puppet/apt/manifests/ppa.pp b/custom_zulip_files/puppet/apt/manifests/ppa.pp deleted file mode 100644 index 7cb88c8..0000000 --- a/custom_zulip_files/puppet/apt/manifests/ppa.pp +++ /dev/null @@ -1,63 +0,0 @@ -# ppa.pp - -define apt::ppa( - $release = $::lsbdistcodename, - $options = '-y' -) { - include apt::params - include apt::update - - $sources_list_d = $apt::params::sources_list_d - - if ! $release { - fail('lsbdistcodename fact not available: release parameter required') - } - - $filename_without_slashes = regsubst($name, '/', '-', 'G') - $filename_without_dots = regsubst($filename_without_slashes, '\.', '_', 'G') - $filename_without_ppa = regsubst($filename_without_dots, '^ppa:', '', 'G') - $sources_list_d_filename = "${filename_without_ppa}-${release}.list" - - $package = $::lsbdistrelease ? { - /^[1-9]\..*|1[01]\..*|12.04$/ => 'python-software-properties', - default => 'software-properties-common', - } - - if ! defined(Package[$package]) { - package { $package: } - } - - if defined(Class[apt]) { - $proxy_host = getparam(Class[apt], 'proxy_host') - $proxy_port = getparam(Class[apt], 'proxy_port') - case $proxy_host { - false, '': { - $proxy_env = [] - } - default: {$proxy_env = ["http_proxy=http://${proxy_host}:${proxy_port}", "https_proxy=http://${proxy_host}:${proxy_port}"]} - } - } else { - $proxy_env = [] - } - exec { "add-apt-repository-${name}": - environment => $proxy_env, - command => "/usr/bin/add-apt-repository ${options} ${name}", - unless => "/usr/bin/test -s ${sources_list_d}/${sources_list_d_filename}", - logoutput => 'on_failure', - notify => Exec['apt_update'], - require => [ - File[$sources_list_d], - Package[$package], - ], - } - - file { "${sources_list_d}/${sources_list_d_filename}": - ensure => file, - require => Exec["add-apt-repository-${name}"], - } - - # Need anchor to provide containment for dependencies. - anchor { "apt::ppa::${name}": - require => Class['apt::update'], - } -} diff --git a/custom_zulip_files/puppet/apt/manifests/release.pp b/custom_zulip_files/puppet/apt/manifests/release.pp deleted file mode 100644 index 6e0a38f..0000000 --- a/custom_zulip_files/puppet/apt/manifests/release.pp +++ /dev/null @@ -1,17 +0,0 @@ -# release.pp - -class apt::release ( - $release_id -) { - - include apt::params - - $root = $apt::params::root - - file { "${root}/apt.conf.d/01release": - owner => root, - group => root, - mode => '0644', - content => "APT::Default-Release \"${release_id}\";" - } -} diff --git a/custom_zulip_files/puppet/apt/manifests/source.pp b/custom_zulip_files/puppet/apt/manifests/source.pp deleted file mode 100644 index 713c7e9..0000000 --- a/custom_zulip_files/puppet/apt/manifests/source.pp +++ /dev/null @@ -1,85 +0,0 @@ -# source.pp -# add an apt source - -define apt::source( - $ensure = present, - $location = '', - $release = 'UNDEF', - $repos = 'main', - $include_src = true, - $required_packages = false, - $key = false, - $key_server = 'keyserver.ubuntu.com', - $key_content = false, - $key_source = false, - $pin = false, - $architecture = undef -) { - - include apt::params - include apt::update - - $sources_list_d = $apt::params::sources_list_d - $provider = $apt::params::provider - - if $release == 'UNDEF' { - if $::lsbdistcodename == undef { - fail('lsbdistcodename fact not available: release parameter required') - } else { - $release_real = $::lsbdistcodename - } - } else { - $release_real = $release - } - - file { "${name}.list": - ensure => $ensure, - path => "${sources_list_d}/${name}.list", - owner => root, - group => root, - mode => '0644', - content => template("${module_name}/source.list.erb"), - notify => Exec['apt_update'], - } - - - if ($pin != false) { - # Get the host portion out of the url so we can pin to origin - $url_split = split($location, '/') - $host = $url_split[2] - - apt::pin { $name: - ensure => $ensure, - priority => $pin, - before => File["${name}.list"], - origin => $host, - } - } - - if ($required_packages != false) and ($ensure == 'present') { - exec { "Required packages: '${required_packages}' for ${name}": - command => "${provider} -y install ${required_packages}", - logoutput => 'on_failure', - refreshonly => true, - subscribe => File["${name}.list"], - before => Exec['apt_update'], - } - } - - # We do not want to remove keys when the source is absent. - if ($key != false) and ($ensure == 'present') { - apt::key { "Add key: ${key} from Apt::Source ${title}": - ensure => present, - key => $key, - key_server => $key_server, - key_content => $key_content, - key_source => $key_source, - before => File["${name}.list"], - } - } - - # Need anchor to provide containment for dependencies. - anchor { "apt::source::${name}": - require => Class['apt::update'], - } -} diff --git a/custom_zulip_files/puppet/apt/manifests/unattended_upgrades.pp b/custom_zulip_files/puppet/apt/manifests/unattended_upgrades.pp deleted file mode 100644 index f006bd5..0000000 --- a/custom_zulip_files/puppet/apt/manifests/unattended_upgrades.pp +++ /dev/null @@ -1,68 +0,0 @@ -# Class: apt::unattended_upgrades -# -# This class manages the unattended-upgrades package and related configuration -# files for ubuntu -# -# origins are the repositories to automatically upgrade included packages -# blacklist is a list of packages to not automatically upgrade -# update is how often to run "apt-get update" in days -# download is how often to run "apt-get upgrade --download-only" in days -# upgrade is how often to upgrade packages included in the origins list in days -# autoclean is how often to run "apt-get autoclean" in days -# -# information on the other options can be found in the 50unattended-upgrades -# file and in /etc/cron.daily/apt -# -class apt::unattended_upgrades ( - $origins = ['${distro_id}:${distro_codename}-security'], - $blacklist = [], - $update = "1", - $download = "1", - $upgrade = "1", - $autoclean = "7", - $auto_fix = true, - $minimal_steps = false, - $install_on_shutdown = false, - $mail_to = "NONE", - $mail_only_on_error = false, - $remove_unused = true, - $auto_reboot = false, - $dl_limit = "NONE", - $enable = "1", - $backup_interval = "0", - $backup_level = "3", - $max_age = "0", - $min_age = "0", - $max_size = "0", - $download_delta = "0", - $verbose = "0", -) { - - validate_bool( - $auto_fix, - $minimal_steps, - $install_on_shutdown, - $mail_only_on_error, - $remove_unused, - $auto_reboot - ) - - package { 'unattended-upgrades': - ensure => present, - } - - File { - ensure => file, - owner => 'root', - group => 'root', - mode => '0644', - require => Package['unattended-upgrades'], - } - - file { - '/etc/apt/apt.conf.d/50unattended-upgrades': - content => template('apt/50unattended-upgrades.erb'); - '/etc/apt/apt.conf.d/10periodic': - content => template('apt/10periodic.erb'); - } -} diff --git a/custom_zulip_files/puppet/apt/manifests/update.pp b/custom_zulip_files/puppet/apt/manifests/update.pp deleted file mode 100644 index ce0b78f..0000000 --- a/custom_zulip_files/puppet/apt/manifests/update.pp +++ /dev/null @@ -1,10 +0,0 @@ -class apt::update { - include apt::params - - exec { 'apt_update': - command => "${apt::params::provider} update", - logoutput => 'on_failure', - refreshonly => true, - timeout => $apt::update_timeout, - } -} diff --git a/custom_zulip_files/puppet/apt/metadata.json b/custom_zulip_files/puppet/apt/metadata.json deleted file mode 100644 index 3e4c992..0000000 --- a/custom_zulip_files/puppet/apt/metadata.json +++ /dev/null @@ -1,87 +0,0 @@ -{ - "name": "puppetlabs-apt", - "version": "1.4.0", - "summary": "Puppet Labs Apt Module", - "author": "Evolving Web / Puppet Labs", - "description": "APT Module for Puppet", - "dependencies": [ - { - "name": "puppetlabs/stdlib", - "version_requirement": "\u003e\u003d 2.2.1" - } - ], - "types": [], - "checksums": { - ".bundle/config": "7f1c988748783d2a8d455376eed1470c", - ".fixtures.yml": "0c43f56b0bb8e8d04e8051a0e7aa37a5", - ".forge-release/pom.xml": "c650a84961ad88de03192e23b63b3549", - ".forge-release/publish": "1c1d6dd64ef52246db485eb5459aa941", - ".forge-release/settings.xml": "06d768a57d582fe1ee078b563427e750", - ".forge-release/validate": "7fffde8112f42a1ec986d49ba80ac219", - ".nodeset.yml": "78d78c172336a387a1067464434ffbcb", - ".travis.yml": "782420dcc9d6412c79c30f03b1f3613c", - "CHANGELOG": "f5488e1e891a8f8c47143dac790ddab3", - "Gemfile": "1bfa7eb6e30346c9ddb4a8b144b0d255", - "Gemfile.lock": "8ff8bc3d32bb7412bd97e48190a93b2f", - "LICENSE": "20bcc606fc61ffba2b8cea840e8dce4d", - "Modulefile": "b34e93626fbc137cbb651952e7509839", - "README.md": "65176b395f7202fe5d222ae7b0de4e05", - "Rakefile": "0428ea3759a4692c91604396c406a9c1", - "manifests/backports.pp": "09f1d86603d0f44a2169acb3eeea2a70", - "manifests/builddep.pp": "4f313b5140c84aa7d5793b5a073c30dd", - "manifests/conf.pp": "5ddf258195d414d93284dfd281a8d6e3", - "manifests/debian/testing.pp": "aeb625bacb6a8df46c864ee9ee1cb5a5", - "manifests/debian/unstable.pp": "108038596b05dc1d28975884693f73f5", - "manifests/force.pp": "cf871e869f4114f32ab164de2a67e7e2", - "manifests/init.pp": "5ec106a7a03313c544159a9a1f6b78e6", - "manifests/key.pp": "3cf082ed91a3933ab7218d1be3464f4f", - "manifests/params.pp": "ca4ce3730a65c43f884ab3e6445f1661", - "manifests/pin.pp": "dea8cbaabc37010ce25838080608802b", - "manifests/ppa.pp": "754a83944ae79b5001fc0c0a8c775985", - "manifests/release.pp": "427f3ee70a6a1e55fa291e58655bd5d9", - "manifests/source.pp": "6eab8d33c173a066f5dec8474efdedb6", - "manifests/unattended_upgrades.pp": "e97f908b42010ff9a85be4afd2c721ab", - "manifests/update.pp": "436c79f160f2cb603710795a9ec71ac7", - "spec/classes/apt_spec.rb": "54841b04b42026770ed6d744a82c55df", - "spec/classes/backports_spec.rb": "7d2454a881cc26edd3dcd3acb7ffd20f", - "spec/classes/debian_testing_spec.rb": "fad1384cb9d3c99b2663d7df4762dc0e", - "spec/classes/debian_unstable_spec.rb": "11131efffd18db3c96e2bbe3d98a2fb7", - "spec/classes/params_spec.rb": "a25396d3f0bbac784a7951f03ad7e8f4", - "spec/classes/release_spec.rb": "d8f01a3cf0c2f6f6952b835196163ce4", - "spec/classes/unattended_upgrades_spec.rb": "a2e206bda79d24cdb43312d035eff66f", - "spec/defines/builddep_spec.rb": "e1300bb4f3abbd34029b11d8b733a6e5", - "spec/defines/conf_spec.rb": "b7fc9fb6cb270c276aacbfa4a43f228c", - "spec/defines/force_spec.rb": "97098c5b123be49e321e71cda288fe53", - "spec/defines/key_spec.rb": "7800c30647b1ddf799b991110109cba0", - "spec/defines/pin_spec.rb": "c912e59e9e3d1145280d659cccabe72b", - "spec/defines/ppa_spec.rb": "72ce037a1d6ea0a33f369b1f3d98b3d6", - "spec/defines/source_spec.rb": "e553bb9598dbe2becba6ae7f91d4deb0", - "spec/spec_helper.rb": "0db89c9a486df193c0e40095422e19dc", - "spec/spec_helper_system.rb": "e67d2574baae312f1095f90d78fdf5e9", - "spec/system/apt_builddep_spec.rb": "97be5a48d2d16d96cb7c35ccdbcdcb69", - "spec/system/apt_key_spec.rb": "098835d0c53c69390d4c3b6ea8ef3815", - "spec/system/apt_ppa_spec.rb": "c96f6d0bbdafac39beaf0d5e6eba9010", - "spec/system/apt_source_spec.rb": "df5aa98b03688884903c564bb507469f", - "spec/system/basic_spec.rb": "0a5b33d18254bedcb7886e34846ebff6", - "spec/system/class_spec.rb": "2ba4265236f00685c23cb00f908defc1", - "templates/10periodic.erb": "2aeea866a39f19a62254abbb4f1bc59d", - "templates/50unattended-upgrades.erb": "ae995ade214fdaefab51d335c85819ae", - "templates/pin.pref.erb": "623249839cee7788fa0805a3474396db", - "templates/source.list.erb": "65a016e60daf065c481f3d5f2c883324", - "tests/builddep.pp": "4773f57072111e58f2ed833fa4489a88", - "tests/debian/testing.pp": "1cbee56baddd6a91d981db8fddec70fb", - "tests/debian/unstable.pp": "4b2a090afeb315752262386f4dbcd8ca", - "tests/force.pp": "2bb6cf0b3d655cb51f95aeb79035e600", - "tests/init.pp": "551138eb704e71ab3687932dda429a81", - "tests/key.pp": "371a695e1332d51a38e283a87be52798", - "tests/params.pp": "900db40f3fc84b0be173278df2ebff35", - "tests/pin.pp": "4b4c3612d75a19dba8eb7227070fa4ab", - "tests/ppa.pp": "b902cce8159128b5e8b21bed540743ff", - "tests/release.pp": "53ce5debe6fa5bee42821767599cc768", - "tests/source.pp": "9cecd9aa0dcde250fe49be9e26971a98", - "tests/unattended-upgrades.pp": "cdc853f1b58e5206c5a538621ddca161" - }, - "source": "https://github.com/puppetlabs/puppetlabs-apt", - "project_page": "https://github.com/puppetlabs/puppetlabs-apt", - "license": "Apache License 2.0" -} \ No newline at end of file diff --git a/custom_zulip_files/puppet/apt/spec/classes/apt_spec.rb b/custom_zulip_files/puppet/apt/spec/classes/apt_spec.rb deleted file mode 100644 index a66feac..0000000 --- a/custom_zulip_files/puppet/apt/spec/classes/apt_spec.rb +++ /dev/null @@ -1,133 +0,0 @@ -require 'spec_helper' -describe 'apt', :type => :class do - let :default_params do - { - :disable_keys => :undef, - :always_apt_update => false, - :purge_sources_list => false, - :purge_sources_list_d => false, - } - end - - [{}, - { - :disable_keys => true, - :always_apt_update => true, - :proxy_host => true, - :proxy_port => '3128', - :purge_sources_list => true, - :purge_sources_list_d => true, - }, - { - :disable_keys => false - } - ].each do |param_set| - describe "when #{param_set == {} ? "using default" : "specifying"} class parameters" do - let :param_hash do - default_params.merge(param_set) - end - - let :params do - param_set - end - - let :refresh_only_apt_update do - if param_hash[:always_apt_update] - false - else - true - end - end - - it { should include_class("apt::params") } - - it { - if param_hash[:purge_sources_list] - should contain_file("sources.list").with({ - 'path' => "/etc/apt/sources.list", - 'ensure' => "present", - 'owner' => "root", - 'group' => "root", - 'mode' => "0644", - "content" => "# Repos managed by puppet.\n" - }) - else - should contain_file("sources.list").with({ - 'path' => "/etc/apt/sources.list", - 'ensure' => "present", - 'owner' => "root", - 'group' => "root", - 'mode' => "0644", - 'content' => nil - }) - end - } - it { - if param_hash[:purge_sources_list_d] - should create_file("sources.list.d").with({ - 'path' => "/etc/apt/sources.list.d", - 'ensure' => "directory", - 'owner' => "root", - 'group' => "root", - 'purge' => true, - 'recurse' => true, - 'notify' => 'Exec[apt_update]' - }) - else - should create_file("sources.list.d").with({ - 'path' => "/etc/apt/sources.list.d", - 'ensure' => "directory", - 'owner' => "root", - 'group' => "root", - 'purge' => false, - 'recurse' => false, - 'notify' => 'Exec[apt_update]' - }) - end - } - - it { - should contain_exec("apt_update").with({ - 'command' => "/usr/bin/apt-get update", - 'refreshonly' => refresh_only_apt_update - }) - } - - it { - if param_hash[:disable_keys] == true - should create_file("99unauth").with({ - 'content' => "APT::Get::AllowUnauthenticated 1;\n", - 'ensure' => "present", - 'path' => "/etc/apt/apt.conf.d/99unauth" - }) - elsif param_hash[:disable_keys] == false - should create_file("99unauth").with({ - 'ensure' => "absent", - 'path' => "/etc/apt/apt.conf.d/99unauth" - }) - elsif param_hash[:disable_keys] != :undef - should_not create_file("99unauth").with({ - 'path' => "/etc/apt/apt.conf.d/99unauth" - }) - end - } - describe 'when setting a proxy' do - it { - if param_hash[:proxy_host] - should contain_file('configure-apt-proxy').with( - 'path' => '/etc/apt/apt.conf.d/proxy', - 'content' => "Acquire::http::Proxy \"http://#{param_hash[:proxy_host]}:#{param_hash[:proxy_port]}\";", - 'notify' => "Exec[apt_update]" - ) - else - should contain_file('configure-apt-proxy').with( - 'path' => '/etc/apt/apt.conf.d/proxy', - 'notify' => 'Exec[apt_update]', - 'ensure' => 'absent' - ) - end - } - end - end - end -end diff --git a/custom_zulip_files/puppet/apt/spec/classes/backports_spec.rb b/custom_zulip_files/puppet/apt/spec/classes/backports_spec.rb deleted file mode 100644 index 27c6708..0000000 --- a/custom_zulip_files/puppet/apt/spec/classes/backports_spec.rb +++ /dev/null @@ -1,71 +0,0 @@ -require 'spec_helper' -describe 'apt::backports', :type => :class do - - describe 'when turning on backports for ubuntu karmic' do - - let :facts do - { - 'lsbdistcodename' => 'Karmic', - 'lsbdistid' => 'Ubuntu' - } - end - - it { should contain_apt__source('backports').with({ - 'location' => 'http://old-releases.ubuntu.com/ubuntu', - 'release' => 'karmic-backports', - 'repos' => 'main universe multiverse restricted', - 'key' => '437D05B5', - 'key_server' => 'pgp.mit.edu', - 'pin' => '200', - }) - } - end - - describe "when turning on backports for debian squeeze" do - - let :facts do - { - 'lsbdistcodename' => 'Squeeze', - 'lsbdistid' => 'Debian', - } - end - - it { should contain_apt__source('backports').with({ - 'location' => 'http://backports.debian.org/debian-backports', - 'release' => 'squeeze-backports', - 'repos' => 'main contrib non-free', - 'key' => '55BE302B', - 'key_server' => 'pgp.mit.edu', - 'pin' => '200', - }) - } - end - - describe "when turning on backports for debian squeeze but using your own mirror" do - - let :facts do - { - 'lsbdistcodename' => 'Squeeze', - 'lsbdistid' => 'Debian' - } - end - - let :location do - 'http://mirrors.example.com/debian-backports' - end - - let :params do - { 'location' => location } - end - - it { should contain_apt__source('backports').with({ - 'location' => location, - 'release' => 'squeeze-backports', - 'repos' => 'main contrib non-free', - 'key' => '55BE302B', - 'key_server' => 'pgp.mit.edu', - 'pin' => '200', - }) - } - end -end diff --git a/custom_zulip_files/puppet/apt/spec/classes/debian_testing_spec.rb b/custom_zulip_files/puppet/apt/spec/classes/debian_testing_spec.rb deleted file mode 100644 index 6006afb..0000000 --- a/custom_zulip_files/puppet/apt/spec/classes/debian_testing_spec.rb +++ /dev/null @@ -1,14 +0,0 @@ -require 'spec_helper' -describe 'apt::debian::testing', :type => :class do - it { - should contain_apt__source("debian_testing").with({ - "location" => "http://debian.mirror.iweb.ca/debian/", - "release" => "testing", - "repos" => "main contrib non-free", - "required_packages" => "debian-keyring debian-archive-keyring", - "key" => "55BE302B", - "key_server" => "subkeys.pgp.net", - "pin" => "-10" - }) - } -end diff --git a/custom_zulip_files/puppet/apt/spec/classes/debian_unstable_spec.rb b/custom_zulip_files/puppet/apt/spec/classes/debian_unstable_spec.rb deleted file mode 100644 index 411182d..0000000 --- a/custom_zulip_files/puppet/apt/spec/classes/debian_unstable_spec.rb +++ /dev/null @@ -1,14 +0,0 @@ -require 'spec_helper' -describe 'apt::debian::unstable', :type => :class do - it { - should contain_apt__source("debian_unstable").with({ - "location" => "http://debian.mirror.iweb.ca/debian/", - "release" => "unstable", - "repos" => "main contrib non-free", - "required_packages" => "debian-keyring debian-archive-keyring", - "key" => "55BE302B", - "key_server" => "subkeys.pgp.net", - "pin" => "-10" - }) - } -end diff --git a/custom_zulip_files/puppet/apt/spec/classes/params_spec.rb b/custom_zulip_files/puppet/apt/spec/classes/params_spec.rb deleted file mode 100644 index f2790b0..0000000 --- a/custom_zulip_files/puppet/apt/spec/classes/params_spec.rb +++ /dev/null @@ -1,13 +0,0 @@ -require 'spec_helper' -describe 'apt::params', :type => :class do - let (:title) { 'my_package' } - - it { should contain_apt__params } - - # There are 4 resources in this class currently - # there should not be any more resources because it is a params class - # The resources are class[apt::params], class[main], class[settings], stage[main] - it "Should not contain any resources" do - subject.resources.size.should == 4 - end -end diff --git a/custom_zulip_files/puppet/apt/spec/classes/release_spec.rb b/custom_zulip_files/puppet/apt/spec/classes/release_spec.rb deleted file mode 100644 index d131b22..0000000 --- a/custom_zulip_files/puppet/apt/spec/classes/release_spec.rb +++ /dev/null @@ -1,22 +0,0 @@ -require 'spec_helper' -describe 'apt::release', :type => :class do - let (:title) { 'my_package' } - - let :param_set do - { :release_id => 'precise' } - end - - let (:params) { param_set } - - it { should include_class("apt::params") } - - it { - should contain_file("/etc/apt/apt.conf.d/01release").with({ - "mode" => "0644", - "owner" => "root", - "group" => "root", - "content" => "APT::Default-Release \"#{param_set[:release_id]}\";" - }) - } -end - diff --git a/custom_zulip_files/puppet/apt/spec/classes/unattended_upgrades_spec.rb b/custom_zulip_files/puppet/apt/spec/classes/unattended_upgrades_spec.rb deleted file mode 100644 index 8abc603..0000000 --- a/custom_zulip_files/puppet/apt/spec/classes/unattended_upgrades_spec.rb +++ /dev/null @@ -1,204 +0,0 @@ -require 'spec_helper' -describe 'apt::unattended_upgrades', :type => :class do - let(:file_unattended) { '/etc/apt/apt.conf.d/50unattended-upgrades' } - let(:file_periodic) { '/etc/apt/apt.conf.d/10periodic' } - - it { should contain_package("unattended-upgrades") } - - it { - should create_file("/etc/apt/apt.conf.d/50unattended-upgrades").with({ - "owner" => "root", - "group" => "root", - "mode" => "0644", - "require" => "Package[unattended-upgrades]", - }) - } - - it { - should create_file("/etc/apt/apt.conf.d/10periodic").with({ - "owner" => "root", - "group" => "root", - "mode" => "0644", - "require" => "Package[unattended-upgrades]", - }) - } - - describe "origins" do - describe "with param defaults" do - let(:params) {{ }} - it { should contain_file(file_unattended).with_content(/^Unattended-Upgrade::Allowed-Origins \{\n\t"\${distro_id}:\${distro_codename}-security";\n\};$/) } - end - - describe "with origins => ['ubuntu:precise-security']" do - let :params do - { :origins => ['ubuntu:precise-security'] } - end - it { should contain_file(file_unattended).with_content(/^Unattended-Upgrade::Allowed-Origins \{\n\t"ubuntu:precise-security";\n\};$/) } - end - end - - describe "blacklist" do - describe "with param defaults" do - let(:params) {{ }} - it { should contain_file(file_unattended).with_content(/^Unattended-Upgrade::Package-Blacklist \{\n\};$/) } - end - - describe "with blacklist => []" do - let :params do - { :blacklist => ['libc6', 'libc6-dev'] } - end - it { should contain_file(file_unattended).with_content(/^Unattended-Upgrade::Package-Blacklist \{\n\t"libc6";\n\t"libc6-dev";\n\};$/) } - end - end - - describe "with update => 2" do - let :params do - { :update => "2" } - end - it { should contain_file(file_periodic).with_content(/^APT::Periodic::Update-Package-Lists "2";$/) } - end - - describe "with download => 2" do - let :params do - { :download => "2" } - end - it { should contain_file(file_periodic).with_content(/^APT::Periodic::Download-Upgradeable-Packages "2";$/) } - end - - describe "with upgrade => 2" do - let :params do - { :upgrade => "2" } - end - it { should contain_file(file_periodic).with_content(/^APT::Periodic::Unattended-Upgrade "2";$/) } - end - - describe "with autoclean => 2" do - let :params do - { :autoclean => "2" } - end - it { should contain_file(file_periodic).with_content(/^APT::Periodic::AutocleanInterval "2";$/) } - end - - describe "with auto_fix => false" do - let :params do - { :auto_fix => false } - end - it { should contain_file(file_unattended).with_content(/^Unattended-Upgrade::AutoFixInterruptedDpkg "false";$/) } - end - - describe "with minimal_steps => true" do - let :params do - { :minimal_steps => true } - end - it { should contain_file(file_unattended).with_content(/^Unattended-Upgrade::MinimalSteps "true";$/) } - end - - describe "with install_on_shutdown => true" do - let :params do - { :install_on_shutdown => true } - end - it { should contain_file(file_unattended).with_content(/^Unattended-Upgrade::InstallOnShutdown "true";$/) } - end - - describe "mail_to" do - describe "param defaults" do - let(:params) {{ }} - it { should_not contain_file(file_unattended).with_content(/^Unattended-Upgrade::Mail /) } - it { should_not contain_file(file_unattended).with_content(/^Unattended-Upgrade::MailOnlyOnError /) } - end - - describe "with mail_to => user@website, mail_only_on_error => true" do - let :params do - { :mail_to => "user@website", - :mail_only_on_error => true } - end - it { should contain_file(file_unattended).with_content(/^Unattended-Upgrade::Mail "user@website";$/) } - it { should contain_file(file_unattended).with_content(/^Unattended-Upgrade::MailOnlyOnError "true";$/) } - end - end - - describe "with remove_unused => false" do - let :params do - { :remove_unused => false } - end - it { should contain_file(file_unattended).with_content(/^Unattended-Upgrade::Remove-Unused-Dependencies "false";$/) } - end - - describe "with auto_reboot => true" do - let :params do - { :auto_reboot => true } - end - it { should contain_file(file_unattended).with_content(/^Unattended-Upgrade::Automatic-Reboot "true";$/) } - end - - describe "dl_limit" do - describe "param defaults" do - let(:params) {{ }} - it { should_not contain_file(file_unattended).with_content(/^Acquire::http::Dl-Limit /) } - end - - describe "with dl_limit => 70" do - let :params do - { :dl_limit => "70" } - end - it { should contain_file(file_unattended).with_content(/^Acquire::http::Dl-Limit "70";$/) } - end - end - - describe "with enable => 0" do - let :params do - { :enable => "0" } - end - it { should contain_file(file_periodic).with_content(/^APT::Periodic::Enable "0";$/) } - end - - describe "with backup_interval => 1" do - let :params do - { :backup_interval => "1" } - end - it { should contain_file(file_periodic).with_content(/^APT::Periodic::BackUpArchiveInterval "1";$/) } - end - - describe "with backup_level => 0" do - let :params do - { :backup_level => "0" } - end - it { should contain_file(file_periodic).with_content(/^APT::Periodic::BackUpLevel "0";$/) } - end - - describe "with max_age => 1" do - let :params do - { :max_age => "1" } - end - it { should contain_file(file_periodic).with_content(/^APT::Periodic::MaxAge "1";$/) } - end - - describe "with min_age => 1" do - let :params do - { :min_age => "1" } - end - it { should contain_file(file_periodic).with_content(/^APT::Periodic::MinAge "1";$/) } - end - - describe "with max_size => 1" do - let :params do - { :max_size => "1" } - end - it { should contain_file(file_periodic).with_content(/^APT::Periodic::MaxSize "1";$/) } - end - - describe "with download_delta => 2" do - let :params do - { :download_delta => "2" } - end - it { should contain_file(file_periodic).with_content(/^APT::Periodic::Download-Upgradeable-Packages-Debdelta "2";$/) } - end - - describe "with verbose => 2" do - let :params do - { :verbose => "2" } - end - it { should contain_file(file_periodic).with_content(/^APT::Periodic::Verbose "2";$/) } - end - -end diff --git a/custom_zulip_files/puppet/apt/spec/defines/builddep_spec.rb b/custom_zulip_files/puppet/apt/spec/defines/builddep_spec.rb deleted file mode 100644 index 4e2b698..0000000 --- a/custom_zulip_files/puppet/apt/spec/defines/builddep_spec.rb +++ /dev/null @@ -1,18 +0,0 @@ -require 'spec_helper' -describe 'apt::builddep', :type => :define do - - let(:title) { 'my_package' } - - describe "should require apt-get update" do - it { should contain_exec("apt_update").with({ - 'command' => "/usr/bin/apt-get update", - 'refreshonly' => true - }) - } - it { should contain_anchor("apt::builddep::my_package").with({ - 'require' => 'Class[Apt::Update]', - }) - } - end - -end diff --git a/custom_zulip_files/puppet/apt/spec/defines/conf_spec.rb b/custom_zulip_files/puppet/apt/spec/defines/conf_spec.rb deleted file mode 100644 index 5a81b51..0000000 --- a/custom_zulip_files/puppet/apt/spec/defines/conf_spec.rb +++ /dev/null @@ -1,57 +0,0 @@ -require 'spec_helper' -describe 'apt::conf', :type => :define do - let :title do - 'norecommends' - end - - describe "when creating an apt preference" do - let :params do - { - :priority => '00', - :content => "Apt::Install-Recommends 0;\nApt::AutoRemove::InstallRecommends 1;\n" - } - end - - let :filename do - "/etc/apt/apt.conf.d/00norecommends" - end - - it { should contain_apt__conf('norecommends').with({ - 'priority' => '00', - 'content' => "Apt::Install-Recommends 0;\nApt::AutoRemove::InstallRecommends 1;\n" - }) - } - - it { should contain_file(filename).with({ - 'ensure' => 'present', - 'content' => "Apt::Install-Recommends 0;\nApt::AutoRemove::InstallRecommends 1;\n", - 'owner' => 'root', - 'group' => 'root', - 'mode' => '0644', - }) - } - end - - describe "when removing an apt preference" do - let :params do - { - :ensure => 'absent', - :priority => '00', - :content => "Apt::Install-Recommends 0;\nApt::AutoRemove::InstallRecommends 1;\n" - } - end - - let :filename do - "/etc/apt/apt.conf.d/00norecommends" - end - - it { should contain_file(filename).with({ - 'ensure' => 'absent', - 'content' => "Apt::Install-Recommends 0;\nApt::AutoRemove::InstallRecommends 1;\n", - 'owner' => 'root', - 'group' => 'root', - 'mode' => '0644', - }) - } - end -end diff --git a/custom_zulip_files/puppet/apt/spec/defines/force_spec.rb b/custom_zulip_files/puppet/apt/spec/defines/force_spec.rb deleted file mode 100644 index f5d6ac2..0000000 --- a/custom_zulip_files/puppet/apt/spec/defines/force_spec.rb +++ /dev/null @@ -1,41 +0,0 @@ -require 'spec_helper' -describe 'apt::force', :type => :define do - let :title do - 'my_package' - end - - let :default_params do - { - :release => 'testing', - :version => false - } - end - - [{}, - { - :release => 'stable', - :version => '1' - } - ].each do |param_set| - describe "when #{param_set == {} ? "using default" : "specifying"} define parameters" do - let :param_hash do - default_params.merge(param_set) - end - - let :params do - param_set - end - - let :unless_query do - base_command = "/usr/bin/dpkg -s #{title} | grep -q " - base_command + (params[:version] ? "'Version: #{params[:version]}'" : "'Status: install'") - end - - let :exec_title do - base_exec = "/usr/bin/apt-get -y -t #{param_hash[:release]} install #{title}" - base_exec + (params[:version] ? "=#{params[:version]}" : "") - end - it { should contain_exec(exec_title).with_unless(unless_query) } - end - end -end diff --git a/custom_zulip_files/puppet/apt/spec/defines/key_spec.rb b/custom_zulip_files/puppet/apt/spec/defines/key_spec.rb deleted file mode 100644 index aea197a..0000000 --- a/custom_zulip_files/puppet/apt/spec/defines/key_spec.rb +++ /dev/null @@ -1,123 +0,0 @@ -require 'spec_helper' -describe 'apt::key', :type => :define do - let :title do - '8347A27F' - end - - let :default_params do - { - :key => title, - :ensure => 'present', - :key_server => "keyserver.ubuntu.com", - :key_source => false, - :key_content => false - } - end - - [{}, - { - :ensure => 'absent' - }, - { - :ensure => 'random' - }, - { - :key_source => 'ftp://ftp.example.org/key', - }, - { - :key_content => 'deadbeef', - } - ].each do |param_set| - - let :param_hash do - param_hash = default_params.merge(param_set) - param_hash[:key].upcase! if param_hash[:key] - param_hash - end - - let :params do - param_set - end - - let :digest do - str = String.new - str << param_hash[:key].to_s << '/' - str << param_hash[:key_content].to_s << '/' - str << param_hash[:key_source].to_s << '/' - str << param_hash[:key_server].to_s << '/' - Digest::SHA1.hexdigest(str) - end - - describe "when #{param_set == {} ? "using default" : "specifying"} define parameters" do - - it { - if [:present, 'present', :absent, 'absent'].include? param_hash[:ensure] - should contain_apt__params - end - } - - it { - if [:present, 'present'].include? param_hash[:ensure] - should_not contain_exec("apt::key #{param_hash[:key]} absent") - should contain_anchor("apt::key #{param_hash[:key]} present") - should contain_exec(digest).with({ - "path" => "/bin:/usr/bin", - "unless" => "/usr/bin/apt-key list | /bin/grep '#{param_hash[:key]}'" - }) - elsif [:absent, 'absent'].include? param_hash[:ensure] - should_not contain_anchor("apt::key #{param_hash[:key]} present") - should contain_exec("apt::key #{param_hash[:key]} absent").with({ - "path" => "/bin:/usr/bin", - "onlyif" => "apt-key list | grep '#{param_hash[:key]}'", - "command" => "apt-key del '#{param_hash[:key]}'" - }) - else - expect { should raise_error(Puppet::Error) } - end - } - - it { - if [:present, 'present'].include? param_hash[:ensure] - if param_hash[:key_content] - should contain_exec(digest).with({ - "command" => "echo '#{param_hash[:key_content]}' | /usr/bin/apt-key add -" - }) - elsif param_hash[:key_source] - should contain_exec(digest).with({ - "command" => "wget -q '#{param_hash[:key_source]}' -O- | apt-key add -" - }) - elsif param_hash[:key_server] - should contain_exec(digest).with({ - "command" => "apt-key adv --keyserver '#{param_hash[:key_server]}' --recv-keys '#{param_hash[:key]}'" - }) - end - end - } - - end - end - - [{ :ensure => 'present' }, { :ensure => 'absent' }].each do |param_set| - describe "should correctly handle duplicate definitions" do - - let :pre_condition do - "apt::key { 'duplicate': key => '#{title}'; }" - end - - let(:params) { param_set } - - it { - if param_set[:ensure] == 'present' - should contain_anchor("apt::key #{title} present") - should contain_apt__key(title) - should contain_apt__key("duplicate") - elsif param_set[:ensure] == 'absent' - expect { should raise_error(Puppet::Error) } - end - } - - end - end - -end - diff --git a/custom_zulip_files/puppet/apt/spec/defines/pin_spec.rb b/custom_zulip_files/puppet/apt/spec/defines/pin_spec.rb deleted file mode 100644 index a4cb1e2..0000000 --- a/custom_zulip_files/puppet/apt/spec/defines/pin_spec.rb +++ /dev/null @@ -1,101 +0,0 @@ -require 'spec_helper' -describe 'apt::pin', :type => :define do - let(:title) { 'my_pin' } - - let :default_params do - { - :ensure => 'present', - :order => '', - :packages => '*', - :priority => '0', - :release => nil - } - end - - [ - { :params => {}, - :content => "# my_pin\nExplanation: : my_pin\nPackage: *\nPin: release a=my_pin\nPin-Priority: 0\n" - }, - { - :params => { - :packages => 'apache', - :priority => '1' - }, - :content => "# my_pin\nExplanation: : my_pin\nPackage: apache\nPin: release a=my_pin\nPin-Priority: 1\n" - }, - { - :params => { - :order => 50, - :packages => 'apache', - :priority => '1' - }, - :content => "# my_pin\nExplanation: : my_pin\nPackage: apache\nPin: release a=my_pin\nPin-Priority: 1\n" - }, - { - :params => { - :ensure => 'absent', - :packages => 'apache', - :priority => '1' - }, - :content => "# my_pin\nExplanation: : my_pin\nPackage: apache\nPin: release a=my_pin\nPin-Priority: 1\n" - }, - { - :params => { - :packages => 'apache', - :priority => '1', - :release => 'my_newpin' - }, - :content => "# my_pin\nExplanation: : my_pin\nPackage: apache\nPin: release a=my_newpin\nPin-Priority: 1\n" - }, - { - :params => { - :packages => 'apache', - :priority => '1', - :version => '2.2.16*' - }, - :content => "# my_pin\nExplanation: : my_pin\nPackage: apache\nPin: version 2.2.16*\nPin-Priority: 1\n" - }, - { - :params => { - :priority => '1', - :origin => 'ftp.de.debian.org' - }, - :content => "# my_pin\nExplanation: : my_pin\nPackage: *\nPin: origin \"ftp.de.debian.org\"\nPin-Priority: 1\n" - }, - { - :params => { - :packages => 'apache', - :priority => '1', - :release => 'stable', - :codename => 'wheezy', - :release_version => '3.0', - :component => 'main', - :originator => 'Debian', - :label => 'Debian' - }, - :content => "# my_pin\nExplanation: : my_pin\nPackage: apache\nPin: release a=stable, n=wheezy, v=3.0, c=main, o=Debian, l=Debian\nPin-Priority: 1\n" - }, - ].each do |param_set| - describe "when #{param_set == {} ? "using default" : "specifying"} define parameters" do - let :param_hash do - default_params.merge(param_set[:params]) - end - - let :params do - param_set[:params] - end - - it { should include_class("apt::params") } - - it { should contain_file("#{title}.pref").with({ - 'ensure' => param_hash[:ensure], - 'path' => "/etc/apt/preferences.d/#{param_hash[:order] == '' ? "" : "#{param_hash[:order]}-"}#{title}.pref", - 'owner' => 'root', - 'group' => 'root', - 'mode' => '0644', - 'content' => param_set[:content], - }) - } - end - end -end diff --git a/custom_zulip_files/puppet/apt/spec/defines/ppa_spec.rb b/custom_zulip_files/puppet/apt/spec/defines/ppa_spec.rb deleted file mode 100644 index 5b59f57..0000000 --- a/custom_zulip_files/puppet/apt/spec/defines/ppa_spec.rb +++ /dev/null @@ -1,143 +0,0 @@ -require 'spec_helper' -describe 'apt::ppa', :type => :define do - [ { :lsbdistrelease => '11.04', - :lsbdistcodename => 'natty', - :package => 'python-software-properties'}, - { :lsbdistrelease => '12.10', - :lsbdistcodename => 'quantal', - :package => 'software-properties-common'}, - ].each do |platform| - context "on #{platform[:lsbdistcodename]}" do - let :facts do - { - :lsbdistrelease => platform[:lsbdistrelease], - :lsbdistcodename => platform[:lsbdistcodename], - } - end - let :release do - "#{platform[:lsbdistcodename]}" - end - let :package do - "#{platform[:package]}" - end - let :options do - "-y" - end - ['ppa:dans_ppa', 'dans_ppa','ppa:dans-daily/ubuntu'].each do |t| - describe "with title #{t}" do - let :pre_condition do - 'class { "apt": }' - end - let :title do - t - end - let :filename do - t.sub(/^ppa:/,'').gsub('/','-') << "-" << "#{release}.list" - end - - it { should contain_package("#{package}") } - - it { should contain_exec("apt_update").with( - 'command' => '/usr/bin/apt-get update', - 'refreshonly' => true - ) - } - - it { should contain_exec("add-apt-repository-#{t}").with( - 'command' => "/usr/bin/add-apt-repository #{options} #{t}", - 'unless' => "/usr/bin/test -s /etc/apt/sources.list.d/#{filename}", - 'require' => ["File[/etc/apt/sources.list.d]", "Package[#{package}]"], - 'notify' => "Exec[apt_update]" - ) - } - - it { should create_file("/etc/apt/sources.list.d/#{filename}").with( - 'ensure' => 'file', - 'require' => "Exec[add-apt-repository-#{t}]" - ) - } - end - end - describe 'without a proxy defined' do - let :title do - 'rspec_ppa' - end - let :pre_condition do - 'class { "apt": - proxy_host => false - }' - end - let :filename do - "#{title}-#{release}.list" - end - - it { should contain_exec("add-apt-repository-#{title}").with( - 'environment' => [], - 'command' => "/usr/bin/add-apt-repository #{options} #{title}", - 'unless' => "/usr/bin/test -s /etc/apt/sources.list.d/#{filename}", - 'require' => ["File[/etc/apt/sources.list.d]", "Package[#{package}]"], - 'notify' => "Exec[apt_update]" - ) - } - end - - describe 'behind a proxy' do - let :title do - 'rspec_ppa' - end - let :pre_condition do - 'class { "apt": - proxy_host => "user:pass@proxy", - }' - end - let :filename do - "#{title}-#{release}.list" - end - - it { should contain_exec("add-apt-repository-#{title}").with( - 'environment' => [ - "http_proxy=http://user:pass@proxy:8080", - "https_proxy=http://user:pass@proxy:8080", - ], - 'command' => "/usr/bin/add-apt-repository #{options} #{title}", - 'unless' => "/usr/bin/test -s /etc/apt/sources.list.d/#{filename}", - 'require' => ["File[/etc/apt/sources.list.d]", "Package[#{package}]"], - 'notify' => "Exec[apt_update]" - ) - } - end - end - end - - [ { :lsbdistcodename => 'natty', - :package => 'python-software-properties' }, - { :lsbdistcodename => 'quantal', - :package => 'software-properties-common'}, - ].each do |platform| - context "on #{platform[:lsbdistcodename]}" do - describe "it should not error if package['#{platform[:package]}'] is already defined" do - let :pre_condition do - 'class {"apt": }' + - 'package { "#{platform[:package]}": }->Apt::Ppa["ppa"]' - end - let :facts do - {:lsbdistcodename => '#{platform[:lsbdistcodename]}'} - end - let(:title) { "ppa" } - let(:release) { "#{platform[:lsbdistcodename]}" } - it { should contain_package('#{platform[:package]}') } - end - end - end - - describe "without Class[apt] should raise a Puppet::Error" do - let(:release) { "natty" } - let(:title) { "ppa" } - it { expect { should contain_apt__ppa(title) }.to raise_error(Puppet::Error) } - end - - describe "without release should raise a Puppet::Error" do - let(:title) { "ppa:" } - it { expect { should contain_apt__ppa(:release) }.to raise_error(Puppet::Error) } - end -end diff --git a/custom_zulip_files/puppet/apt/spec/defines/source_spec.rb b/custom_zulip_files/puppet/apt/spec/defines/source_spec.rb deleted file mode 100644 index 9ad4d46..0000000 --- a/custom_zulip_files/puppet/apt/spec/defines/source_spec.rb +++ /dev/null @@ -1,166 +0,0 @@ -require 'spec_helper' -describe 'apt::source', :type => :define do - let :title do - 'my_source' - end - - let :default_params do - { - :ensure => 'present', - :location => '', - :release => 'karmic', - :repos => 'main', - :include_src => true, - :required_packages => false, - :key => false, - :key_server => 'keyserver.ubuntu.com', - :key_content => false, - :key_source => false, - :pin => false - } - end - - [{}, - { - :location => 'http://example.com', - :release => 'precise', - :repos => 'security', - :include_src => false, - :required_packages => 'apache', - :key => 'key_name', - :key_server => 'keyserver.debian.com', - :pin => '600', - :key_content => 'ABCD1234' - }, - { - :key => 'key_name', - :key_server => 'keyserver.debian.com', - :key_content => false, - }, - { - :ensure => 'absent', - :location => 'http://example.com', - :release => 'precise', - :repos => 'security', - }, - { - :release => '', - }, - { - :release => 'custom', - }, - { - :architecture => 'amd64', - } - ].each do |param_set| - describe "when #{param_set == {} ? "using default" : "specifying"} class parameters" do - let :param_hash do - default_params.merge(param_set) - end - - let :facts do - {:lsbdistcodename => 'karmic'} - end - - let :params do - param_set - end - - let :filename do - "/etc/apt/sources.list.d/#{title}.list" - end - - let :content do - content = "# #{title}" - if param_hash[:architecture] - arch = "[arch=#{param_hash[:architecture]}]" - end - content << "\ndeb #{arch}#{param_hash[:location]} #{param_hash[:release]} #{param_hash[:repos]}\n" - - if param_hash[:include_src] - content << "deb-src #{arch}#{param_hash[:location]} #{param_hash[:release]} #{param_hash[:repos]}\n" - end - content - end - - it { should contain_apt__params } - - it { should contain_file("#{title}.list").with({ - 'ensure' => param_hash[:ensure], - 'path' => filename, - 'owner' => 'root', - 'group' => 'root', - 'mode' => '0644', - 'content' => content, - }) - } - - it { - if param_hash[:pin] - should contain_apt__pin(title).with({ - "priority" => param_hash[:pin], - "before" => "File[#{title}.list]" - }) - else - should_not contain_apt__pin(title).with({ - "priority" => param_hash[:pin], - "before" => "File[#{title}.list]" - }) - end - } - - it { - should contain_exec("apt_update").with({ - "command" => "/usr/bin/apt-get update", - "refreshonly" => true - }) - } - - it { - if param_hash[:required_packages] - should contain_exec("Required packages: '#{param_hash[:required_packages]}' for #{title}").with({ - "command" => "/usr/bin/apt-get -y install #{param_hash[:required_packages]}", - "subscribe" => "File[#{title}.list]", - "refreshonly" => true, - "before" => 'Exec[apt_update]', - }) - else - should_not contain_exec("Required packages: '#{param_hash[:required_packages]}' for #{title}").with({ - "command" => "/usr/bin/apt-get -y install #{param_hash[:required_packages]}", - "subscribe" => "File[#{title}.list]", - "refreshonly" => true - }) - end - } - - it { - if param_hash[:key] - should contain_apt__key("Add key: #{param_hash[:key]} from Apt::Source #{title}").with({ - "key" => param_hash[:key], - "ensure" => :present, - "key_server" => param_hash[:key_server], - "key_content" => param_hash[:key_content], - "key_source" => param_hash[:key_source], - "before" => "File[#{title}.list]" - }) - else - should_not contain_apt__key("Add key: #{param_hash[:key]} from Apt::Source #{title}").with({ - "key" => param_hash[:key], - "ensure" => :present, - "key_server" => param_hash[:key_server], - "key_content" => param_hash[:key_content], - "key_source" => param_hash[:key_source], - "before" => "File[#{title}.list]" - }) - end - } - end - end - describe "without release should raise a Puppet::Error" do - let(:default_params) { Hash.new } - let(:facts) { Hash.new } - it { expect { should raise_error(Puppet::Error) } } - let(:facts) { { :lsbdistcodename => 'lucid' } } - it { should contain_apt__source(title) } - end -end diff --git a/custom_zulip_files/puppet/apt/spec/spec_helper.rb b/custom_zulip_files/puppet/apt/spec/spec_helper.rb deleted file mode 100644 index 2c6f566..0000000 --- a/custom_zulip_files/puppet/apt/spec/spec_helper.rb +++ /dev/null @@ -1 +0,0 @@ -require 'puppetlabs_spec_helper/module_spec_helper' diff --git a/custom_zulip_files/puppet/apt/spec/spec_helper_system.rb b/custom_zulip_files/puppet/apt/spec/spec_helper_system.rb deleted file mode 100644 index 490a601..0000000 --- a/custom_zulip_files/puppet/apt/spec/spec_helper_system.rb +++ /dev/null @@ -1,30 +0,0 @@ -require 'rspec-system/spec_helper' -require 'rspec-system-puppet/helpers' -require 'rspec-system-serverspec/helpers' - -include RSpecSystemPuppet::Helpers - -include Serverspec::Helper::RSpecSystem -include Serverspec::Helper::DetectOS - -RSpec.configure do |c| - # Project root - proj_root = File.expand_path(File.join(File.dirname(__FILE__), '..')) - - # Enable colour - c.tty = true - - c.include RSpecSystemPuppet::Helpers - - # This is where we 'setup' the nodes before running our tests - c.before :suite do - # May as well update here as this can only run on apt-get machines. - shell('apt-get update') - # Install puppet - puppet_install - - # Install modules and dependencies - puppet_module_install(:source => proj_root, :module_name => 'apt') - shell('puppet module install puppetlabs-stdlib') - end -end diff --git a/custom_zulip_files/puppet/apt/spec/system/apt_builddep_spec.rb b/custom_zulip_files/puppet/apt/spec/system/apt_builddep_spec.rb deleted file mode 100644 index fa16ab4..0000000 --- a/custom_zulip_files/puppet/apt/spec/system/apt_builddep_spec.rb +++ /dev/null @@ -1,38 +0,0 @@ -require 'spec_helper_system' - -describe 'apt::builddep' do - - context 'reset' do - it 'removes packages' do - shell('apt-get -y remove glusterfs-server') - shell('apt-get -y remove g++') - end - end - - context 'apt::builddep' do - it 'should work with no errors' do - pp = <<-EOS - include '::apt' - apt::builddep { 'glusterfs-server': } - EOS - - puppet_apply(pp) do |r| - r.exit_code.should_not == 1 - end - end - - describe 'should install g++ as a dependency' do - describe package('g++') do - it { should be_installed } - end - end - end - - context 'reset' do - it 'removes packages' do - shell('apt-get -y remove glusterfs-server') - shell('apt-get -y remove g++') - end - end - -end diff --git a/custom_zulip_files/puppet/apt/spec/system/apt_key_spec.rb b/custom_zulip_files/puppet/apt/spec/system/apt_key_spec.rb deleted file mode 100644 index 4842cb5..0000000 --- a/custom_zulip_files/puppet/apt/spec/system/apt_key_spec.rb +++ /dev/null @@ -1,53 +0,0 @@ -require 'spec_helper_system' - -describe 'apt::key' do - - context 'reset' do - it 'clean up keys' do - shell('apt-key del 4BD6EC30') - shell('apt-key del D50582E6') - end - end - - context 'apt::key' do - it 'should work with no errors' do - pp = <<-EOS - include '::apt' - apt::key { 'puppetlabs': - key => '4BD6EC30', - key_server => 'pgp.mit.edu', - } - - apt::key { 'jenkins': - key => 'D50582E6', - key_source => 'http://pkg.jenkins-ci.org/debian/jenkins-ci.org.key', - } - EOS - - puppet_apply(pp) do |r| - r.exit_code.should_not == 1 - end - end - - describe 'keys should exist' do - it 'finds puppetlabs key' do - shell('apt-key list | grep 4BD6EC30') do |r| - r.exit_code.should be_zero - end - end - it 'finds jenkins key' do - shell('apt-key list | grep D50582E6') do |r| - r.exit_code.should be_zero - end - end - end - end - - context 'reset' do - it 'clean up keys' do - shell('apt-key del 4BD6EC30') - shell('apt-key del D50582E6') - end - end - -end diff --git a/custom_zulip_files/puppet/apt/spec/system/apt_ppa_spec.rb b/custom_zulip_files/puppet/apt/spec/system/apt_ppa_spec.rb deleted file mode 100644 index 2e2baf5..0000000 --- a/custom_zulip_files/puppet/apt/spec/system/apt_ppa_spec.rb +++ /dev/null @@ -1,59 +0,0 @@ -require 'spec_helper_system' - -describe 'apt::ppa' do - - context 'reset' do - it 'removes ppa' do - shell('rm /etc/apt/sources.list.d/drizzle-developers-ppa*') - shell('rm /etc/apt/sources.list.d/raravena80-collectd5-*') - end - end - - context 'adding a ppa that doesnt exist' do - it 'should work with no errors' do - pp = <<-EOS - include '::apt' - apt::ppa { 'ppa:drizzle-developers/ppa': } - EOS - - puppet_apply(pp) do |r| - r.exit_code.should_not == 1 - end - end - - describe 'contains the source file' do - it 'contains a drizzle ppa source' do - shell('ls /etc/apt/sources.list.d/drizzle-developers-ppa-*.list') do |r| - r.exit_code.should be_zero - end - end - end - end - - context 'readding a removed ppa.' do - it 'setup' do - shell('add-apt-repository -y ppa:raravena80/collectd5') - # This leaves a blank file - shell('add-apt-repository --remove ppa:raravena80/collectd5') - end - - it 'should readd it successfully' do - pp = <<-EOS - include '::apt' - apt::ppa { 'ppa:raravena80/collectd5': } - EOS - - puppet_apply(pp) do |r| - r.exit_code.should_not == 1 - end - end - end - - context 'reset' do - it 'removes added ppas' do - shell('rm /etc/apt/sources.list.d/drizzle-developers-ppa*') - shell('rm /etc/apt/sources.list.d/raravena80-collectd5-*') - end - end - -end diff --git a/custom_zulip_files/puppet/apt/spec/system/apt_source_spec.rb b/custom_zulip_files/puppet/apt/spec/system/apt_source_spec.rb deleted file mode 100644 index 6a445e1..0000000 --- a/custom_zulip_files/puppet/apt/spec/system/apt_source_spec.rb +++ /dev/null @@ -1,51 +0,0 @@ -require 'spec_helper_system' - -describe 'apt::source' do - - context 'reset' do - it 'clean up puppetlabs repo' do - shell('apt-key del 4BD6EC30') - shell('rm /etc/apt/sources.list.d/puppetlabs.list') - end - end - - context 'apt::source' do - it 'should work with no errors' do - pp = <<-EOS - include '::apt' - apt::source { 'puppetlabs': - location => 'http://apt.puppetlabs.com', - repos => 'main', - key => '4BD6EC30', - key_server => 'pgp.mit.edu', - } - EOS - - puppet_apply(pp) do |r| - r.exit_code.should_not == 1 - end - end - - describe 'key should exist' do - it 'finds puppetlabs key' do - shell('apt-key list | grep 4BD6EC30') do |r| - r.exit_code.should be_zero - end - end - end - - describe 'source should exist' do - describe file('/etc/apt/sources.list.d/puppetlabs.list') do - it { should be_file } - end - end - end - - context 'reset' do - it 'clean up puppetlabs repo' do - shell('apt-key del 4BD6EC30') - shell('rm /etc/apt/sources.list.d/puppetlabs.list') - end - end - -end diff --git a/custom_zulip_files/puppet/apt/spec/system/basic_spec.rb b/custom_zulip_files/puppet/apt/spec/system/basic_spec.rb deleted file mode 100644 index 3008356..0000000 --- a/custom_zulip_files/puppet/apt/spec/system/basic_spec.rb +++ /dev/null @@ -1,10 +0,0 @@ -require 'spec_helper_system' - -describe 'basic tests:' do - # Using puppet_apply as a subject - context puppet_apply 'notice("foo")' do - its(:stdout) { should =~ /foo/ } - its(:stderr) { should be_empty } - its(:exit_code) { should be_zero } - end -end diff --git a/custom_zulip_files/puppet/apt/spec/system/class_spec.rb b/custom_zulip_files/puppet/apt/spec/system/class_spec.rb deleted file mode 100644 index 7bb6b8d..0000000 --- a/custom_zulip_files/puppet/apt/spec/system/class_spec.rb +++ /dev/null @@ -1,20 +0,0 @@ -require 'spec_helper_system' - -describe 'apt class' do - - context 'default parameters' do - # Using puppet_apply as a helper - it 'should work with no errors' do - pp = <<-EOS - class { 'apt': } - EOS - - # Run it twice and test for idempotency - puppet_apply(pp) do |r| - r.exit_code.should_not == 1 - r.refresh - r.exit_code.should be_zero - end - end - end -end diff --git a/custom_zulip_files/puppet/apt/templates/10periodic.erb b/custom_zulip_files/puppet/apt/templates/10periodic.erb deleted file mode 100644 index 5737c9a..0000000 --- a/custom_zulip_files/puppet/apt/templates/10periodic.erb +++ /dev/null @@ -1,12 +0,0 @@ -APT::Periodic::Enable "<%= @enable %>"; -APT::Periodic::BackUpArchiveInterval "<%= @backup_interval %>"; -APT::Periodic::BackUpLevel "<%= @backup_level %>"; -APT::Periodic::MaxAge "<%= @max_age %>"; -APT::Periodic::MinAge "<%= @min_age %>"; -APT::Periodic::MaxSize "<%= @max_size %>"; -APT::Periodic::Update-Package-Lists "<%= @update %>"; -APT::Periodic::Download-Upgradeable-Packages "<%= @download %>"; -APT::Periodic::Download-Upgradeable-Packages-Debdelta "<%= @download_delta %>"; -APT::Periodic::Unattended-Upgrade "<%= @upgrade %>"; -APT::Periodic::AutocleanInterval "<%= @autoclean %>"; -APT::Periodic::Verbose "<%= @verbose %>"; diff --git a/custom_zulip_files/puppet/apt/templates/50unattended-upgrades.erb b/custom_zulip_files/puppet/apt/templates/50unattended-upgrades.erb deleted file mode 100644 index 4df0f74..0000000 --- a/custom_zulip_files/puppet/apt/templates/50unattended-upgrades.erb +++ /dev/null @@ -1,53 +0,0 @@ -// Automatically upgrade packages from these (origin:archive) pairs -Unattended-Upgrade::Allowed-Origins { -<% @origins.each do |origin| -%> - "<%= origin %>"; -<% end -%> -}; - -// List of packages to not update -Unattended-Upgrade::Package-Blacklist { -<% @blacklist.each do |package| -%> - "<%= package %>"; -<% end -%> -}; - -// This option allows you to control if on a unclean dpkg exit -// unattended-upgrades will automatically run -// dpkg --force-confold --configure -a -// The default is true, to ensure updates keep getting installed -Unattended-Upgrade::AutoFixInterruptedDpkg "<%= @auto_fix %>"; - -// Split the upgrade into the smallest possible chunks so that -// they can be interrupted with SIGUSR1. This makes the upgrade -// a bit slower but it has the benefit that shutdown while a upgrade -// is running is possible (with a small delay) -Unattended-Upgrade::MinimalSteps "<%= @minimal_steps %>"; - -// Install all unattended-upgrades when the machine is shuting down -// instead of doing it in the background while the machine is running -// This will (obviously) make shutdown slower -Unattended-Upgrade::InstallOnShutdown "<%= @install_on_shutdown %>"; - -// Send email to this address for problems or packages upgrades -// If empty or unset then no email is sent, make sure that you -// have a working mail setup on your system. A package that provides -// 'mailx' must be installed. -<% if @mail_to != "NONE" %>Unattended-Upgrade::Mail "<%= @mail_to %>";<% end %> - -// Set this value to "true" to get emails only on errors. Default -// is to always send a mail if Unattended-Upgrade::Mail is set -<% if @mail_to != "NONE" %>Unattended-Upgrade::MailOnlyOnError "<%= @mail_only_on_error %>";<% end %> - -// Do automatic removal of new unused dependencies after the upgrade -// (equivalent to apt-get autoremove) -Unattended-Upgrade::Remove-Unused-Dependencies "<%= @remove_unused %>"; - -// Automatically reboot *WITHOUT CONFIRMATION* if a -// the file /var/run/reboot-required is found after the upgrade -Unattended-Upgrade::Automatic-Reboot "<%= @auto_reboot %>"; - - -// Use apt bandwidth limit feature, this example limits the download -// speed to 70kb/sec -<% if @dl_limit != "NONE" %>Acquire::http::Dl-Limit "<%= @dl_limit %>";<% end %> diff --git a/custom_zulip_files/puppet/apt/templates/pin.pref.erb b/custom_zulip_files/puppet/apt/templates/pin.pref.erb deleted file mode 100644 index 62c44c7..0000000 --- a/custom_zulip_files/puppet/apt/templates/pin.pref.erb +++ /dev/null @@ -1,22 +0,0 @@ -<%- -@pin = "release a=#{@name}" # default value -if @pin_release.length > 0 - options = [] - options.push("a=#{@release}") if @release.length > 0 - options.push("n=#{@codename}") if @codename.length > 0 - options.push("v=#{@release_version}") if @release_version.length > 0 - options.push("c=#{@component}") if @component.length > 0 - options.push("o=#{@originator}") if @originator.length > 0 - options.push("l=#{@label}") if @label.length > 0 - @pin = "release #{options.join(', ')}" -elsif @version.length > 0 - @pin = "version #{@version}" -elsif @origin.length > 0 - @pin = "origin \"#{@origin}\"" -end --%> -# <%= @name %> -Explanation: <%= @explanation %> -Package: <%= @packages %> -Pin: <%= @pin %> -Pin-Priority: <%= @priority %> diff --git a/custom_zulip_files/puppet/apt/templates/source.list.erb b/custom_zulip_files/puppet/apt/templates/source.list.erb deleted file mode 100644 index e8b6865..0000000 --- a/custom_zulip_files/puppet/apt/templates/source.list.erb +++ /dev/null @@ -1,5 +0,0 @@ -# <%= @name %> -deb <% if @architecture %>[arch=<%= @architecture %>]<% end %><%= @location %> <%= @release_real %> <%= @repos %> -<%- if @include_src then -%> -deb-src <% if @architecture %>[arch=<%= @architecture %>]<% end %><%= @location %> <%= @release_real %> <%= @repos %> -<%- end -%> diff --git a/custom_zulip_files/puppet/apt/tests/builddep.pp b/custom_zulip_files/puppet/apt/tests/builddep.pp deleted file mode 100644 index 8b4f796..0000000 --- a/custom_zulip_files/puppet/apt/tests/builddep.pp +++ /dev/null @@ -1,2 +0,0 @@ -class { 'apt': } -apt::builddep{ 'glusterfs-server': } diff --git a/custom_zulip_files/puppet/apt/tests/debian/testing.pp b/custom_zulip_files/puppet/apt/tests/debian/testing.pp deleted file mode 100644 index 8245b3a..0000000 --- a/custom_zulip_files/puppet/apt/tests/debian/testing.pp +++ /dev/null @@ -1,2 +0,0 @@ -class { 'apt': } -class { 'apt::debian::testing': } diff --git a/custom_zulip_files/puppet/apt/tests/debian/unstable.pp b/custom_zulip_files/puppet/apt/tests/debian/unstable.pp deleted file mode 100644 index 8605179..0000000 --- a/custom_zulip_files/puppet/apt/tests/debian/unstable.pp +++ /dev/null @@ -1,2 +0,0 @@ -class { 'apt': } -class { 'apt::debian::unstable': } diff --git a/custom_zulip_files/puppet/apt/tests/force.pp b/custom_zulip_files/puppet/apt/tests/force.pp deleted file mode 100644 index f331363..0000000 --- a/custom_zulip_files/puppet/apt/tests/force.pp +++ /dev/null @@ -1,7 +0,0 @@ -# force.pp -# force a package from a specific release - -apt::force { 'package': - release => 'testing', - version => false -} diff --git a/custom_zulip_files/puppet/apt/tests/init.pp b/custom_zulip_files/puppet/apt/tests/init.pp deleted file mode 100644 index abc75af..0000000 --- a/custom_zulip_files/puppet/apt/tests/init.pp +++ /dev/null @@ -1 +0,0 @@ -class { 'apt': } diff --git a/custom_zulip_files/puppet/apt/tests/key.pp b/custom_zulip_files/puppet/apt/tests/key.pp deleted file mode 100644 index 79e0e1b..0000000 --- a/custom_zulip_files/puppet/apt/tests/key.pp +++ /dev/null @@ -1,6 +0,0 @@ -# Declare Apt key for apt.puppetlabs.com source -apt::key { 'puppetlabs': - key => '4BD6EC30', - key_server => 'pgp.mit.edu', - key_options => 'http-proxy="http://proxyuser:proxypass@example.org:3128"', -} diff --git a/custom_zulip_files/puppet/apt/tests/params.pp b/custom_zulip_files/puppet/apt/tests/params.pp deleted file mode 100644 index 5ddf3c6..0000000 --- a/custom_zulip_files/puppet/apt/tests/params.pp +++ /dev/null @@ -1 +0,0 @@ -include apt::params diff --git a/custom_zulip_files/puppet/apt/tests/pin.pp b/custom_zulip_files/puppet/apt/tests/pin.pp deleted file mode 100644 index 6a9024c..0000000 --- a/custom_zulip_files/puppet/apt/tests/pin.pp +++ /dev/null @@ -1,5 +0,0 @@ -# pin a release in apt, useful for unstable repositories -apt::pin { 'foo': - packages => '*', - priority => 0, -} diff --git a/custom_zulip_files/puppet/apt/tests/ppa.pp b/custom_zulip_files/puppet/apt/tests/ppa.pp deleted file mode 100644 index e728f6f..0000000 --- a/custom_zulip_files/puppet/apt/tests/ppa.pp +++ /dev/null @@ -1,4 +0,0 @@ -class { 'apt': } - -# Example declaration of an Apt PPA -apt::ppa{ 'ppa:openstack-ppa/bleeding-edge': } diff --git a/custom_zulip_files/puppet/apt/tests/release.pp b/custom_zulip_files/puppet/apt/tests/release.pp deleted file mode 100644 index 823f586..0000000 --- a/custom_zulip_files/puppet/apt/tests/release.pp +++ /dev/null @@ -1,4 +0,0 @@ -class { 'apt': } -class { 'apt::release': - release_id => 'karmic' -} diff --git a/custom_zulip_files/puppet/apt/tests/source.pp b/custom_zulip_files/puppet/apt/tests/source.pp deleted file mode 100644 index d83cb97..0000000 --- a/custom_zulip_files/puppet/apt/tests/source.pp +++ /dev/null @@ -1,29 +0,0 @@ -# Declare the apt class to manage /etc/apt/sources.list and /etc/sources.list.d -class { 'apt': } - -# Install the puppetlabs apt source -# Release is automatically obtained from lsbdistcodename fact if available. -apt::source { 'puppetlabs': - location => 'http://apt.puppetlabs.com', - repos => 'main', - key => '4BD6EC30', - key_server => 'pgp.mit.edu', -} - -# test two sources with the same key -apt::source { 'debian_testing': - location => 'http://debian.mirror.iweb.ca/debian/', - release => 'testing', - repos => 'main contrib non-free', - key => '55BE302B', - key_server => 'subkeys.pgp.net', - pin => '-10', -} -apt::source { 'debian_unstable': - location => 'http://debian.mirror.iweb.ca/debian/', - release => 'unstable', - repos => 'main contrib non-free', - key => '55BE302B', - key_server => 'subkeys.pgp.net', - pin => '-10', -} diff --git a/custom_zulip_files/puppet/apt/tests/unattended-upgrades.pp b/custom_zulip_files/puppet/apt/tests/unattended-upgrades.pp deleted file mode 100644 index 7f65ab4..0000000 --- a/custom_zulip_files/puppet/apt/tests/unattended-upgrades.pp +++ /dev/null @@ -1 +0,0 @@ -include apt::unattended-upgrades diff --git a/custom_zulip_files/puppet/common b/custom_zulip_files/puppet/common deleted file mode 120000 index a305af4..0000000 --- a/custom_zulip_files/puppet/common +++ /dev/null @@ -1 +0,0 @@ -puppet-common/ \ No newline at end of file diff --git a/custom_zulip_files/puppet/puppet-common/README b/custom_zulip_files/puppet/puppet-common/README deleted file mode 100644 index 808f235..0000000 --- a/custom_zulip_files/puppet/puppet-common/README +++ /dev/null @@ -1,30 +0,0 @@ -puppet module common -==================== - -written by David Schmitt -Copyright (C) 2007 David Schmitt - - -adapted by immerda project group -admin+puppet(at)immerda.ch - -################################################# - -The common module installs various functions that are -required by other modules. This module should be -installed before any of the other module. - -To use this module, follow these directions: - -1. Your modules directory will need all the files - included in this repository placed under a directory - called "common" - -2. Add the following line to manifests/site.pp: - - import "modules.pp" - -3. Add the following line to manifests/modules.pp: - - import "common" - diff --git a/custom_zulip_files/puppet/puppet-common/files/empty/.ignore b/custom_zulip_files/puppet/puppet-common/files/empty/.ignore deleted file mode 100644 index 5688fe7..0000000 --- a/custom_zulip_files/puppet/puppet-common/files/empty/.ignore +++ /dev/null @@ -1 +0,0 @@ -# A placeholder to nail this directory into git diff --git a/custom_zulip_files/puppet/puppet-common/files/modules/README b/custom_zulip_files/puppet/puppet-common/files/modules/README deleted file mode 100644 index bc5bbbd..0000000 --- a/custom_zulip_files/puppet/puppet-common/files/modules/README +++ /dev/null @@ -1 +0,0 @@ -this directory contains various data collected for system wide configurations diff --git a/custom_zulip_files/puppet/puppet-common/lib/puppet/parser/functions/basename.rb b/custom_zulip_files/puppet/puppet-common/lib/puppet/parser/functions/basename.rb deleted file mode 100644 index 226d6e5..0000000 --- a/custom_zulip_files/puppet/puppet-common/lib/puppet/parser/functions/basename.rb +++ /dev/null @@ -1,16 +0,0 @@ -# basename(string) : string -# basename(string[]) : string[] -# -# Returns the last component of the filename given as argument, which must be -# formed using forward slashes (``/..) regardless of the separator used on the -# local file system. -module Puppet::Parser::Functions - newfunction(:basename, :type => :rvalue) do |args| - if args[0].is_a?(Array) - args.collect do |a| File.basename(a) end - else - File.basename(args[0]) - end - end -end - diff --git a/custom_zulip_files/puppet/puppet-common/lib/puppet/parser/functions/dirname.rb b/custom_zulip_files/puppet/puppet-common/lib/puppet/parser/functions/dirname.rb deleted file mode 100644 index 44b4a00..0000000 --- a/custom_zulip_files/puppet/puppet-common/lib/puppet/parser/functions/dirname.rb +++ /dev/null @@ -1,16 +0,0 @@ -# dirname(string) : string -# dirname(string[]) : string[] -# -# Returns all components of the filename given as argument except the last -# one. The filename must be formed using forward slashes (``/..) regardless of -# the separator used on the local file system. -module Puppet::Parser::Functions - newfunction(:dirname, :type => :rvalue) do |args| - if args[0].is_a?(Array) - args.collect do |a| File.dirname(a) end - else - File.dirname(args[0]) - end - end -end - diff --git a/custom_zulip_files/puppet/puppet-common/lib/puppet/parser/functions/gsub.rb b/custom_zulip_files/puppet/puppet-common/lib/puppet/parser/functions/gsub.rb deleted file mode 100644 index e2410ff..0000000 --- a/custom_zulip_files/puppet/puppet-common/lib/puppet/parser/functions/gsub.rb +++ /dev/null @@ -1,17 +0,0 @@ -module Puppet::Parser::Functions - # thin wrapper around the ruby gsub function - # gsub($string, $pattern, $replacement) will replace all occurrences of - # $pattern in $string with $replacement. $string can be either a singel - # value or an array. In the latter case, each element of the array will - # be processed in turn. - newfunction(:gsub, :type => :rvalue) do |args| - if args[0].is_a?(Array) - args[0].collect do |val| - val.gsub(/#{args[1]}/, args[2]) - end - else - args[0].gsub(/#{args[1]}/, args[2]) - end - end -end - diff --git a/custom_zulip_files/puppet/puppet-common/lib/puppet/parser/functions/hostname.rb b/custom_zulip_files/puppet/puppet-common/lib/puppet/parser/functions/hostname.rb deleted file mode 100644 index 7bc477f..0000000 --- a/custom_zulip_files/puppet/puppet-common/lib/puppet/parser/functions/hostname.rb +++ /dev/null @@ -1,13 +0,0 @@ -# get an uniq array of ipaddresses for a hostname -require 'resolv' - -module Puppet::Parser::Functions - newfunction(:hostname, :type => :rvalue) do |args| - res = Array.new - Resolv::DNS.new.each_address(args[0]){ |addr| - res << addr - } - res.uniq - end -end - diff --git a/custom_zulip_files/puppet/puppet-common/lib/puppet/parser/functions/network_lookup.rb b/custom_zulip_files/puppet/puppet-common/lib/puppet/parser/functions/network_lookup.rb deleted file mode 100644 index e45b947..0000000 --- a/custom_zulip_files/puppet/puppet-common/lib/puppet/parser/functions/network_lookup.rb +++ /dev/null @@ -1,12 +0,0 @@ -module Puppet::Parser::Functions - newfunction(:network_lookup, :type => :rvalue) do |args| - case args[0] - when "ip" then - IPSocket::getaddress(lookupvar('fqdn')) - when "netmask" then - "255.255.255.0" - when "gateway" then - IPSocket::getaddress(lookupvar('fqdn')).gsub(/\.\d+$/, '.1') - end - end -end diff --git a/custom_zulip_files/puppet/puppet-common/lib/puppet/parser/functions/prefix_with.rb b/custom_zulip_files/puppet/puppet-common/lib/puppet/parser/functions/prefix_with.rb deleted file mode 100644 index 6e64a4a..0000000 --- a/custom_zulip_files/puppet/puppet-common/lib/puppet/parser/functions/prefix_with.rb +++ /dev/null @@ -1,9 +0,0 @@ -# prefix arguments 2..n with first argument - -module Puppet::Parser::Functions - newfunction(:prefix_with, :type => :rvalue) do |args| - prefix = args.shift - args.collect {|v| "%s%s" % [prefix, v] } - end -end - diff --git a/custom_zulip_files/puppet/puppet-common/lib/puppet/parser/functions/re_escape.rb b/custom_zulip_files/puppet/puppet-common/lib/puppet/parser/functions/re_escape.rb deleted file mode 100644 index 6e5904b..0000000 --- a/custom_zulip_files/puppet/puppet-common/lib/puppet/parser/functions/re_escape.rb +++ /dev/null @@ -1,7 +0,0 @@ -# apply regexp escaping to a string -module Puppet::Parser::Functions - newfunction(:re_escape, :type => :rvalue) do |args| - Regexp.escape(args[0]) - end -end - diff --git a/custom_zulip_files/puppet/puppet-common/lib/puppet/parser/functions/slash_escape.rb b/custom_zulip_files/puppet/puppet-common/lib/puppet/parser/functions/slash_escape.rb deleted file mode 100644 index 04d3b95..0000000 --- a/custom_zulip_files/puppet/puppet-common/lib/puppet/parser/functions/slash_escape.rb +++ /dev/null @@ -1,7 +0,0 @@ -# escape slashes in a String -module Puppet::Parser::Functions - newfunction(:slash_escape, :type => :rvalue) do |args| - args[0].gsub(/\//, '\\/') - end -end - diff --git a/custom_zulip_files/puppet/puppet-common/lib/puppet/parser/functions/split.rb b/custom_zulip_files/puppet/puppet-common/lib/puppet/parser/functions/split.rb deleted file mode 100644 index 5237c92..0000000 --- a/custom_zulip_files/puppet/puppet-common/lib/puppet/parser/functions/split.rb +++ /dev/null @@ -1,17 +0,0 @@ -# split($string, $delimiter) : $string -# split($string[], $delimiter) : $string[][] -# -# Split the first argument(s) on every $delimiter. $delimiter is interpreted as -# Ruby regular expression. -# -# For long-term portability it is recommended to refrain from using Ruby's -# extended RE features. -module Puppet::Parser::Functions - newfunction(:split, :type => :rvalue) do |args| - if args[0].is_a?(Array) - args.collect do |a| a.split(/#{args[1]}/) end - else - args[0].split(/#{args[1]}/) - end - end -end diff --git a/custom_zulip_files/puppet/puppet-common/lib/puppet/parser/functions/substitute.rb b/custom_zulip_files/puppet/puppet-common/lib/puppet/parser/functions/substitute.rb deleted file mode 100644 index 4c97def..0000000 --- a/custom_zulip_files/puppet/puppet-common/lib/puppet/parser/functions/substitute.rb +++ /dev/null @@ -1,20 +0,0 @@ -# subsititute($string, $regex, $replacement) : $string -# subsititute($string[], $regex, $replacement) : $string[] -# -# Replace all ocurrences of $regex in $string by $replacement. -# $regex is interpreted as Ruby regular expression. -# -# For long-term portability it is recommended to refrain from using Ruby's -# extended RE features. -module Puppet::Parser::Functions - newfunction(:substitute, :type => :rvalue) do |args| - if args[0].is_a?(Array) - args[0].collect do |val| - val.gsub(/#{args[1]}/, args[2]) - end - else - args[0].gsub(/#{args[1]}/, args[2]) - end - end -end - diff --git a/custom_zulip_files/puppet/puppet-common/lib/puppet/parser/functions/url_get.rb b/custom_zulip_files/puppet/puppet-common/lib/puppet/parser/functions/url_get.rb deleted file mode 100644 index 46f4d1b..0000000 --- a/custom_zulip_files/puppet/puppet-common/lib/puppet/parser/functions/url_get.rb +++ /dev/null @@ -1,19 +0,0 @@ -# Returns the content at given URL - -module Puppet::Parser::Functions - newfunction(:url_get, :type => :rvalue) do |args| - require 'open-uri' - - url = args[0] - - begin - data = open(url, :proxy => nil) - # Ignore header - data.readline - data.readline.chomp - rescue OpenURI::HTTPError => error - fail "Fetching URL #{url} failed with status #{error.message}" - end - end -end - diff --git a/custom_zulip_files/puppet/puppet-common/manifests/append_if_no_such_line.pp b/custom_zulip_files/puppet/puppet-common/manifests/append_if_no_such_line.pp deleted file mode 100644 index 704d639..0000000 --- a/custom_zulip_files/puppet/puppet-common/manifests/append_if_no_such_line.pp +++ /dev/null @@ -1,8 +0,0 @@ -define common::append_if_no_such_line($file, $line, $refreshonly = 'false') { - exec { "/bin/echo '$line' >> '$file'": - unless => "/bin/grep -Fxqe '$line' '$file'", - path => "/bin", - refreshonly => $refreshonly, - subscribe => File[$file], - } -} diff --git a/custom_zulip_files/puppet/puppet-common/manifests/assert_lsbdistcodename.pp b/custom_zulip_files/puppet/puppet-common/manifests/assert_lsbdistcodename.pp deleted file mode 100644 index dac6df6..0000000 --- a/custom_zulip_files/puppet/puppet-common/manifests/assert_lsbdistcodename.pp +++ /dev/null @@ -1,41 +0,0 @@ -# common/manifests/classes/lsb_release.pp -- request the installation of -# lsb_release to get to lsbdistcodename, which is used throughout the manifests -# -# Copyright (C) 2007 David Schmitt -# See LICENSE for the full license granted to you. - -# Changelog: -# 2007-08-26: micah reported, that lsb_release can report -# nonsensical values for lsbdistcodename; assert_lsbdistcodename now -# recognises "n/a" and acts accordingly - -# This lightweight class only asserts that $lsbdistcodename is set. -# If the assertion fails, an error is printed on the server -# -# To fail individual resources on a missing lsbdistcodename, require -# Exec[assert_lsbdistcodename] on the specific resource -class common::assert_lsbdistcodename { - - case $lsbdistcodename { - '': { - err("Please install lsb_release or set facter_lsbdistcodename in the environment of $fqdn") - exec { "false # assert_lsbdistcodename": alias => assert_lsbdistcodename } - } - 'n/a': { - case $operatingsystem { - "Debian": { - err("lsb_release was unable to report your distcodename; This seems to indicate a broken apt/sources.list on $fqdn") - } - default: { - err("lsb_release was unable to report your distcodename; please set facter_lsbdistcodename in the environment of $fqdn") - } - } - exec { "false # assert_lsbdistcodename": alias => assert_lsbdistcodename } - } - default: { - exec { "true # assert_lsbdistcodename": alias => assert_lsbdistcodename } - exec { "true # require_lsbdistcodename": alias => require_lsbdistcodename } - } - } - -} diff --git a/custom_zulip_files/puppet/puppet-common/manifests/concatenated_file.pp b/custom_zulip_files/puppet/puppet-common/manifests/concatenated_file.pp deleted file mode 100644 index 4787d20..0000000 --- a/custom_zulip_files/puppet/puppet-common/manifests/concatenated_file.pp +++ /dev/null @@ -1,71 +0,0 @@ -# common/manifests/defines/concatenated_file.pp -- create a file from snippets -# stored in a directory -# -# Copyright (C) 2007 David Schmitt -# See LICENSE for the full license granted to you. - -# TODO: -# * create the directory in _part too - -# Usage: -# concatenated_file { "/etc/some.conf": -# dir => "/etc/some.conf.d", -# } -# Use Exec["concat_$name"] as Semaphor -define common::concatenated_file ( - # where the snippets are located - $dir = '', - # a file with content to prepend - $header = '', - # a file with content to append - $footer = '', - $mode = 0644, $owner = root, $group = 0 - ) -{ - - $dir_real = $dir ? { '' => "${name}.d", default => $dir } - - if defined(File[$dir_real]) { - debug("${dir_real} already defined") - } else { - file { - $dir_real: - source => "puppet://$server/common/empty", - checksum => mtime, - ignore => '\.ignore', - recurse => true, purge => true, force => true, - mode => $mode, owner => $owner, group => $group, - notify => Exec["concat_${name}"]; - } - } - - file { - $name: - ensure => present, checksum => md5, - mode => $mode, owner => $owner, group => $group; - } - - # if there is a header or footer file, add it - $additional_cmd = $header ? { - '' => $footer ? { - '' => '', - default => "| cat - '${footer}' " - }, - default => $footer ? { - '' => "| cat '${header}' - ", - default => "| cat '${header}' - '${footer}' " - } - } - - # use >| to force clobbering the target file - exec { "concat_${name}": - command => "/usr/bin/find ${dir_real} -maxdepth 1 -type f ! -name '*puppettmp' -print0 | sort -z | xargs -0 cat ${additional_cmd} >| ${name}", - refreshonly => true, - subscribe => [ File[$dir_real] ], - before => File[$name], - refreshonly => true, - subscribe => [ File[$dir_real] ], - before => File[$name], - alias => [ "concat_${dir_real}"] , - } -} diff --git a/custom_zulip_files/puppet/puppet-common/manifests/concatenated_file_part.pp b/custom_zulip_files/puppet/puppet-common/manifests/concatenated_file_part.pp deleted file mode 100644 index 5faac03..0000000 --- a/custom_zulip_files/puppet/puppet-common/manifests/concatenated_file_part.pp +++ /dev/null @@ -1,16 +0,0 @@ -# Add a snippet called $name to the concatenated_file at $dir. -# The file can be referenced as File["cf_part_${name}"] -define common::concatenated_file_part ( - $dir, $content = '', $ensure = present, - $mode = 0644, $owner = root, $group = 0 - ) -{ - - file { "${dir}/${name}": - ensure => $ensure, content => $content, - mode => $mode, owner => $owner, group => $group, - alias => "cf_part_${name}", - notify => Exec["concat_${dir}"], - } - -} diff --git a/custom_zulip_files/puppet/puppet-common/manifests/concatfilepart.pp b/custom_zulip_files/puppet/puppet-common/manifests/concatfilepart.pp deleted file mode 100644 index 428da94..0000000 --- a/custom_zulip_files/puppet/puppet-common/manifests/concatfilepart.pp +++ /dev/null @@ -1,91 +0,0 @@ -# Inspired by David Schmitt's concatenated_file.pp - -define common::concatfilepart ( - $ensure = present, - $file, - $content = false, - $source = false, - $manage = false -) { - - # Resulting file - if defined(File[$file]) { - debug("${file} already defined") - } else { - file {$file: - ensure => present, - } - } - - # Directory containing file parts - $dir = "${file}.d" - - if defined(File[$dir]) { - debug("${dir} already defined") - } else { - file {$dir: - ensure => directory, - mode => 0600, - source => "puppet:///modules/common/empty/", - recurse => $manage, - purge => $manage, - force => $manage, - ignore => '.ignore', - } - } - - if $notify { - if $content { - file {"${dir}/${name}": - ensure => $ensure, - content => $content, - mode => 0600, - notify => [Exec["${file} concatenation"], $notify], - } - } else { - file {"${dir}/${name}": - ensure => $ensure, - source => $source, - mode => 0600, - notify => [Exec["${file} concatenation"], $notify], - } - } - } else { - if $content { - file {"${dir}/${name}": - ensure => $ensure, - content => $content, - mode => 0600, - notify => Exec["${file} concatenation"], - } - } else { - file {"${dir}/${name}": - ensure => $ensure, - source => $source, - mode => 0600, - notify => Exec["${file} concatenation"], - } - } - } - - # The actual file generation - if defined(Exec["${file} concatenation"]) { - - debug("Blah") - #Exec["${file} concatenation"] { - # require +> File["${dir}/${name}"], - #} - - } else { - # use >| to force clobbering the target file - exec { "${file} concatenation": - command => "/usr/bin/find ${dir} -maxdepth 1 -type f ! -name '*puppettmp' -print0 | sort -z | xargs -0 cat >| ${file}", - refreshonly => true, - subscribe => File[$dir], - before => File[$file], - # require => File["${dir}/${name}"], - #alias => [ "concat_${name}", "concat_${dir}"] , - } - } - -} diff --git a/custom_zulip_files/puppet/puppet-common/manifests/config_file.pp b/custom_zulip_files/puppet/puppet-common/manifests/config_file.pp deleted file mode 100644 index cd6ccc3..0000000 --- a/custom_zulip_files/puppet/puppet-common/manifests/config_file.pp +++ /dev/null @@ -1,53 +0,0 @@ -# common/manifests/defines/config_file.pp -- create a config file with default permissions -# Copyright (C) 2007 David Schmitt -# See LICENSE for the full license granted to you. - -# Usage: -# config_file { filename: -# content => "....\n", -# } -# -# Examples: -# -# To create the file /etc/vservers/${vs_name}/context with specific -# content: -# -# config_file { "/etc/vservers/${vs_name}/context": -# content => "${context}\n", -# notify => Exec["vs_restart_${vs_name}"], -# require => Exec["vs_create_${vs_name}"]; -# } -# -# To create the file /etc/apache2/sites-available/munin-stats with the -# content pulled from a template: -# -# config_file { "/etc/apache2/sites-available/munin-stats": -# content => template("apache/munin-stats"), -# require => Package["apache2"], -# notify => Exec["reload-apache2"] -# } - -define config_file ($content = '', $source = '', $ensure = 'present') { - file { $name: - ensure => $ensure, - # keep old versions on the server - backup => server, - # default permissions for config files - mode => 0644, owner => root, group => 0, - # really detect changes to this file - checksum => md5, - } - - case $source { - '': { } - default: { File[$name] { source => $source } } - } - - case $content { - '': { } - default: { File[$name] { content => $content } } - } - -} - - diff --git a/custom_zulip_files/puppet/puppet-common/manifests/line.pp b/custom_zulip_files/puppet/puppet-common/manifests/line.pp deleted file mode 100644 index 96df162..0000000 --- a/custom_zulip_files/puppet/puppet-common/manifests/line.pp +++ /dev/null @@ -1,42 +0,0 @@ -# common/manifests/defines/line.pp -- a trivial mechanism to ensure a line exists in a file -# Copyright (C) 2007 David Schmitt -# See LICENSE for the full license granted to you. - -# Usage: -# line { description: -# file => "filename", -# line => "content", -# ensure => {absent,*present*} -# } -# -# Example: -# The following ensures that the line "allow ^$munin_host$" exists -# in /etc/munin/munin-node.conf, and if there are any changes notify the service for -# a restart -# -# line { allow_munin_host: -# file => "/etc/munin/munin-node.conf", -# line => "allow ^$munin_host$", -# ensure => present, -# notify => Service[munin-node], -# require => Package[munin-node], -# } -# -# -define common::line($file, $line, $ensure = 'present') { - case $ensure { - default : { err ( "unknown ensure value '${ensure}'" ) } - present: { - exec { "/bin/echo '${line}' >> '${file}'": - unless => "/bin/grep -qFx '${line}' '${file}'" - } - } - absent: { - exec { "/usr/bin/perl -ni -e 'print if \$_ ne \"${line}\n\";' '${file}'": - onlyif => "/bin/grep -qFx '${line}' '${file}'" - } - } - } -} - - diff --git a/custom_zulip_files/puppet/puppet-common/manifests/modules_dir.pp b/custom_zulip_files/puppet/puppet-common/manifests/modules_dir.pp deleted file mode 100644 index 0dd86a2..0000000 --- a/custom_zulip_files/puppet/puppet-common/manifests/modules_dir.pp +++ /dev/null @@ -1,27 +0,0 @@ -# common/manifests/defines/modules_dir.pp -- create a default directory -# for storing module specific information -# -# Copyright (C) 2007 David Schmitt -# See LICENSE for the full license granted to you. - -# Usage: -# modules_dir { ["common", "common/dir1", "common/dir2" ]: } -define modules_dir ( - $mode = 0644, $owner = root, $group = 0 - ) -{ - $dir = "/var/lib/puppet/modules/${name}" - if defined(File[$dir]) { - debug("${dir} already defined") - } else { - file { - "/var/lib/puppet/modules/${name}": - source => [ "puppet:///modules/${name}/modules_dir", "puppet:///modules/common/empty"], - checksum => mtime, - # ignore the placeholder - ignore => '\.ignore', - recurse => true, purge => true, force => true, - mode => $mode, owner => $owner, group => $group; - } - } -} diff --git a/custom_zulip_files/puppet/puppet-common/manifests/modules_file.pp b/custom_zulip_files/puppet/puppet-common/manifests/modules_file.pp deleted file mode 100644 index 7c335e9..0000000 --- a/custom_zulip_files/puppet/puppet-common/manifests/modules_file.pp +++ /dev/null @@ -1,24 +0,0 @@ -# common/manifests/defines/modules_file.pp -- use a modules_dir to store module -# specific files -# -# Copyright (C) 2007 David Schmitt -# See LICENSE for the full license granted to you. - -# Usage: -# modules_file { "module/file": -# source => "puppet://..", -# mode => 644, # default -# owner => root, # default -# group => root, # default -# } -define common::modules_file ( - $source, - $mode = 0644, $owner = root, $group = root - ) -{ - file { - "/var/lib/puppet/modules/${name}": - source => $source, - mode => $mode, owner => $owner, group => $group; - } -} diff --git a/custom_zulip_files/puppet/puppet-common/manifests/replace.pp b/custom_zulip_files/puppet/puppet-common/manifests/replace.pp deleted file mode 100644 index 66acd30..0000000 --- a/custom_zulip_files/puppet/puppet-common/manifests/replace.pp +++ /dev/null @@ -1,30 +0,0 @@ -# common/manifests/defines/replace.pp -- replace a pattern in a file with a string -# Copyright (C) 2007 David Schmitt -# See LICENSE for the full license granted to you. - -# Usage: -# -# replace { description: -# file => "filename", -# pattern => "regexp", -# replacement => "replacement" -# -# Example: -# To replace the current port in /etc/munin/munin-node.conf -# with a new port, but only disturbing the file when needed: -# -# replace { set_munin_node_port: -# file => "/etc/munin/munin-node.conf", -# pattern => "^port (?!$port)[0-9]*", -# replacement => "port $port" -# } - -define common::replace($file, $pattern, $replacement) { - $pattern_no_slashes = slash_escape($pattern) - $replacement_no_slashes = slash_escape($replacement) - exec { "replace_${pattern}_${file}": - command => "/usr/bin/perl -pi -e 's/${pattern_no_slashes}/${replacement_no_slashes}/' '${file}'", - onlyif => "/usr/bin/perl -ne 'BEGIN { \$ret = 1; } \$ret = 0 if /${pattern_no_slashes}/ && ! /\\Q${replacement_no_slashes}\\E/; END { exit \$ret; }' '${file}'", - alias => "exec_$name", - } -} diff --git a/custom_zulip_files/puppet/puppet-common/manifests/require_lsbdistcodename.pp b/custom_zulip_files/puppet/puppet-common/manifests/require_lsbdistcodename.pp deleted file mode 100644 index 412c8bb..0000000 --- a/custom_zulip_files/puppet/puppet-common/manifests/require_lsbdistcodename.pp +++ /dev/null @@ -1,4 +0,0 @@ -# To fail the complete compilation, include this class -class common::require_lsbdistcodename inherits common::assert_lsbdistcodename { - exec { "false # require_lsbdistcodename": require => Exec[require_lsbdistcodename], } -} diff --git a/custom_zulip_files/puppet/puppet-common/tests/concatfilepart1.pp b/custom_zulip_files/puppet/puppet-common/tests/concatfilepart1.pp deleted file mode 100755 index 8f9c2e9..0000000 --- a/custom_zulip_files/puppet/puppet-common/tests/concatfilepart1.pp +++ /dev/null @@ -1,19 +0,0 @@ -import "../manifests/concatfilepart.pp" - -common::concatfilepart{"0_header": - ensure => present, - content => "A", - file => "/tmp/test-concat.txt", -} - -common::concatfilepart{"1_body": - ensure => present, - content => "B", - file => "/tmp/test-concat.txt", -} - -common::concatfilepart{"9_footer": - ensure => present, - content => "C", - file => "/tmp/test-concat.txt", -} diff --git a/custom_zulip_files/puppet/puppet-common/tests/concatfilepart2.pp b/custom_zulip_files/puppet/puppet-common/tests/concatfilepart2.pp deleted file mode 100755 index 3dab9d5..0000000 --- a/custom_zulip_files/puppet/puppet-common/tests/concatfilepart2.pp +++ /dev/null @@ -1,19 +0,0 @@ -import "../manifests/concatfilepart.pp" - -common::concatfilepart{"0_header": - ensure => absent, - content => "A", - file => "/tmp/test-concat.txt", -} - -common::concatfilepart{"1_body": - ensure => present, - content => "B", - file => "/tmp/test-concat.txt", -} - -common::concatfilepart{"9_footer": - ensure => present, - content => "C", - file => "/tmp/test-concat.txt", -} diff --git a/custom_zulip_files/puppet/puppet-common/tests/concatfilepart3.pp b/custom_zulip_files/puppet/puppet-common/tests/concatfilepart3.pp deleted file mode 100755 index 80bb209..0000000 --- a/custom_zulip_files/puppet/puppet-common/tests/concatfilepart3.pp +++ /dev/null @@ -1,19 +0,0 @@ -import "../manifests/concatfilepart.pp" - -common::concatfilepart{"0_blah": - ensure => present, - content => "Z", - file => "/tmp/test-concat.txt", -} - -common::concatfilepart{"1_body": - ensure => present, - content => "B", - file => "/tmp/test-concat.txt", -} - -common::concatfilepart{"9_footer": - ensure => present, - content => "C", - file => "/tmp/test-concat.txt", -} diff --git a/custom_zulip_files/puppet/puppet-common/tests/concatfilepart4.pp b/custom_zulip_files/puppet/puppet-common/tests/concatfilepart4.pp deleted file mode 100755 index 76558d0..0000000 --- a/custom_zulip_files/puppet/puppet-common/tests/concatfilepart4.pp +++ /dev/null @@ -1,19 +0,0 @@ -import "../manifests/concatfilepart.pp" - -common::concatfilepart{"0_blah": - ensure => absent, - content => "Z", - file => "/tmp/test-concat.txt", -} - -common::concatfilepart{"1_body": - ensure => absent, - content => "B", - file => "/tmp/test-concat.txt", -} - -common::concatfilepart{"9_footer": - ensure => absent, - content => "C", - file => "/tmp/test-concat.txt", -} diff --git a/custom_zulip_files/puppet/puppet-common/tests/run-tests.sh b/custom_zulip_files/puppet/puppet-common/tests/run-tests.sh deleted file mode 100755 index 4e3cbf8..0000000 --- a/custom_zulip_files/puppet/puppet-common/tests/run-tests.sh +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/sh - -error() { - echo "Error" - exit 1 -} - -TF="/tmp/test-concat.txt" - -echo "concatfilepart" -echo - -rm -r /tmp/test-concat.txt* - -puppet concatfilepart1.pp -echo "ABC =? $(cat /tmp/test-concat.txt)" - -puppet concatfilepart2.pp -echo "BC =? $(cat /tmp/test-concat.txt)" - -puppet concatfilepart3.pp -echo "ZBC =? $(cat /tmp/test-concat.txt)" - -puppet concatfilepart4.pp -echo " =? $(cat /tmp/test-concat.txt)" diff --git a/custom_zulip_files/puppet/stdlib/CHANGELOG b/custom_zulip_files/puppet/stdlib/CHANGELOG deleted file mode 100644 index e1a095f..0000000 --- a/custom_zulip_files/puppet/stdlib/CHANGELOG +++ /dev/null @@ -1,278 +0,0 @@ -2013-05-06 - Jeff McCune - 4.1.0 - * (#20582) Restore facter_dot_d to stdlib for PE users (3b887c8) - * (maint) Update Gemfile with GEM_FACTER_VERSION (f44d535) - -2013-05-06 - Alex Cline - 4.1.0 - * Terser method of string to array conversion courtesy of ethooz. (d38bce0) - -2013-05-06 - Alex Cline 4.1.0 - * Refactor ensure_resource expectations (b33cc24) - -2013-05-06 - Alex Cline 4.1.0 - * Changed str-to-array conversion and removed abbreviation. (de253db) - -2013-05-03 - Alex Cline 4.1.0 - * (#20548) Allow an array of resource titles to be passed into the ensure_resource function (e08734a) - -2013-05-02 - Raphaël Pinson - 4.1.0 - * Add a dirname function (2ba9e47) - -2013-04-29 - Mark Smith-Guerrero - 4.1.0 - * (maint) Fix a small typo in hash() description (928036a) - -2013-04-12 - Jeff McCune - 4.0.2 - * Update user information in gemspec to make the intent of the Gem clear. - -2013-04-11 - Jeff McCune - 4.0.1 - * Fix README function documentation (ab3e30c) - -2013-04-11 - Jeff McCune - 4.0.0 - * stdlib 4.0 drops support with Puppet 2.7 - * stdlib 4.0 preserves support with Puppet 3 - -2013-04-11 - Jeff McCune - 4.0.0 - * Add ability to use puppet from git via bundler (9c5805f) - -2013-04-10 - Jeff McCune - 4.0.0 - * (maint) Make stdlib usable as a Ruby GEM (e81a45e) - -2013-04-10 - Erik Dalén - 4.0.0 - * Add a count function (f28550e) - -2013-03-31 - Amos Shapira - 4.0.0 - * (#19998) Implement any2array (7a2fb80) - -2013-03-29 - Steve Huff - 4.0.0 - * (19864) num2bool match fix (8d217f0) - -2013-03-20 - Erik Dalén - 4.0.0 - * Allow comparisons of Numeric and number as String (ff5dd5d) - -2013-03-26 - Richard Soderberg - 4.0.0 - * add suffix function to accompany the prefix function (88a93ac) - -2013-03-19 - Kristof Willaert - 4.0.0 - * Add floor function implementation and unit tests (0527341) - -2012-04-03 - Eric Shamow - 4.0.0 - * (#13610) Add is_function_available to stdlib (961dcab) - -2012-12-17 - Justin Lambert - 4.0.0 - * str2bool should return a boolean if called with a boolean (5d5a4d4) - -2012-10-23 - Uwe Stuehler - 4.0.0 - * Fix number of arguments check in flatten() (e80207b) - -2013-03-11 - Jeff McCune - 4.0.0 - * Add contributing document (96e19d0) - -2013-03-04 - Raphaël Pinson - 4.0.0 - * Add missing documentation for validate_augeas and validate_cmd to README.markdown (a1510a1) - -2013-02-14 - Joshua Hoblitt - 4.0.0 - * (#19272) Add has_element() function (95cf3fe) - -2013-02-07 - Raphaël Pinson - 4.0.0 - * validate_cmd(): Use Puppet::Util::Execution.execute when available (69248df) - -2012-12-06 - Raphaël Pinson - 4.0.0 - * Add validate_augeas function (3a97c23) - -2012-12-06 - Raphaël Pinson - 4.0.0 - * Add validate_cmd function (6902cc5) - -2013-01-14 - David Schmitt - 4.0.0 - * Add geppetto project definition (b3fc0a3) - -2013-01-02 - Jaka Hudoklin - 4.0.0 - * Add getparam function to get defined resource parameters (20e0e07) - -2013-01-05 - Jeff McCune - 4.0.0 - * (maint) Add Travis CI Support (d082046) - -2012-12-04 - Jeff McCune - 4.0.0 - * Clarify that stdlib 3 supports Puppet 3 (3a6085f) - -2012-11-30 - Erik Dalén - 4.0.0 - * maint: style guideline fixes (7742e5f) - -2012-11-09 - James Fryman - 4.0.0 - * puppet-lint cleanup (88acc52) - -2012-11-06 - Joe Julian - 4.0.0 - * Add function, uriescape, to URI.escape strings. Redmine #17459 (fd52b8d) - -2012-09-18 - Chad Metcalf - 3.2.0 - * Add an ensure_packages function. (8a8c09e) - -2012-11-23 - Erik Dalén - 3.2.0 - * (#17797) min() and max() functions (9954133) - -2012-05-23 - Peter Meier - 3.2.0 - * (#14670) autorequire a file_line resource's path (dfcee63) - -2012-11-19 - Joshua Harlan Lifton - 3.2.0 - * Add join_keys_to_values function (ee0f2b3) - -2012-11-17 - Joshua Harlan Lifton - 3.2.0 - * Extend delete function for strings and hashes (7322e4d) - -2012-08-03 - Gary Larizza - 3.2.0 - * Add the pick() function (ba6dd13) - -2012-03-20 - Wil Cooley - 3.2.0 - * (#13974) Add predicate functions for interface facts (f819417) - -2012-11-06 - Joe Julian - 3.2.0 - * Add function, uriescape, to URI.escape strings. Redmine #17459 (70f4a0e) - -2012-10-25 - Jeff McCune - 3.1.1 - * (maint) Fix spec failures resulting from Facter API changes (97f836f) - -2012-10-23 - Matthaus Owens - 3.1.0 - * Add PE facts to stdlib (cdf3b05) - -2012-08-16 - Jeff McCune - 3.0.1 - * Fix accidental removal of facts_dot_d.rb in 3.0.0 release - -2012-08-16 - Jeff McCune - 3.0.0 - * stdlib 3.0 drops support with Puppet 2.6 - * stdlib 3.0 preserves support with Puppet 2.7 - -2012-08-07 - Dan Bode - 3.0.0 - * Add function ensure_resource and defined_with_params (ba789de) - -2012-07-10 - Hailee Kenney - 3.0.0 - * (#2157) Remove facter_dot_d for compatibility with external facts (f92574f) - -2012-04-10 - Chris Price - 3.0.0 - * (#13693) moving logic from local spec_helper to puppetlabs_spec_helper (85f96df) - -2012-10-25 - Jeff McCune - 2.5.1 - * (maint) Fix spec failures resulting from Facter API changes (97f836f) - -2012-10-23 - Matthaus Owens - 2.5.0 - * Add PE facts to stdlib (cdf3b05) - -2012-08-15 - Dan Bode - 2.5.0 - * Explicitly load functions used by ensure_resource (9fc3063) - -2012-08-13 - Dan Bode - 2.5.0 - * Add better docs about duplicate resource failures (97d327a) - -2012-08-13 - Dan Bode - 2.5.0 - * Handle undef for parameter argument (4f8b133) - -2012-08-07 - Dan Bode - 2.5.0 - * Add function ensure_resource and defined_with_params (a0cb8cd) - -2012-08-20 - Jeff McCune - 2.5.0 - * Disable tests that fail on 2.6.x due to #15912 (c81496e) - -2012-08-20 - Jeff McCune - 2.5.0 - * (Maint) Fix mis-use of rvalue functions as statements (4492913) - -2012-08-20 - Jeff McCune - 2.5.0 - * Add .rspec file to repo root (88789e8) - -2012-06-07 - Chris Price - 2.4.0 - * Add support for a 'match' parameter to file_line (a06c0d8) - -2012-08-07 - Erik Dalén - 2.4.0 - * (#15872) Add to_bytes function (247b69c) - -2012-07-19 - Jeff McCune - 2.4.0 - * (Maint) use PuppetlabsSpec::PuppetInternals.scope (master) (deafe88) - -2012-07-10 - Hailee Kenney - 2.4.0 - * (#2157) Make facts_dot_d compatible with external facts (5fb0ddc) - -2012-03-16 - Steve Traylen - 2.4.0 - * (#13205) Rotate array/string randomley based on fqdn, fqdn_rotate() (fef247b) - -2012-05-22 - Peter Meier - 2.3.3 - * fix regression in #11017 properly (f0a62c7) - -2012-05-10 - Jeff McCune - 2.3.3 - * Fix spec tests using the new spec_helper (7d34333) - -2012-05-10 - Puppet Labs - 2.3.2 - * Make file_line default to ensure => present (1373e70) - * Memoize file_line spec instance variables (20aacc5) - * Fix spec tests using the new spec_helper (1ebfa5d) - * (#13595) initialize_everything_for_tests couples modules Puppet ver (3222f35) - * (#13439) Fix MRI 1.9 issue with spec_helper (15c5fd1) - * (#13439) Fix test failures with Puppet 2.6.x (665610b) - * (#13439) refactor spec helper for compatibility with both puppet 2.7 and master (82194ca) - * (#13494) Specify the behavior of zero padded strings (61891bb) - -2012-03-29 Puppet Labs - 2.1.3 -* (#11607) Add Rakefile to enable spec testing -* (#12377) Avoid infinite loop when retrying require json - -2012-03-13 Puppet Labs - 2.3.1 -* (#13091) Fix LoadError bug with puppet apply and puppet_vardir fact - -2012-03-12 Puppet Labs - 2.3.0 -* Add a large number of new Puppet functions -* Backwards compatibility preserved with 2.2.x - -2011-12-30 Puppet Labs - 2.2.1 -* Documentation only release for the Forge - -2011-12-30 Puppet Labs - 2.1.2 -* Documentation only release for PE 2.0.x - -2011-11-08 Puppet Labs - 2.2.0 -* #10285 - Refactor json to use pson instead. -* Maint - Add watchr autotest script -* Maint - Make rspec tests work with Puppet 2.6.4 -* #9859 - Add root_home fact and tests - -2011-08-18 Puppet Labs - 2.1.1 -* Change facts.d paths to match Facter 2.0 paths. -* /etc/facter/facts.d -* /etc/puppetlabs/facter/facts.d - -2011-08-17 Puppet Labs - 2.1.0 -* Add R.I. Pienaar's facts.d custom facter fact -* facts defined in /etc/facts.d and /etc/puppetlabs/facts.d are - automatically loaded now. - -2011-08-04 Puppet Labs - 2.0.0 -* Rename whole_line to file_line -* This is an API change and as such motivating a 2.0.0 release according to semver.org. - -2011-08-04 Puppet Labs - 1.1.0 -* Rename append_line to whole_line -* This is an API change and as such motivating a 1.1.0 release. - -2011-08-04 Puppet Labs - 1.0.0 -* Initial stable release -* Add validate_array and validate_string functions -* Make merge() function work with Ruby 1.8.5 -* Add hash merging function -* Add has_key function -* Add loadyaml() function -* Add append_line native - -2011-06-21 Jeff McCune - 0.1.7 -* Add validate_hash() and getvar() functions - -2011-06-15 Jeff McCune - 0.1.6 -* Add anchor resource type to provide containment for composite classes - -2011-06-03 Jeff McCune - 0.1.5 -* Add validate_bool() function to stdlib - -0.1.4 2011-05-26 Jeff McCune -* Move most stages after main - -0.1.3 2011-05-25 Jeff McCune -* Add validate_re() function - -0.1.2 2011-05-24 Jeff McCune -* Update to add annotated tag - -0.1.1 2011-05-24 Jeff McCune -* Add stdlib::stages class with a standard set of stages diff --git a/custom_zulip_files/puppet/stdlib/CONTRIBUTING.md b/custom_zulip_files/puppet/stdlib/CONTRIBUTING.md deleted file mode 100644 index bd11f63..0000000 --- a/custom_zulip_files/puppet/stdlib/CONTRIBUTING.md +++ /dev/null @@ -1,65 +0,0 @@ -# How to contribute - -Third-party patches are essential for keeping stdlib great. We simply can't -access the huge number of platforms and myriad configurations for running -stdlib. We want to keep it as easy as possible to contribute changes that -get things working in your environment. There are a few guidelines that we -need contributors to follow so that we can have a chance of keeping on -top of things. - -## Getting Started - -* Make sure you have a [Redmine account](http://projects.puppetlabs.com) -* Make sure you have a [GitHub account](https://github.com/signup/free) -* Submit a ticket for your issue, assuming one does not already exist. - * Clearly describe the issue including steps to reproduce when it is a bug. - * Make sure you fill in the earliest version that you know has the issue. -* Fork the repository on GitHub - -## Making Changes - -* Create a topic branch from where you want to base your work. - * This is usually the master branch. - * Only target release branches if you are certain your fix must be on that - branch. - * To quickly create a topic branch based on master; `git branch - fix/master/my_contribution master` then checkout the new branch with `git - checkout fix/master/my_contribution`. Please avoid working directly on the - `master` branch. -* Make commits of logical units. -* Check for unnecessary whitespace with `git diff --check` before committing. -* Make sure your commit messages are in the proper format. - -```` - (#99999) Make the example in CONTRIBUTING imperative and concrete - - Without this patch applied the example commit message in the CONTRIBUTING - document is not a concrete example. This is a problem because the - contributor is left to imagine what the commit message should look like - based on a description rather than an example. This patch fixes the - problem by making the example concrete and imperative. - - The first line is a real life imperative statement with a ticket number - from our issue tracker. The body describes the behavior without the patch, - why this is a problem, and how the patch fixes the problem when applied. -```` - -* Make sure you have added the necessary tests for your changes. -* Run _all_ the tests to assure nothing else was accidentally broken. - -## Submitting Changes - -* Sign the [Contributor License Agreement](http://links.puppetlabs.com/cla). -* Push your changes to a topic branch in your fork of the repository. -* Submit a pull request to the repository in the puppetlabs organization. -* Update your Redmine ticket to mark that you have submitted code and are ready for it to be reviewed. - * Include a link to the pull request in the ticket - -# Additional Resources - -* [More information on contributing](http://links.puppetlabs.com/contribute-to-puppet) -* [Bug tracker (Redmine)](http://projects.puppetlabs.com) -* [Contributor License Agreement](http://links.puppetlabs.com/cla) -* [General GitHub documentation](http://help.github.com/) -* [GitHub pull request documentation](http://help.github.com/send-pull-requests/) -* #puppet-dev IRC channel on freenode.org diff --git a/custom_zulip_files/puppet/stdlib/Gemfile b/custom_zulip_files/puppet/stdlib/Gemfile deleted file mode 100644 index 197cc6b..0000000 --- a/custom_zulip_files/puppet/stdlib/Gemfile +++ /dev/null @@ -1,42 +0,0 @@ -source "https://rubygems.org" - -def location_for(place, fake_version = nil) - mdata = /^(git:[^#]*)#(.*)/.match(place) - if mdata - [fake_version, { :git => mdata[1], :branch => mdata[2], :require => false }].compact - elsif place =~ /^file:\/\/(.*)/ - ['>= 0', { :path => File.expand_path(mdata[1]), :require => false }] - else - [place, { :require => false }] - end -end - -group :development do - gem 'watchr' -end - -group :development, :test do - gem 'rake' - gem 'puppetmodule-stdlib', ">= 1.0.0", :path => File.expand_path("..", __FILE__) - gem 'rspec', "~> 2.11.0", :require => false - gem 'mocha', "~> 0.10.5", :require => false - gem 'puppetlabs_spec_helper', :require => false - gem 'rspec-puppet', :require => false -end - -facterversion = ENV['GEM_FACTER_VERSION'] -if facterversion - gem 'facter', *location_for(facterversion) -else - gem 'facter', :require => false -end - -ENV['GEM_PUPPET_VERSION'] ||= ENV['PUPPET_GEM_VERSION'] -puppetversion = ENV['GEM_PUPPET_VERSION'] -if puppetversion - gem 'puppet', *location_for(puppetversion) -else - gem 'puppet', :require => false -end - -# vim:ft=ruby diff --git a/custom_zulip_files/puppet/stdlib/LICENSE b/custom_zulip_files/puppet/stdlib/LICENSE deleted file mode 100644 index ec0587c..0000000 --- a/custom_zulip_files/puppet/stdlib/LICENSE +++ /dev/null @@ -1,19 +0,0 @@ -Copyright (C) 2011 Puppet Labs Inc - -and some parts: - -Copyright (C) 2011 Krzysztof Wilczynski - -Puppet Labs can be contacted at: info@puppetlabs.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. diff --git a/custom_zulip_files/puppet/stdlib/Modulefile b/custom_zulip_files/puppet/stdlib/Modulefile deleted file mode 100644 index 9d2e8c2..0000000 --- a/custom_zulip_files/puppet/stdlib/Modulefile +++ /dev/null @@ -1,11 +0,0 @@ -name 'puppetlabs-stdlib' -version '4.1.0' -source 'git://github.com/puppetlabs/puppetlabs-stdlib.git' -author 'puppetlabs' -license 'Apache 2.0' -summary 'Puppet Module Standard Library' -description 'Standard Library for Puppet Modules' -project_page 'https://github.com/puppetlabs/puppetlabs-stdlib' - -## Add dependencies, if any: -# dependency 'username/name', '>= 1.2.0' diff --git a/custom_zulip_files/puppet/stdlib/README.markdown b/custom_zulip_files/puppet/stdlib/README.markdown deleted file mode 100644 index 7b45b17..0000000 --- a/custom_zulip_files/puppet/stdlib/README.markdown +++ /dev/null @@ -1,1194 +0,0 @@ -# Puppet Labs Standard Library # - -[![Build Status](https://travis-ci.org/puppetlabs/puppetlabs-stdlib.png?branch=master)](https://travis-ci.org/puppetlabs/puppetlabs-stdlib) - -This module provides a "standard library" of resources for developing Puppet -Modules. This modules will include the following additions to Puppet - - * Stages - * Facts - * Functions - * Defined resource types - * Types - * Providers - -This module is officially curated and provided by Puppet Labs. The modules -Puppet Labs writes and distributes will make heavy use of this standard -library. - -To report or research a bug with any part of this module, please go to -[http://projects.puppetlabs.com/projects/stdlib](http://projects.puppetlabs.com/projects/stdlib) - -# Versions # - -This module follows semver.org (v1.0.0) versioning guidelines. The standard -library module is released as part of [Puppet -Enterprise](http://puppetlabs.com/puppet/puppet-enterprise/) and as a result -older versions of Puppet Enterprise that Puppet Labs still supports will have -bugfix maintenance branches periodically "merged up" into master. The current -list of integration branches are: - - * v2.1.x (v2.1.1 released in PE 1) - * v2.2.x (Never released as part of PE, only to the Forge) - * v2.3.x (Released in PE 2) - * v3.0.x (Never released as part of PE, only to the Forge) - * v4.0.x (Drops support for Puppet 2.7) - * master (mainline development branch) - -The first Puppet Enterprise version including the stdlib module is Puppet -Enterprise 1.2. - -# Compatibility # - -Puppet Versions | < 2.6 | 2.6 | 2.7 | 3.x | -:---------------|:-----:|:---:|:---:|:----: -**stdlib 2.x** | no | **yes** | **yes** | no -**stdlib 3.x** | no | no | **yes** | **yes** -**stdlib 4.x** | no | no | no | **yes** - -The stdlib module does not work with Puppet versions released prior to Puppet -2.6.0. - -## stdlib 2.x ## - -All stdlib releases in the 2.0 major version support Puppet 2.6 and Puppet 2.7. - -## stdlib 3.x ## - -The 3.0 major release of stdlib drops support for Puppet 2.6. Stdlib 3.x -supports Puppet 2 and Puppet 3. - -## stdlib 4.x ## - -The 4.0 major release of stdlib drops support for Puppet 2.7. Stdlib 4.x -supports Puppet 3. Notably, ruby 1.8.5 is no longer supported though ruby -1.8.7, 1.9.3, and 2.0.0 are fully supported. - -# Functions # - -abs ---- -Returns the absolute value of a number, for example -34.56 becomes -34.56. Takes a single integer and float value as an argument. - - -- *Type*: rvalue - -any2array ---------- -This converts any object to an array containing that object. Empty argument -lists are converted to an empty array. Arrays are left untouched. Hashes are -converted to arrays of alternating keys and values. - - -- *Type*: rvalue - -bool2num --------- -Converts a boolean to a number. Converts the values: -false, f, 0, n, and no to 0 -true, t, 1, y, and yes to 1 - Requires a single boolean or string as an input. - - -- *Type*: rvalue - -capitalize ----------- -Capitalizes the first letter of a string or array of strings. -Requires either a single string or an array as an input. - - -- *Type*: rvalue - -chomp ------ -Removes the record separator from the end of a string or an array of -strings, for example `hello\n` becomes `hello`. -Requires a single string or array as an input. - - -- *Type*: rvalue - -chop ----- -Returns a new string with the last character removed. If the string ends -with `\r\n`, both characters are removed. Applying chop to an empty -string returns an empty string. If you wish to merely remove record -separators then you should use the `chomp` function. -Requires a string or array of strings as input. - - -- *Type*: rvalue - -concat ------- -Appends the contents of array 2 onto array 1. - -*Example:* - - concat(['1','2','3'],['4','5','6']) - -Would result in: - - ['1','2','3','4','5','6'] - - -- *Type*: rvalue - -count ------ -Takes an array as first argument and an optional second argument. -Count the number of elements in array that matches second argument. -If called with only an array it counts the number of elements that are not nil/undef. - - -- *Type*: rvalue - -defined_with_params -------------------- -Takes a resource reference and an optional hash of attributes. - -Returns true if a resource with the specified attributes has already been added -to the catalog, and false otherwise. - - user { 'dan': - ensure => present, - } - - if ! defined_with_params(User[dan], {'ensure' => 'present' }) { - user { 'dan': ensure => present, } - } - - -- *Type*: rvalue - -delete ------- -Deletes all instances of a given element from an array, substring from a -string, or key from a hash. - -*Examples:* - - delete(['a','b','c','b'], 'b') - Would return: ['a','c'] - - delete({'a'=>1,'b'=>2,'c'=>3}, 'b') - Would return: {'a'=>1,'c'=>3} - - delete('abracadabra', 'bra') - Would return: 'acada' - - -- *Type*: rvalue - -delete_at ---------- -Deletes a determined indexed value from an array. - -*Examples:* - - delete_at(['a','b','c'], 1) - -Would return: ['a','c'] - - -- *Type*: rvalue - -dirname -------- -Returns the `dirname` of a path. - -*Examples:* - - dirname('/path/to/a/file.ext') - -Would return: '/path/to/a' - -downcase --------- -Converts the case of a string or all strings in an array to lower case. - - -- *Type*: rvalue - -empty ------ -Returns true if the variable is empty. - - -- *Type*: rvalue - -ensure_packages ---------------- -Takes a list of packages and only installs them if they don't already exist. - - -- *Type*: statement - -ensure_resource ---------------- -Takes a resource type, title, and a list of attributes that describe a -resource. - - user { 'dan': - ensure => present, - } - -This example only creates the resource if it does not already exist: - - ensure_resource('user, 'dan', {'ensure' => 'present' }) - -If the resource already exists but does not match the specified parameters, -this function will attempt to recreate the resource leading to a duplicate -resource definition error. - -An array of resources can also be passed in and each will be created with -the type and parameters specified if it doesn't already exist. - - ensure_resource('user', ['dan','alex'], {'ensure' => 'present'}) - - - -- *Type*: statement - -flatten -------- -This function flattens any deeply nested arrays and returns a single flat array -as a result. - -*Examples:* - - flatten(['a', ['b', ['c']]]) - -Would return: ['a','b','c'] - - -- *Type*: rvalue - -floor ------ -Returns the largest integer less or equal to the argument. -Takes a single numeric value as an argument. - - -- *Type*: rvalue - -fqdn_rotate ------------ -Rotates an array a random number of times based on a nodes fqdn. - - -- *Type*: rvalue - -get_module_path ---------------- -Returns the absolute path of the specified module for the current -environment. - -Example: - $module_path = get_module_path('stdlib') - - -- *Type*: rvalue - -getparam --------- -Takes a resource reference and name of the parameter and -returns value of resource's parameter. - -*Examples:* - - define example_resource($param) { - } - - example_resource { "example_resource_instance": - param => "param_value" - } - - getparam(Example_resource["example_resource_instance"], "param") - -Would return: param_value - - -- *Type*: rvalue - -getvar ------- -Lookup a variable in a remote namespace. - -For example: - - $foo = getvar('site::data::foo') - # Equivalent to $foo = $site::data::foo - -This is useful if the namespace itself is stored in a string: - - $datalocation = 'site::data' - $bar = getvar("${datalocation}::bar") - # Equivalent to $bar = $site::data::bar - - -- *Type*: rvalue - -grep ----- -This function searches through an array and returns any elements that match -the provided regular expression. - -*Examples:* - - grep(['aaa','bbb','ccc','aaaddd'], 'aaa') - -Would return: - - ['aaa','aaaddd'] - - -- *Type*: rvalue - -has_interface_with ------------------- -Returns boolean based on kind and value: -* macaddress -* netmask -* ipaddress -* network - -has_interface_with("macaddress", "x:x:x:x:x:x") -has_interface_with("ipaddress", "127.0.0.1") => true -etc. - -If no "kind" is given, then the presence of the interface is checked: -has_interface_with("lo") => true - - -- *Type*: rvalue - -has_ip_address --------------- -Returns true if the client has the requested IP address on some interface. - -This function iterates through the 'interfaces' fact and checks the -'ipaddress_IFACE' facts, performing a simple string comparison. - - -- *Type*: rvalue - -has_ip_network --------------- -Returns true if the client has an IP address within the requested network. - -This function iterates through the 'interfaces' fact and checks the -'network_IFACE' facts, performing a simple string comparision. - - -- *Type*: rvalue - -has_key -------- -Determine if a hash has a certain key value. - -Example: - - $my_hash = {'key_one' => 'value_one'} - if has_key($my_hash, 'key_two') { - notice('we will not reach here') - } - if has_key($my_hash, 'key_one') { - notice('this will be printed') - } - - - -- *Type*: rvalue - -hash ----- -This function converts an array into a hash. - -*Examples:* - - hash(['a',1,'b',2,'c',3]) - -Would return: {'a'=>1,'b'=>2,'c'=>3} - - -- *Type*: rvalue - -is_array --------- -Returns true if the variable passed to this function is an array. - -- *Type*: rvalue - -is_domain_name --------------- -Returns true if the string passed to this function is a syntactically correct domain name. - -- *Type*: rvalue - -is_float --------- -Returns true if the variable passed to this function is a float. - -- *Type*: rvalue - -is_function_available ---------------------- -This function accepts a string as an argument, determines whether the -Puppet runtime has access to a function by that name. It returns a -true if the function exists, false if not. - -- *Type*: rvalue - -is_hash -------- -Returns true if the variable passed to this function is a hash. - -- *Type*: rvalue - -is_integer ----------- -Returns true if the variable returned to this string is an integer. - -- *Type*: rvalue - -is_ip_address -------------- -Returns true if the string passed to this function is a valid IP address. - -- *Type*: rvalue - -is_mac_address --------------- -Returns true if the string passed to this function is a valid mac address. - -- *Type*: rvalue - -is_numeric ----------- -Returns true if the variable passed to this function is a number. - -- *Type*: rvalue - -is_string ---------- -Returns true if the variable passed to this function is a string. - -- *Type*: rvalue - -join ----- -This function joins an array into a string using a seperator. - -*Examples:* - - join(['a','b','c'], ",") - -Would result in: "a,b,c" - -- *Type*: rvalue - -join_keys_to_values -------------------- -This function joins each key of a hash to that key's corresponding value with a -separator. Keys and values are cast to strings. The return value is an array in -which each element is one joined key/value pair. - -*Examples:* - - join_keys_to_values({'a'=>1,'b'=>2}, " is ") - -Would result in: ["a is 1","b is 2"] - -- *Type*: rvalue - -keys ----- -Returns the keys of a hash as an array. - -- *Type*: rvalue - -loadyaml --------- -Load a YAML file containing an array, string, or hash, and return the data -in the corresponding native data type. - -For example: - - $myhash = loadyaml('/etc/puppet/data/myhash.yaml') - - -- *Type*: rvalue - -lstrip ------- -Strips leading spaces to the left of a string. - -- *Type*: rvalue - -max ---- -Returns the highest value of all arguments. -Requires at least one argument. - -- *Type*: rvalue - -member ------- -This function determines if a variable is a member of an array. - -*Examples:* - - member(['a','b'], 'b') - -Would return: true - - member(['a','b'], 'c') - -Would return: false - -- *Type*: rvalue - -merge ------ -Merges two or more hashes together and returns the resulting hash. - -For example: - - $hash1 = {'one' => 1, 'two', => 2} - $hash2 = {'two' => 'dos', 'three', => 'tres'} - $merged_hash = merge($hash1, $hash2) - # The resulting hash is equivalent to: - # $merged_hash = {'one' => 1, 'two' => 'dos', 'three' => 'tres'} - -When there is a duplicate key, the key in the rightmost hash will "win." - -- *Type*: rvalue - -min ---- -Returns the lowest value of all arguments. -Requires at least one argument. - -- *Type*: rvalue - -num2bool --------- -This function converts a number or a string representation of a number into a -true boolean. Zero or anything non-numeric becomes false. Numbers higher then 0 -become true. - -- *Type*: rvalue - -parsejson ---------- -This function accepts JSON as a string and converts into the correct Puppet -structure. - -- *Type*: rvalue - -parseyaml ---------- -This function accepts YAML as a string and converts it into the correct -Puppet structure. - -- *Type*: rvalue - -pick ----- -This function is similar to a coalesce function in SQL in that it will return -the first value in a list of values that is not undefined or an empty string -(two things in Puppet that will return a boolean false value). Typically, -this function is used to check for a value in the Puppet Dashboard/Enterprise -Console, and failover to a default value like the following: - - $real_jenkins_version = pick($::jenkins_version, '1.449') - -The value of $real_jenkins_version will first look for a top-scope variable -called 'jenkins_version' (note that parameters set in the Puppet Dashboard/ -Enterprise Console are brought into Puppet as top-scope variables), and, -failing that, will use a default value of 1.449. - -- *Type*: rvalue - -prefix ------- -This function applies a prefix to all elements in an array. - -*Examples:* - - prefix(['a','b','c'], 'p') - -Will return: ['pa','pb','pc'] - -- *Type*: rvalue - -range ------ -When given range in the form of (start, stop) it will extrapolate a range as -an array. - -*Examples:* - - range("0", "9") - -Will return: [0,1,2,3,4,5,6,7,8,9] - - range("00", "09") - -Will return: [0,1,2,3,4,5,6,7,8,9] (Zero padded strings are converted to -integers automatically) - - range("a", "c") - -Will return: ["a","b","c"] - - range("host01", "host10") - -Will return: ["host01", "host02", ..., "host09", "host10"] - -- *Type*: rvalue - -reject ------- -This function searches through an array and rejects all elements that match -the provided regular expression. - -*Examples:* - - reject(['aaa','bbb','ccc','aaaddd'], 'aaa') - -Would return: - - ['bbb','ccc'] - - -- *Type*: rvalue - -reverse -------- -Reverses the order of a string or array. - -- *Type*: rvalue - -rstrip ------- -Strips leading spaces to the right of the string. - -- *Type*: rvalue - -shuffle -------- -Randomizes the order of a string or array elements. - -- *Type*: rvalue - -size ----- -Returns the number of elements in a string or array. - -- *Type*: rvalue - -sort ----- -Sorts strings and arrays lexically. - -- *Type*: rvalue - -squeeze -------- -Returns a new string where runs of the same character that occur in this set -are replaced by a single character. - -- *Type*: rvalue - -str2bool --------- -This converts a string to a boolean. This attempt to convert strings that -contain things like: y, 1, t, true to 'true' and strings that contain things -like: 0, f, n, false, no to 'false'. - - -- *Type*: rvalue - -str2saltedsha512 ----------------- -This converts a string to a salted-SHA512 password hash (which is used for -OS X versions >= 10.7). Given any simple string, you will get a hex version -of a salted-SHA512 password hash that can be inserted into your Puppet -manifests as a valid password attribute. - - -- *Type*: rvalue - -strftime --------- -This function returns formatted time. - -*Examples:* - -To return the time since epoch: - - strftime("%s") - -To return the date: - - strftime("%Y-%m-%d") - -*Format meaning:* - - %a - The abbreviated weekday name (``Sun'') - %A - The full weekday name (``Sunday'') - %b - The abbreviated month name (``Jan'') - %B - The full month name (``January'') - %c - The preferred local date and time representation - %C - Century (20 in 2009) - %d - Day of the month (01..31) - %D - Date (%m/%d/%y) - %e - Day of the month, blank-padded ( 1..31) - %F - Equivalent to %Y-%m-%d (the ISO 8601 date format) - %h - Equivalent to %b - %H - Hour of the day, 24-hour clock (00..23) - %I - Hour of the day, 12-hour clock (01..12) - %j - Day of the year (001..366) - %k - hour, 24-hour clock, blank-padded ( 0..23) - %l - hour, 12-hour clock, blank-padded ( 0..12) - %L - Millisecond of the second (000..999) - %m - Month of the year (01..12) - %M - Minute of the hour (00..59) - %n - Newline ( -) - %N - Fractional seconds digits, default is 9 digits (nanosecond) - %3N millisecond (3 digits) - %6N microsecond (6 digits) - %9N nanosecond (9 digits) - %p - Meridian indicator (``AM'' or ``PM'') - %P - Meridian indicator (``am'' or ``pm'') - %r - time, 12-hour (same as %I:%M:%S %p) - %R - time, 24-hour (%H:%M) - %s - Number of seconds since 1970-01-01 00:00:00 UTC. - %S - Second of the minute (00..60) - %t - Tab character ( ) - %T - time, 24-hour (%H:%M:%S) - %u - Day of the week as a decimal, Monday being 1. (1..7) - %U - Week number of the current year, - starting with the first Sunday as the first - day of the first week (00..53) - %v - VMS date (%e-%b-%Y) - %V - Week number of year according to ISO 8601 (01..53) - %W - Week number of the current year, - starting with the first Monday as the first - day of the first week (00..53) - %w - Day of the week (Sunday is 0, 0..6) - %x - Preferred representation for the date alone, no time - %X - Preferred representation for the time alone, no date - %y - Year without a century (00..99) - %Y - Year with century - %z - Time zone as hour offset from UTC (e.g. +0900) - %Z - Time zone name - %% - Literal ``%'' character - - -- *Type*: rvalue - -strip ------ -This function removes leading and trailing whitespace from a string or from -every string inside an array. - -*Examples:* - - strip(" aaa ") - -Would result in: "aaa" - - -- *Type*: rvalue - -suffix ------- -This function applies a suffix to all elements in an array. - -*Examples:* - - suffix(['a','b','c'], 'p') - -Will return: ['ap','bp','cp'] - - -- *Type*: rvalue - -swapcase --------- -This function will swap the existing case of a string. - -*Examples:* - - swapcase("aBcD") - -Would result in: "AbCd" - - -- *Type*: rvalue - -time ----- -This function will return the current time since epoch as an integer. - -*Examples:* - - time() - -Will return something like: 1311972653 - - -- *Type*: rvalue - -to_bytes --------- -Converts the argument into bytes, for example 4 kB becomes 4096. -Takes a single string value as an argument. - - -- *Type*: rvalue - -type ----- -Returns the type when passed a variable. Type can be one of: - -* string -* array -* hash -* float -* integer -* boolean - - -- *Type*: rvalue - -unique ------- -This function will remove duplicates from strings and arrays. - -*Examples:* - - unique("aabbcc") - -Will return: - - abc - -You can also use this with arrays: - - unique(["a","a","b","b","c","c"]) - -This returns: - - ["a","b","c"] - - -- *Type*: rvalue - -upcase ------- -Converts a string or an array of strings to uppercase. - -*Examples:* - - upcase("abcd") - -Will return: - - ASDF - - -- *Type*: rvalue - -uriescape ---------- -Urlencodes a string or array of strings. -Requires either a single string or an array as an input. - - -- *Type*: rvalue - -validate_absolute_path ----------------------- -Validate the string represents an absolute path in the filesystem. This function works -for windows and unix style paths. - -The following values will pass: - - $my_path = "C:/Program Files (x86)/Puppet Labs/Puppet" - validate_absolute_path($my_path) - $my_path2 = "/var/lib/puppet" - validate_absolute_path($my_path2) - - -The following values will fail, causing compilation to abort: - - validate_absolute_path(true) - validate_absolute_path([ 'var/lib/puppet', '/var/foo' ]) - validate_absolute_path([ '/var/lib/puppet', 'var/foo' ]) - $undefined = undef - validate_absolute_path($undefined) - - - -- *Type*: statement - -validate_array --------------- -Validate that all passed values are array data structures. Abort catalog -compilation if any value fails this check. - -The following values will pass: - - $my_array = [ 'one', 'two' ] - validate_array($my_array) - -The following values will fail, causing compilation to abort: - - validate_array(true) - validate_array('some_string') - $undefined = undef - validate_array($undefined) - - - -- *Type*: statement - -validate_augeas ---------------- -Perform validation of a string using an Augeas lens -The first argument of this function should be a string to -test, and the second argument should be the name of the Augeas lens to use. -If Augeas fails to parse the string with the lens, the compilation will -abort with a parse error. - -A third argument can be specified, listing paths which should -not be found in the file. The `$file` variable points to the location -of the temporary file being tested in the Augeas tree. - -For example, if you want to make sure your passwd content never contains -a user `foo`, you could write: - - validate_augeas($passwdcontent, 'Passwd.lns', ['$file/foo']) - -Or if you wanted to ensure that no users used the '/bin/barsh' shell, -you could use: - - validate_augeas($passwdcontent, 'Passwd.lns', ['$file/*[shell="/bin/barsh"]'] - -If a fourth argument is specified, this will be the error message raised and -seen by the user. - -A helpful error message can be returned like this: - - validate_augeas($sudoerscontent, 'Sudoers.lns', [], 'Failed to validate sudoers content with Augeas') - - - -- *Type*: statement - -validate_bool -------------- -Validate that all passed values are either true or false. Abort catalog -compilation if any value fails this check. - -The following values will pass: - - $iamtrue = true - validate_bool(true) - validate_bool(true, true, false, $iamtrue) - -The following values will fail, causing compilation to abort: - - $some_array = [ true ] - validate_bool("false") - validate_bool("true") - validate_bool($some_array) - - - -- *Type*: statement - -validate_cmd ------------- -Perform validation of a string with an external command. -The first argument of this function should be a string to -test, and the second argument should be a path to a test command -taking a file as last argument. If the command, launched against -a tempfile containing the passed string, returns a non-null value, -compilation will abort with a parse error. - -If a third argument is specified, this will be the error message raised and -seen by the user. - -A helpful error message can be returned like this: - -Example: - - validate_cmd($sudoerscontent, '/usr/sbin/visudo -c -f', 'Visudo failed to validate sudoers content') - - - -- *Type*: statement - -validate_hash -------------- -Validate that all passed values are hash data structures. Abort catalog -compilation if any value fails this check. - -The following values will pass: - - $my_hash = { 'one' => 'two' } - validate_hash($my_hash) - -The following values will fail, causing compilation to abort: - - validate_hash(true) - validate_hash('some_string') - $undefined = undef - validate_hash($undefined) - - - -- *Type*: statement - -validate_re ------------ -Perform simple validation of a string against one or more regular -expressions. The first argument of this function should be a string to -test, and the second argument should be a stringified regular expression -(without the // delimiters) or an array of regular expressions. If none -of the regular expressions match the string passed in, compilation will -abort with a parse error. - -If a third argument is specified, this will be the error message raised and -seen by the user. - -The following strings will validate against the regular expressions: - - validate_re('one', '^one$') - validate_re('one', [ '^one', '^two' ]) - -The following strings will fail to validate, causing compilation to abort: - - validate_re('one', [ '^two', '^three' ]) - -A helpful error message can be returned like this: - - validate_re($::puppetversion, '^2.7', 'The $puppetversion fact value does not match 2.7') - - - -- *Type*: statement - -validate_slength ----------------- -Validate that the first argument is a string (or an array of strings), and -less/equal to than the length of the second argument. It fails if the first -argument is not a string or array of strings, and if arg 2 is not convertable -to a number. - -The following values will pass: - - validate_slength("discombobulate",17) - validate_slength(["discombobulate","moo"],17) - -The following valueis will not: - - validate_slength("discombobulate",1) - validate_slength(["discombobulate","thermometer"],5) - - - -- *Type*: statement - -validate_string ---------------- -Validate that all passed values are string data structures. Abort catalog -compilation if any value fails this check. - -The following values will pass: - - $my_string = "one two" - validate_string($my_string, 'three') - -The following values will fail, causing compilation to abort: - - validate_string(true) - validate_string([ 'some', 'array' ]) - $undefined = undef - validate_string($undefined) - - -- *Type*: statement - -values ------- -When given a hash this function will return the values of that hash. - -*Examples:* - - $hash = { - 'a' => 1, - 'b' => 2, - 'c' => 3, - } - values($hash) - -This example would return: - - [1,2,3] - - -- *Type*: rvalue - -values_at ---------- -Finds value inside an array based on location. - -The first argument is the array you want to analyze, and the second element can -be a combination of: - -* A single numeric index -* A range in the form of 'start-stop' (eg. 4-9) -* An array combining the above - -*Examples*: - - values_at(['a','b','c'], 2) - -Would return ['c']. - - values_at(['a','b','c'], ["0-1"]) - -Would return ['a','b']. - - values_at(['a','b','c','d','e'], [0, "2-3"]) - -Would return ['a','c','d']. - - -- *Type*: rvalue - -zip ---- -Takes one element from first array and merges corresponding elements from second array. This generates a sequence of n-element arrays, where n is one more than the count of arguments. - -*Example:* - - zip(['1','2','3'],['4','5','6']) - -Would result in: - - ["1", "4"], ["2", "5"], ["3", "6"] - - -- *Type*: rvalue - -*This page autogenerated on 2013-04-11 13:54:25 -0700* diff --git a/custom_zulip_files/puppet/stdlib/README_DEVELOPER.markdown b/custom_zulip_files/puppet/stdlib/README_DEVELOPER.markdown deleted file mode 100644 index 04349ed..0000000 --- a/custom_zulip_files/puppet/stdlib/README_DEVELOPER.markdown +++ /dev/null @@ -1,35 +0,0 @@ -Puppet Specific Facts -===================== - -Facter is meant to stand alone and apart from Puppet. However, Facter often -runs inside Puppet and all custom facts included in the stdlib module will -almost always be evaluated in the context of Puppet and Facter working -together. - -Still, we don't want to write custom facts that blow up in the users face if -Puppet is not loaded in memory. This is often the case if the user runs -`facter` without also supplying the `--puppet` flag. - -Ah! But Jeff, the custom fact won't be in the `$LOAD_PATH` unless the user -supplies `--facter`! You might say... - -Not (always) true I say! If the user happens to have a CWD of -`/stdlib/lib` then the facts will automatically be evaluated and -blow up. - -In any event, it's pretty easy to write a fact that has no value if Puppet is -not loaded. Simply do it like this: - - Facter.add(:node_vardir) do - setcode do - # This will be nil if Puppet is not available. - Facter::Util::PuppetSettings.with_puppet do - Puppet[:vardir] - end - end - end - -The `Facter::Util::PuppetSettings.with_puppet` method accepts a block and -yields to it only if the Puppet library is loaded. If the Puppet library is -not loaded, then the method silently returns `nil` which Facter interprets as -an undefined fact value. The net effect is that the fact won't be set. diff --git a/custom_zulip_files/puppet/stdlib/README_SPECS.markdown b/custom_zulip_files/puppet/stdlib/README_SPECS.markdown deleted file mode 100644 index 917b631..0000000 --- a/custom_zulip_files/puppet/stdlib/README_SPECS.markdown +++ /dev/null @@ -1,7 +0,0 @@ -NOTE -==== - -This project's specs depend on puppet core, and thus they require the -`puppetlabs_spec_helper` project. For more information please see the README -in that project, which can be found here: [puppetlabs spec -helper](https://github.com/puppetlabs/puppetlabs_spec_helper) diff --git a/custom_zulip_files/puppet/stdlib/RELEASE_PROCESS.markdown b/custom_zulip_files/puppet/stdlib/RELEASE_PROCESS.markdown deleted file mode 100644 index 0f9328e..0000000 --- a/custom_zulip_files/puppet/stdlib/RELEASE_PROCESS.markdown +++ /dev/null @@ -1,24 +0,0 @@ -# Contributing to this module # - - * Work in a topic branch - * Submit a github pull request - * Address any comments / feeback - * Merge into master using --no-ff - -# Releasing this module # - - * This module adheres to http://semver.org/ - * Look for API breaking changes using git diff vX.Y.Z..master - * If no API breaking changes, the minor version may be bumped. - * If there are API breaking changes, the major version must be bumped. - * If there are only small minor changes, the patch version may be bumped. - * Update the CHANGELOG - * Update the Modulefile - * Commit these changes with a message along the lines of "Update CHANGELOG and - Modulefile for release" - * Create an annotated tag with git tag -a vX.Y.Z -m 'version X.Y.Z' (NOTE the - leading v as per semver.org) - * Push the tag with git push origin --tags - * Build a new package with puppet-module or the rake build task if it exists - * Publish the new package to the forge - * Bonus points for an announcement to puppet-users. diff --git a/custom_zulip_files/puppet/stdlib/Rakefile b/custom_zulip_files/puppet/stdlib/Rakefile deleted file mode 100644 index 14f1c24..0000000 --- a/custom_zulip_files/puppet/stdlib/Rakefile +++ /dev/null @@ -1,2 +0,0 @@ -require 'rubygems' -require 'puppetlabs_spec_helper/rake_tasks' diff --git a/custom_zulip_files/puppet/stdlib/lib/facter/facter_dot_d.rb b/custom_zulip_files/puppet/stdlib/lib/facter/facter_dot_d.rb deleted file mode 100644 index e414b20..0000000 --- a/custom_zulip_files/puppet/stdlib/lib/facter/facter_dot_d.rb +++ /dev/null @@ -1,202 +0,0 @@ -# A Facter plugin that loads facts from /etc/facter/facts.d -# and /etc/puppetlabs/facter/facts.d. -# -# Facts can be in the form of JSON, YAML or Text files -# and any executable that returns key=value pairs. -# -# In the case of scripts you can also create a file that -# contains a cache TTL. For foo.sh store the ttl as just -# a number in foo.sh.ttl -# -# The cache is stored in /tmp/facts_cache.yaml as a mode -# 600 file and will have the end result of not calling your -# fact scripts more often than is needed - -class Facter::Util::DotD - require 'yaml' - - def initialize(dir="/etc/facts.d", cache_file="/tmp/facts_cache.yml") - @dir = dir - @cache_file = cache_file - @cache = nil - @types = {".txt" => :txt, ".json" => :json, ".yaml" => :yaml} - end - - def entries - Dir.entries(@dir).reject{|f| f =~ /^\.|\.ttl$/}.sort.map {|f| File.join(@dir, f) } - rescue - [] - end - - def fact_type(file) - extension = File.extname(file) - - type = @types[extension] || :unknown - - type = :script if type == :unknown && File.executable?(file) - - return type - end - - def txt_parser(file) - File.readlines(file).each do |line| - if line =~ /^(.+)=(.+)$/ - var = $1; val = $2 - - Facter.add(var) do - setcode { val } - end - end - end - rescue Exception => e - Facter.warn("Failed to handle #{file} as text facts: #{e.class}: #{e}") - end - - def json_parser(file) - begin - require 'json' - rescue LoadError - retry if require 'rubygems' - raise - end - - JSON.load(File.read(file)).each_pair do |f, v| - Facter.add(f) do - setcode { v } - end - end - rescue Exception => e - Facter.warn("Failed to handle #{file} as json facts: #{e.class}: #{e}") - end - - def yaml_parser(file) - require 'yaml' - - YAML.load_file(file).each_pair do |f, v| - Facter.add(f) do - setcode { v } - end - end - rescue Exception => e - Facter.warn("Failed to handle #{file} as yaml facts: #{e.class}: #{e}") - end - - def script_parser(file) - result = cache_lookup(file) - ttl = cache_time(file) - - unless result - result = Facter::Util::Resolution.exec(file) - - if ttl > 0 - Facter.debug("Updating cache for #{file}") - cache_store(file, result) - cache_save! - end - else - Facter.debug("Using cached data for #{file}") - end - - result.split("\n").each do |line| - if line =~ /^(.+)=(.+)$/ - var = $1; val = $2 - - Facter.add(var) do - setcode { val } - end - end - end - rescue Exception => e - Facter.warn("Failed to handle #{file} as script facts: #{e.class}: #{e}") - Facter.debug(e.backtrace.join("\n\t")) - end - - def cache_save! - cache = load_cache - File.open(@cache_file, "w", 0600) {|f| f.write(YAML.dump(cache)) } - rescue - end - - def cache_store(file, data) - load_cache - - @cache[file] = {:data => data, :stored => Time.now.to_i} - rescue - end - - def cache_lookup(file) - cache = load_cache - - return nil if cache.empty? - - ttl = cache_time(file) - - if cache[file] - now = Time.now.to_i - - return cache[file][:data] if ttl == -1 - return cache[file][:data] if (now - cache[file][:stored]) <= ttl - return nil - else - return nil - end - rescue - return nil - end - - def cache_time(file) - meta = file + ".ttl" - - return File.read(meta).chomp.to_i - rescue - return 0 - end - - def load_cache - unless @cache - if File.exist?(@cache_file) - @cache = YAML.load_file(@cache_file) - else - @cache = {} - end - end - - return @cache - rescue - @cache = {} - return @cache - end - - def create - entries.each do |fact| - type = fact_type(fact) - parser = "#{type}_parser" - - if respond_to?("#{type}_parser") - Facter.debug("Parsing #{fact} using #{parser}") - - send(parser, fact) - end - end - end -end - - -mdata = Facter.version.match(/(\d+)\.(\d+)\.(\d+)/) -if mdata - (major, minor, patch) = mdata.captures.map { |v| v.to_i } - if major < 2 - # Facter 1.7 introduced external facts support directly - unless major == 1 and minor > 6 - Facter::Util::DotD.new("/etc/facter/facts.d").create - Facter::Util::DotD.new("/etc/puppetlabs/facter/facts.d").create - - # Windows has a different configuration directory that defaults to a vendor - # specific sub directory of the %COMMON_APPDATA% directory. - if Dir.const_defined? 'COMMON_APPDATA' then - windows_facts_dot_d = File.join(Dir::COMMON_APPDATA, 'PuppetLabs', 'facter', 'facts.d') - Facter::Util::DotD.new(windows_facts_dot_d).create - end - end - end -end diff --git a/custom_zulip_files/puppet/stdlib/lib/facter/pe_version.rb b/custom_zulip_files/puppet/stdlib/lib/facter/pe_version.rb deleted file mode 100644 index 0cc0f64..0000000 --- a/custom_zulip_files/puppet/stdlib/lib/facter/pe_version.rb +++ /dev/null @@ -1,53 +0,0 @@ -# Fact: is_pe, pe_version, pe_major_version, pe_minor_version, pe_patch_version -# -# Purpose: Return various facts about the PE state of the system -# -# Resolution: Uses a regex match against puppetversion to determine whether the -# machine has Puppet Enterprise installed, and what version (overall, major, -# minor, patch) is installed. -# -# Caveats: -# -Facter.add("pe_version") do - setcode do - pe_ver = Facter.value("puppetversion").match(/Puppet Enterprise (\d+\.\d+\.\d+)/) - pe_ver[1] if pe_ver - end -end - -Facter.add("is_pe") do - setcode do - if Facter.value(:pe_version).to_s.empty? then - false - else - true - end - end -end - -Facter.add("pe_major_version") do - confine :is_pe => true - setcode do - if pe_version = Facter.value(:pe_version) - pe_version.to_s.split('.')[0] - end - end -end - -Facter.add("pe_minor_version") do - confine :is_pe => true - setcode do - if pe_version = Facter.value(:pe_version) - pe_version.to_s.split('.')[1] - end - end -end - -Facter.add("pe_patch_version") do - confine :is_pe => true - setcode do - if pe_version = Facter.value(:pe_version) - pe_version.to_s.split('.')[2] - end - end -end diff --git a/custom_zulip_files/puppet/stdlib/lib/facter/puppet_vardir.rb b/custom_zulip_files/puppet/stdlib/lib/facter/puppet_vardir.rb deleted file mode 100644 index 0e6af40..0000000 --- a/custom_zulip_files/puppet/stdlib/lib/facter/puppet_vardir.rb +++ /dev/null @@ -1,26 +0,0 @@ -# This facter fact returns the value of the Puppet vardir setting for the node -# running puppet or puppet agent. The intent is to enable Puppet modules to -# automatically have insight into a place where they can place variable data, -# regardless of the node's platform. -# -# The value should be directly usable in a File resource path attribute. - - -begin - require 'facter/util/puppet_settings' -rescue LoadError => e - # puppet apply does not add module lib directories to the $LOAD_PATH (See - # #4248). It should (in the future) but for the time being we need to be - # defensive which is what this rescue block is doing. - rb_file = File.join(File.dirname(__FILE__), 'util', 'puppet_settings.rb') - load rb_file if File.exists?(rb_file) or raise e -end - -Facter.add(:puppet_vardir) do - setcode do - # This will be nil if Puppet is not available. - Facter::Util::PuppetSettings.with_puppet do - Puppet[:vardir] - end - end -end diff --git a/custom_zulip_files/puppet/stdlib/lib/facter/root_home.rb b/custom_zulip_files/puppet/stdlib/lib/facter/root_home.rb deleted file mode 100644 index 8249f7d..0000000 --- a/custom_zulip_files/puppet/stdlib/lib/facter/root_home.rb +++ /dev/null @@ -1,19 +0,0 @@ -# A facter fact to determine the root home directory. -# This varies on PE supported platforms and may be -# reconfigured by the end user. - -module Facter::Util::RootHome - class << self - def get_root_home - root_ent = Facter::Util::Resolution.exec("getent passwd root") - # The home directory is the sixth element in the passwd entry - # If the platform doesn't have getent, root_ent will be nil and we should - # return it straight away. - root_ent && root_ent.split(":")[5] - end - end -end - -Facter.add(:root_home) do - setcode { Facter::Util::RootHome.get_root_home } -end diff --git a/custom_zulip_files/puppet/stdlib/lib/facter/util/puppet_settings.rb b/custom_zulip_files/puppet/stdlib/lib/facter/util/puppet_settings.rb deleted file mode 100644 index 1ad9452..0000000 --- a/custom_zulip_files/puppet/stdlib/lib/facter/util/puppet_settings.rb +++ /dev/null @@ -1,21 +0,0 @@ -module Facter - module Util - module PuppetSettings - # This method is intended to provide a convenient way to evaluate a - # Facter code block only if Puppet is loaded. This is to account for the - # situation where the fact happens to be in the load path, but Puppet is - # not loaded for whatever reason. Perhaps the user is simply running - # facter without the --puppet flag and they happen to be working in a lib - # directory of a module. - def self.with_puppet - begin - Module.const_get("Puppet") - rescue NameError - nil - else - yield - end - end - end - end -end diff --git a/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/abs.rb b/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/abs.rb deleted file mode 100644 index 11d2d7f..0000000 --- a/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/abs.rb +++ /dev/null @@ -1,36 +0,0 @@ -# -# abs.rb -# - -module Puppet::Parser::Functions - newfunction(:abs, :type => :rvalue, :doc => <<-EOS - Returns the absolute value of a number, for example -34.56 becomes - 34.56. Takes a single integer and float value as an argument. - EOS - ) do |arguments| - - raise(Puppet::ParseError, "abs(): Wrong number of arguments " + - "given (#{arguments.size} for 1)") if arguments.size < 1 - - value = arguments[0] - - # Numbers in Puppet are often string-encoded which is troublesome ... - if value.is_a?(String) - if value.match(/^-?(?:\d+)(?:\.\d+){1}$/) - value = value.to_f - elsif value.match(/^-?\d+$/) - value = value.to_i - else - raise(Puppet::ParseError, 'abs(): Requires float or ' + - 'integer to work with') - end - end - - # We have numeric value to handle ... - result = value.abs - - return result - end -end - -# vim: set ts=2 sw=2 et : diff --git a/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/any2array.rb b/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/any2array.rb deleted file mode 100644 index e71407e..0000000 --- a/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/any2array.rb +++ /dev/null @@ -1,33 +0,0 @@ -# -# any2array.rb -# - -module Puppet::Parser::Functions - newfunction(:any2array, :type => :rvalue, :doc => <<-EOS -This converts any object to an array containing that object. Empty argument -lists are converted to an empty array. Arrays are left untouched. Hashes are -converted to arrays of alternating keys and values. - EOS - ) do |arguments| - - if arguments.empty? - return [] - end - - if arguments.length == 1 - if arguments[0].kind_of?(Array) - return arguments[0] - elsif arguments[0].kind_of?(Hash) - result = [] - arguments[0].each do |key, value| - result << key << value - end - return result - end - end - - return arguments - end -end - -# vim: set ts=2 sw=2 et : diff --git a/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/bool2num.rb b/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/bool2num.rb deleted file mode 100644 index 9a07a8a..0000000 --- a/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/bool2num.rb +++ /dev/null @@ -1,49 +0,0 @@ -# -# bool2num.rb -# - -module Puppet::Parser::Functions - newfunction(:bool2num, :type => :rvalue, :doc => <<-EOS - Converts a boolean to a number. Converts the values: - false, f, 0, n, and no to 0 - true, t, 1, y, and yes to 1 - Requires a single boolean or string as an input. - EOS - ) do |arguments| - - raise(Puppet::ParseError, "bool2num(): Wrong number of arguments " + - "given (#{arguments.size} for 1)") if arguments.size < 1 - - value = arguments[0] - klass = value.class - - # We can have either true or false, or string which resembles boolean ... - unless [FalseClass, TrueClass, String].include?(klass) - raise(Puppet::ParseError, 'bool2num(): Requires either ' + - 'boolean or string to work with') - end - - if value.is_a?(String) - # We consider all the yes, no, y, n and so on too ... - value = case value - # - # This is how undef looks like in Puppet ... - # We yield 0 (or false if you wish) in this case. - # - when /^$/, '' then false # Empty string will be false ... - when /^(1|t|y|true|yes)$/ then true - when /^(0|f|n|false|no)$/ then false - when /^(undef|undefined)$/ then false # This is not likely to happen ... - else - raise(Puppet::ParseError, 'bool2num(): Unknown type of boolean given') - end - end - - # We have real boolean values as well ... - result = value ? 1 : 0 - - return result - end -end - -# vim: set ts=2 sw=2 et : diff --git a/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/capitalize.rb b/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/capitalize.rb deleted file mode 100644 index 640d00b..0000000 --- a/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/capitalize.rb +++ /dev/null @@ -1,34 +0,0 @@ -# -# capitalize.rb -# - -module Puppet::Parser::Functions - newfunction(:capitalize, :type => :rvalue, :doc => <<-EOS - Capitalizes the first letter of a string or array of strings. - Requires either a single string or an array as an input. - EOS - ) do |arguments| - - raise(Puppet::ParseError, "capitalize(): Wrong number of arguments " + - "given (#{arguments.size} for 1)") if arguments.size < 1 - - value = arguments[0] - klass = value.class - - unless [Array, String].include?(klass) - raise(Puppet::ParseError, 'capitalize(): Requires either ' + - 'array or string to work with') - end - - if value.is_a?(Array) - # Numbers in Puppet are often string-encoded which is troublesome ... - result = value.collect { |i| i.is_a?(String) ? i.capitalize : i } - else - result = value.capitalize - end - - return result - end -end - -# vim: set ts=2 sw=2 et : diff --git a/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/chomp.rb b/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/chomp.rb deleted file mode 100644 index 4564a00..0000000 --- a/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/chomp.rb +++ /dev/null @@ -1,35 +0,0 @@ -# -# chomp.rb -# - -module Puppet::Parser::Functions - newfunction(:chomp, :type => :rvalue, :doc => <<-'EOS' - Removes the record separator from the end of a string or an array of - strings, for example `hello\n` becomes `hello`. - Requires a single string or array as an input. - EOS - ) do |arguments| - - raise(Puppet::ParseError, "chomp(): Wrong number of arguments " + - "given (#{arguments.size} for 1)") if arguments.size < 1 - - value = arguments[0] - klass = value.class - - unless [Array, String].include?(klass) - raise(Puppet::ParseError, 'chomp(): Requires either ' + - 'array or string to work with') - end - - if value.is_a?(Array) - # Numbers in Puppet are often string-encoded which is troublesome ... - result = value.collect { |i| i.is_a?(String) ? i.chomp : i } - else - result = value.chomp - end - - return result - end -end - -# vim: set ts=2 sw=2 et : diff --git a/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/chop.rb b/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/chop.rb deleted file mode 100644 index f242af3..0000000 --- a/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/chop.rb +++ /dev/null @@ -1,37 +0,0 @@ -# -# chop.rb -# - -module Puppet::Parser::Functions - newfunction(:chop, :type => :rvalue, :doc => <<-'EOS' - Returns a new string with the last character removed. If the string ends - with `\r\n`, both characters are removed. Applying chop to an empty - string returns an empty string. If you wish to merely remove record - separators then you should use the `chomp` function. - Requires a string or array of strings as input. - EOS - ) do |arguments| - - raise(Puppet::ParseError, "chop(): Wrong number of arguments " + - "given (#{arguments.size} for 1)") if arguments.size < 1 - - value = arguments[0] - klass = value.class - - unless [Array, String].include?(klass) - raise(Puppet::ParseError, 'chop(): Requires either an ' + - 'array or string to work with') - end - - if value.is_a?(Array) - # Numbers in Puppet are often string-encoded which is troublesome ... - result = value.collect { |i| i.is_a?(String) ? i.chop : i } - else - result = value.chop - end - - return result - end -end - -# vim: set ts=2 sw=2 et : diff --git a/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/concat.rb b/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/concat.rb deleted file mode 100644 index c86aa00..0000000 --- a/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/concat.rb +++ /dev/null @@ -1,37 +0,0 @@ -# -# concat.rb -# - -module Puppet::Parser::Functions - newfunction(:concat, :type => :rvalue, :doc => <<-EOS -Appends the contents of array 2 onto array 1. - -*Example:* - - concat(['1','2','3'],['4','5','6']) - -Would result in: - - ['1','2','3','4','5','6'] - EOS - ) do |arguments| - - # Check that 2 arguments have been given ... - raise(Puppet::ParseError, "concat(): Wrong number of arguments " + - "given (#{arguments.size} for 2)") if arguments.size != 2 - - a = arguments[0] - b = arguments[1] - - # Check that both args are arrays. - unless a.is_a?(Array) and b.is_a?(Array) - raise(Puppet::ParseError, 'concat(): Requires array to work with') - end - - result = a.concat(b) - - return result - end -end - -# vim: set ts=2 sw=2 et : diff --git a/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/count.rb b/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/count.rb deleted file mode 100644 index 52de1b8..0000000 --- a/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/count.rb +++ /dev/null @@ -1,22 +0,0 @@ -module Puppet::Parser::Functions - newfunction(:count, :type => :rvalue, :arity => -2, :doc => <<-EOS -Takes an array as first argument and an optional second argument. -Count the number of elements in array that matches second argument. -If called with only an array it counts the number of elements that are not nil/undef. - EOS - ) do |args| - - if (args.size > 2) then - raise(ArgumentError, "count(): Wrong number of arguments "+ - "given #{args.size} for 1 or 2.") - end - - collection, item = args - - if item then - collection.count item - else - collection.count { |obj| obj != nil && obj != :undef && obj != '' } - end - end -end diff --git a/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/defined_with_params.rb b/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/defined_with_params.rb deleted file mode 100644 index d7df306..0000000 --- a/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/defined_with_params.rb +++ /dev/null @@ -1,35 +0,0 @@ -# Test whether a given class or definition is defined -require 'puppet/parser/functions' - -Puppet::Parser::Functions.newfunction(:defined_with_params, - :type => :rvalue, - :doc => <<-'ENDOFDOC' -Takes a resource reference and an optional hash of attributes. - -Returns true if a resource with the specified attributes has already been added -to the catalog, and false otherwise. - - user { 'dan': - ensure => present, - } - - if ! defined_with_params(User[dan], {'ensure' => 'present' }) { - user { 'dan': ensure => present, } - } -ENDOFDOC -) do |vals| - reference, params = vals - raise(ArgumentError, 'Must specify a reference') unless reference - if (! params) || params == '' - params = {} - end - ret = false - if resource = findresource(reference.to_s) - matches = params.collect do |key, value| - resource[key] == value - end - ret = params.empty? || !matches.include?(false) - end - Puppet.debug("Resource #{reference} was not determined to be defined") - ret -end diff --git a/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/delete.rb b/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/delete.rb deleted file mode 100644 index f814344..0000000 --- a/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/delete.rb +++ /dev/null @@ -1,46 +0,0 @@ -# -# delete.rb -# - -# TODO(Krzysztof Wilczynski): We need to add support for regular expression ... - -module Puppet::Parser::Functions - newfunction(:delete, :type => :rvalue, :doc => <<-EOS -Deletes all instances of a given element from an array, substring from a -string, or key from a hash. - -*Examples:* - - delete(['a','b','c','b'], 'b') - Would return: ['a','c'] - - delete({'a'=>1,'b'=>2,'c'=>3}, 'b') - Would return: {'a'=>1,'c'=>3} - - delete('abracadabra', 'bra') - Would return: 'acada' - EOS - ) do |arguments| - - if (arguments.size != 2) then - raise(Puppet::ParseError, "delete(): Wrong number of arguments "+ - "given #{arguments.size} for 2.") - end - - collection = arguments[0] - item = arguments[1] - - case collection - when Array, Hash - collection.delete item - when String - collection.gsub! item, '' - else - raise(TypeError, "delete(): First argument must be an Array, " + - "String, or Hash. Given an argument of class #{collection.class}.") - end - collection - end -end - -# vim: set ts=2 sw=2 et : diff --git a/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/delete_at.rb b/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/delete_at.rb deleted file mode 100644 index 3eb4b53..0000000 --- a/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/delete_at.rb +++ /dev/null @@ -1,49 +0,0 @@ -# -# delete_at.rb -# - -module Puppet::Parser::Functions - newfunction(:delete_at, :type => :rvalue, :doc => <<-EOS -Deletes a determined indexed value from an array. - -*Examples:* - - delete_at(['a','b','c'], 1) - -Would return: ['a','c'] - EOS - ) do |arguments| - - raise(Puppet::ParseError, "delete_at(): Wrong number of arguments " + - "given (#{arguments.size} for 2)") if arguments.size < 2 - - array = arguments[0] - - unless array.is_a?(Array) - raise(Puppet::ParseError, 'delete_at(): Requires array to work with') - end - - index = arguments[1] - - if index.is_a?(String) and not index.match(/^\d+$/) - raise(Puppet::ParseError, 'delete_at(): You must provide ' + - 'non-negative numeric index') - end - - result = array.clone - - # Numbers in Puppet are often string-encoded which is troublesome ... - index = index.to_i - - if index > result.size - 1 # First element is at index 0 is it not? - raise(Puppet::ParseError, 'delete_at(): Given index ' + - 'exceeds size of array given') - end - - result.delete_at(index) # We ignore the element that got deleted ... - - return result - end -end - -# vim: set ts=2 sw=2 et : diff --git a/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/dirname.rb b/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/dirname.rb deleted file mode 100644 index ea8cc1e..0000000 --- a/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/dirname.rb +++ /dev/null @@ -1,15 +0,0 @@ -module Puppet::Parser::Functions - newfunction(:dirname, :type => :rvalue, :doc => <<-EOS - Returns the dirname of a path. - EOS - ) do |arguments| - - raise(Puppet::ParseError, "dirname(): Wrong number of arguments " + - "given (#{arguments.size} for 1)") if arguments.size < 1 - - path = arguments[0] - return File.dirname(path) - end -end - -# vim: set ts=2 sw=2 et : diff --git a/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/downcase.rb b/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/downcase.rb deleted file mode 100644 index 4066d21..0000000 --- a/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/downcase.rb +++ /dev/null @@ -1,33 +0,0 @@ -# -# downcase.rb -# - -module Puppet::Parser::Functions - newfunction(:downcase, :type => :rvalue, :doc => <<-EOS -Converts the case of a string or all strings in an array to lower case. - EOS - ) do |arguments| - - raise(Puppet::ParseError, "downcase(): Wrong number of arguments " + - "given (#{arguments.size} for 1)") if arguments.size < 1 - - value = arguments[0] - klass = value.class - - unless [Array, String].include?(klass) - raise(Puppet::ParseError, 'downcase(): Requires either ' + - 'array or string to work with') - end - - if value.is_a?(Array) - # Numbers in Puppet are often string-encoded which is troublesome ... - result = value.collect { |i| i.is_a?(String) ? i.downcase : i } - else - result = value.downcase - end - - return result - end -end - -# vim: set ts=2 sw=2 et : diff --git a/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/empty.rb b/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/empty.rb deleted file mode 100644 index 80ebb86..0000000 --- a/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/empty.rb +++ /dev/null @@ -1,28 +0,0 @@ -# -# empty.rb -# - -module Puppet::Parser::Functions - newfunction(:empty, :type => :rvalue, :doc => <<-EOS -Returns true if the variable is empty. - EOS - ) do |arguments| - - raise(Puppet::ParseError, "empty(): Wrong number of arguments " + - "given (#{arguments.size} for 1)") if arguments.size < 1 - - value = arguments[0] - klass = value.class - - unless [Array, Hash, String].include?(klass) - raise(Puppet::ParseError, 'empty(): Requires either ' + - 'array, hash or string to work with') - end - - result = value.empty? - - return result - end -end - -# vim: set ts=2 sw=2 et : diff --git a/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/ensure_packages.rb b/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/ensure_packages.rb deleted file mode 100644 index 450ea02..0000000 --- a/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/ensure_packages.rb +++ /dev/null @@ -1,24 +0,0 @@ -# -# ensure_packages.rb -# -require 'puppet/parser/functions' - -module Puppet::Parser::Functions - newfunction(:ensure_packages, :type => :statement, :doc => <<-EOS -Takes a list of packages and only installs them if they don't already exist. - EOS - ) do |arguments| - - raise(Puppet::ParseError, "ensure_packages(): Wrong number of arguments " + - "given (#{arguments.size} for 1)") if arguments.size != 1 - raise(Puppet::ParseError, "ensure_packages(): Requires array " + - "given (#{arguments[0].class})") if !arguments[0].kind_of?(Array) - - Puppet::Parser::Functions.function(:ensure_resource) - arguments[0].each { |package_name| - function_ensure_resource(['package', package_name, {'ensure' => 'present' } ]) - } - end -end - -# vim: set ts=2 sw=2 et : diff --git a/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/ensure_resource.rb b/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/ensure_resource.rb deleted file mode 100644 index a9a1733..0000000 --- a/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/ensure_resource.rb +++ /dev/null @@ -1,45 +0,0 @@ -# Test whether a given class or definition is defined -require 'puppet/parser/functions' - -Puppet::Parser::Functions.newfunction(:ensure_resource, - :type => :statement, - :doc => <<-'ENDOFDOC' -Takes a resource type, title, and a list of attributes that describe a -resource. - - user { 'dan': - ensure => present, - } - -This example only creates the resource if it does not already exist: - - ensure_resource('user, 'dan', {'ensure' => 'present' }) - -If the resource already exists but does not match the specified parameters, -this function will attempt to recreate the resource leading to a duplicate -resource definition error. - -An array of resources can also be passed in and each will be created with -the type and parameters specified if it doesn't already exist. - - ensure_resource('user', ['dan','alex'], {'ensure' => 'present'}) - -ENDOFDOC -) do |vals| - type, title, params = vals - raise(ArgumentError, 'Must specify a type') unless type - raise(ArgumentError, 'Must specify a title') unless title - params ||= {} - - items = [title].flatten - - items.each do |item| - Puppet::Parser::Functions.function(:defined_with_params) - if function_defined_with_params(["#{type}[#{item}]", params]) - Puppet.debug("Resource #{type}[#{item}] not created because it already exists") - else - Puppet::Parser::Functions.function(:create_resources) - function_create_resources([type.capitalize, { item => params }]) - end - end -end diff --git a/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/flatten.rb b/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/flatten.rb deleted file mode 100644 index a1ed183..0000000 --- a/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/flatten.rb +++ /dev/null @@ -1,33 +0,0 @@ -# -# flatten.rb -# - -module Puppet::Parser::Functions - newfunction(:flatten, :type => :rvalue, :doc => <<-EOS -This function flattens any deeply nested arrays and returns a single flat array -as a result. - -*Examples:* - - flatten(['a', ['b', ['c']]]) - -Would return: ['a','b','c'] - EOS - ) do |arguments| - - raise(Puppet::ParseError, "flatten(): Wrong number of arguments " + - "given (#{arguments.size} for 1)") if arguments.size != 1 - - array = arguments[0] - - unless array.is_a?(Array) - raise(Puppet::ParseError, 'flatten(): Requires array to work with') - end - - result = array.flatten - - return result - end -end - -# vim: set ts=2 sw=2 et : diff --git a/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/floor.rb b/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/floor.rb deleted file mode 100644 index a401923..0000000 --- a/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/floor.rb +++ /dev/null @@ -1,20 +0,0 @@ -module Puppet::Parser::Functions - newfunction(:floor, :type => :rvalue, :doc => <<-EOS - Returns the largest integer less or equal to the argument. - Takes a single numeric value as an argument. - EOS - ) do |arguments| - - raise(Puppet::ParseError, "floor(): Wrong number of arguments " + - "given (#{arguments.size} for 1)") if arguments.size != 1 - - arg = arguments[0] - - raise(Puppet::ParseError, "floor(): Wrong argument type " + - "given (#{arg.class} for Numeric)") if arg.is_a?(Numeric) == false - - arg.floor - end -end - -# vim: set ts=2 sw=2 et : diff --git a/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/fqdn_rotate.rb b/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/fqdn_rotate.rb deleted file mode 100644 index 6558206..0000000 --- a/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/fqdn_rotate.rb +++ /dev/null @@ -1,46 +0,0 @@ -# -# fqdn_rotate.rb -# - -module Puppet::Parser::Functions - newfunction(:fqdn_rotate, :type => :rvalue, :doc => <<-EOS -Rotates an array a random number of times based on a nodes fqdn. - EOS - ) do |arguments| - - raise(Puppet::ParseError, "fqdn_rotate(): Wrong number of arguments " + - "given (#{arguments.size} for 1)") if arguments.size < 1 - - value = arguments[0] - klass = value.class - require 'digest/md5' - - unless [Array, String].include?(klass) - raise(Puppet::ParseError, 'fqdn_rotate(): Requires either ' + - 'array or string to work with') - end - - result = value.clone - - string = value.is_a?(String) ? true : false - - # Check whether it makes sense to rotate ... - return result if result.size <= 1 - - # We turn any string value into an array to be able to rotate ... - result = string ? result.split('') : result - - elements = result.size - - srand(Digest::MD5.hexdigest([lookupvar('::fqdn'),arguments].join(':')).hex) - rand(elements).times { - result.push result.shift - } - - result = string ? result.join : result - - return result - end -end - -# vim: set ts=2 sw=2 et : diff --git a/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/get_module_path.rb b/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/get_module_path.rb deleted file mode 100644 index 1421b91..0000000 --- a/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/get_module_path.rb +++ /dev/null @@ -1,17 +0,0 @@ -module Puppet::Parser::Functions - newfunction(:get_module_path, :type =>:rvalue, :doc => <<-EOT - Returns the absolute path of the specified module for the current - environment. - - Example: - $module_path = get_module_path('stdlib') - EOT - ) do |args| - raise(Puppet::ParseError, "get_module_path(): Wrong number of arguments, expects one") unless args.size == 1 - if module_path = Puppet::Module.find(args[0], compiler.environment.to_s) - module_path.path - else - raise(Puppet::ParseError, "Could not find module #{args[0]} in environment #{compiler.environment}") - end - end -end diff --git a/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/getparam.rb b/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/getparam.rb deleted file mode 100644 index 6d51006..0000000 --- a/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/getparam.rb +++ /dev/null @@ -1,35 +0,0 @@ -# Test whether a given class or definition is defined -require 'puppet/parser/functions' - -Puppet::Parser::Functions.newfunction(:getparam, - :type => :rvalue, - :doc => <<-'ENDOFDOC' -Takes a resource reference and name of the parameter and -returns value of resource's parameter. - -*Examples:* - - define example_resource($param) { - } - - example_resource { "example_resource_instance": - param => "param_value" - } - - getparam(Example_resource["example_resource_instance"], "param") - -Would return: param_value -ENDOFDOC -) do |vals| - reference, param = vals - raise(ArgumentError, 'Must specify a reference') unless reference - raise(ArgumentError, 'Must specify name of a parameter') unless param and param.instance_of? String - - return '' if param.empty? - - if resource = findresource(reference.to_s) - return resource[param] if resource[param] - end - - return '' -end diff --git a/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/getvar.rb b/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/getvar.rb deleted file mode 100644 index 1621149..0000000 --- a/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/getvar.rb +++ /dev/null @@ -1,26 +0,0 @@ -module Puppet::Parser::Functions - - newfunction(:getvar, :type => :rvalue, :doc => <<-'ENDHEREDOC') do |args| - Lookup a variable in a remote namespace. - - For example: - - $foo = getvar('site::data::foo') - # Equivalent to $foo = $site::data::foo - - This is useful if the namespace itself is stored in a string: - - $datalocation = 'site::data' - $bar = getvar("${datalocation}::bar") - # Equivalent to $bar = $site::data::bar - ENDHEREDOC - - unless args.length == 1 - raise Puppet::ParseError, ("getvar(): wrong number of arguments (#{args.length}; must be 1)") - end - - self.lookupvar("#{args[0]}") - - end - -end diff --git a/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/grep.rb b/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/grep.rb deleted file mode 100644 index ceba9ec..0000000 --- a/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/grep.rb +++ /dev/null @@ -1,33 +0,0 @@ -# -# grep.rb -# - -module Puppet::Parser::Functions - newfunction(:grep, :type => :rvalue, :doc => <<-EOS -This function searches through an array and returns any elements that match -the provided regular expression. - -*Examples:* - - grep(['aaa','bbb','ccc','aaaddd'], 'aaa') - -Would return: - - ['aaa','aaaddd'] - EOS - ) do |arguments| - - if (arguments.size != 2) then - raise(Puppet::ParseError, "grep(): Wrong number of arguments "+ - "given #{arguments.size} for 2") - end - - a = arguments[0] - pattern = Regexp.new(arguments[1]) - - a.grep(pattern) - - end -end - -# vim: set ts=2 sw=2 et : diff --git a/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/has_interface_with.rb b/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/has_interface_with.rb deleted file mode 100644 index 7f150a7..0000000 --- a/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/has_interface_with.rb +++ /dev/null @@ -1,52 +0,0 @@ -# -# has_interface_with -# - -module Puppet::Parser::Functions - newfunction(:has_interface_with, :type => :rvalue, :doc => <<-EOS -Returns boolean based on kind and value: - * macaddress - * netmask - * ipaddress - * network - -has_interface_with("macaddress", "x:x:x:x:x:x") -has_interface_with("ipaddress", "127.0.0.1") => true -etc. - -If no "kind" is given, then the presence of the interface is checked: -has_interface_with("lo") => true - EOS - ) do |args| - - raise(Puppet::ParseError, "has_interface_with(): Wrong number of arguments " + - "given (#{args.size} for 1 or 2)") if args.size < 1 or args.size > 2 - - interfaces = lookupvar('interfaces') - - # If we do not have any interfaces, then there are no requested attributes - return false if (interfaces == :undefined) - - interfaces = interfaces.split(',') - - if args.size == 1 - return interfaces.member?(args[0]) - end - - kind, value = args - - if lookupvar(kind) == value - return true - end - - result = false - interfaces.each do |iface| - if value == lookupvar("#{kind}_#{iface}") - result = true - break - end - end - - result - end -end diff --git a/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/has_ip_address.rb b/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/has_ip_address.rb deleted file mode 100644 index 842c8ec..0000000 --- a/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/has_ip_address.rb +++ /dev/null @@ -1,25 +0,0 @@ -# -# has_ip_address -# - -module Puppet::Parser::Functions - newfunction(:has_ip_address, :type => :rvalue, :doc => <<-EOS -Returns true if the client has the requested IP address on some interface. - -This function iterates through the 'interfaces' fact and checks the -'ipaddress_IFACE' facts, performing a simple string comparison. - EOS - ) do |args| - - raise(Puppet::ParseError, "has_ip_address(): Wrong number of arguments " + - "given (#{args.size} for 1)") if args.size != 1 - - Puppet::Parser::Functions.autoloader.load(:has_interface_with) \ - unless Puppet::Parser::Functions.autoloader.loaded?(:has_interface_with) - - function_has_interface_with(['ipaddress', args[0]]) - - end -end - -# vim:sts=2 sw=2 diff --git a/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/has_ip_network.rb b/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/has_ip_network.rb deleted file mode 100644 index 9ccf902..0000000 --- a/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/has_ip_network.rb +++ /dev/null @@ -1,25 +0,0 @@ -# -# has_ip_network -# - -module Puppet::Parser::Functions - newfunction(:has_ip_network, :type => :rvalue, :doc => <<-EOS -Returns true if the client has an IP address within the requested network. - -This function iterates through the 'interfaces' fact and checks the -'network_IFACE' facts, performing a simple string comparision. - EOS - ) do |args| - - raise(Puppet::ParseError, "has_ip_network(): Wrong number of arguments " + - "given (#{args.size} for 1)") if args.size != 1 - - Puppet::Parser::Functions.autoloader.load(:has_interface_with) \ - unless Puppet::Parser::Functions.autoloader.loaded?(:has_interface_with) - - function_has_interface_with(['network', args[0]]) - - end -end - -# vim:sts=2 sw=2 diff --git a/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/has_key.rb b/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/has_key.rb deleted file mode 100644 index 4657cc2..0000000 --- a/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/has_key.rb +++ /dev/null @@ -1,28 +0,0 @@ -module Puppet::Parser::Functions - - newfunction(:has_key, :type => :rvalue, :doc => <<-'ENDHEREDOC') do |args| - Determine if a hash has a certain key value. - - Example: - - $my_hash = {'key_one' => 'value_one'} - if has_key($my_hash, 'key_two') { - notice('we will not reach here') - } - if has_key($my_hash, 'key_one') { - notice('this will be printed') - } - - ENDHEREDOC - - unless args.length == 2 - raise Puppet::ParseError, ("has_key(): wrong number of arguments (#{args.length}; must be 2)") - end - unless args[0].is_a?(Hash) - raise Puppet::ParseError, "has_key(): expects the first argument to be a hash, got #{args[0].inspect} which is of type #{args[0].class}" - end - args[0].has_key?(args[1]) - - end - -end diff --git a/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/hash.rb b/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/hash.rb deleted file mode 100644 index 8cc4823..0000000 --- a/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/hash.rb +++ /dev/null @@ -1,41 +0,0 @@ -# -# hash.rb -# - -module Puppet::Parser::Functions - newfunction(:hash, :type => :rvalue, :doc => <<-EOS -This function converts an array into a hash. - -*Examples:* - - hash(['a',1,'b',2,'c',3]) - -Would return: {'a'=>1,'b'=>2,'c'=>3} - EOS - ) do |arguments| - - raise(Puppet::ParseError, "hash(): Wrong number of arguments " + - "given (#{arguments.size} for 1)") if arguments.size < 1 - - array = arguments[0] - - unless array.is_a?(Array) - raise(Puppet::ParseError, 'hash(): Requires array to work with') - end - - result = {} - - begin - # This is to make it compatible with older version of Ruby ... - array = array.flatten - result = Hash[*array] - rescue Exception - raise(Puppet::ParseError, 'hash(): Unable to compute ' + - 'hash from array given') - end - - return result - end -end - -# vim: set ts=2 sw=2 et : diff --git a/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/is_array.rb b/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/is_array.rb deleted file mode 100644 index b39e184..0000000 --- a/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/is_array.rb +++ /dev/null @@ -1,22 +0,0 @@ -# -# is_array.rb -# - -module Puppet::Parser::Functions - newfunction(:is_array, :type => :rvalue, :doc => <<-EOS -Returns true if the variable passed to this function is an array. - EOS - ) do |arguments| - - raise(Puppet::ParseError, "is_array(): Wrong number of arguments " + - "given (#{arguments.size} for 1)") if arguments.size < 1 - - type = arguments[0] - - result = type.is_a?(Array) - - return result - end -end - -# vim: set ts=2 sw=2 et : diff --git a/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/is_domain_name.rb b/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/is_domain_name.rb deleted file mode 100644 index 5826dc0..0000000 --- a/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/is_domain_name.rb +++ /dev/null @@ -1,47 +0,0 @@ -# -# is_domain_name.rb -# - -module Puppet::Parser::Functions - newfunction(:is_domain_name, :type => :rvalue, :doc => <<-EOS -Returns true if the string passed to this function is a syntactically correct domain name. - EOS - ) do |arguments| - - if (arguments.size != 1) then - raise(Puppet::ParseError, "is_domain_name(): Wrong number of arguments "+ - "given #{arguments.size} for 1") - end - - domain = arguments[0] - - # Limits (rfc1035, 3.1) - domain_max_length=255 - label_min_length=1 - label_max_length=63 - - # Allow ".", it is the top level domain - return true if domain == '.' - - # Remove the final dot, if present. - domain.chomp!('.') - - # Check the whole domain - return false if domain.empty? - return false if domain.length > domain_max_length - - # Check each label in the domain - labels = domain.split('.') - vlabels = labels.each do |label| - break if label.length < label_min_length - break if label.length > label_max_length - break if label[-1..-1] == '-' - break if label[0..0] == '-' - break unless /^[a-z\d-]+$/i.match(label) - end - return vlabels == labels - - end -end - -# vim: set ts=2 sw=2 et : diff --git a/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/is_float.rb b/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/is_float.rb deleted file mode 100644 index 911f3c2..0000000 --- a/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/is_float.rb +++ /dev/null @@ -1,27 +0,0 @@ -# -# is_float.rb -# - -module Puppet::Parser::Functions - newfunction(:is_float, :type => :rvalue, :doc => <<-EOS -Returns true if the variable passed to this function is a float. - EOS - ) do |arguments| - - if (arguments.size != 1) then - raise(Puppet::ParseError, "is_float(): Wrong number of arguments "+ - "given #{arguments.size} for 1") - end - - value = arguments[0] - - if value != value.to_f.to_s and !value.is_a? Float then - return false - else - return true - end - - end -end - -# vim: set ts=2 sw=2 et : diff --git a/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/is_function_available.rb b/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/is_function_available.rb deleted file mode 100644 index 6cbd35c..0000000 --- a/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/is_function_available.rb +++ /dev/null @@ -1,23 +0,0 @@ -# -# is_function_available.rb -# - -module Puppet::Parser::Functions - newfunction(:is_function_available, :type => :rvalue, :doc => <<-EOS -This function accepts a string as an argument, determines whether the -Puppet runtime has access to a function by that name. It returns a -true if the function exists, false if not. - EOS - ) do |arguments| - - if (arguments.size != 1) then - raise(Puppet::ParseError, "is_function_available?(): Wrong number of arguments "+ - "given #{arguments.size} for 1") - end - - function = Puppet::Parser::Functions.function(arguments[0].to_sym) - function.is_a?(String) and not function.empty? - end -end - -# vim: set ts=2 sw=2 et : diff --git a/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/is_hash.rb b/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/is_hash.rb deleted file mode 100644 index ad907f0..0000000 --- a/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/is_hash.rb +++ /dev/null @@ -1,22 +0,0 @@ -# -# is_hash.rb -# - -module Puppet::Parser::Functions - newfunction(:is_hash, :type => :rvalue, :doc => <<-EOS -Returns true if the variable passed to this function is a hash. - EOS - ) do |arguments| - - raise(Puppet::ParseError, "is_hash(): Wrong number of arguments " + - "given (#{arguments.size} for 1)") if arguments.size != 1 - - type = arguments[0] - - result = type.is_a?(Hash) - - return result - end -end - -# vim: set ts=2 sw=2 et : diff --git a/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/is_integer.rb b/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/is_integer.rb deleted file mode 100644 index 6b29e98..0000000 --- a/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/is_integer.rb +++ /dev/null @@ -1,27 +0,0 @@ -# -# is_integer.rb -# - -module Puppet::Parser::Functions - newfunction(:is_integer, :type => :rvalue, :doc => <<-EOS -Returns true if the variable returned to this string is an integer. - EOS - ) do |arguments| - - if (arguments.size != 1) then - raise(Puppet::ParseError, "is_integer(): Wrong number of arguments "+ - "given #{arguments.size} for 1") - end - - value = arguments[0] - - if value != value.to_i.to_s and !value.is_a? Fixnum then - return false - else - return true - end - - end -end - -# vim: set ts=2 sw=2 et : diff --git a/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/is_ip_address.rb b/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/is_ip_address.rb deleted file mode 100644 index a90adab..0000000 --- a/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/is_ip_address.rb +++ /dev/null @@ -1,32 +0,0 @@ -# -# is_ip_address.rb -# - -module Puppet::Parser::Functions - newfunction(:is_ip_address, :type => :rvalue, :doc => <<-EOS -Returns true if the string passed to this function is a valid IP address. - EOS - ) do |arguments| - - require 'ipaddr' - - if (arguments.size != 1) then - raise(Puppet::ParseError, "is_ip_address(): Wrong number of arguments "+ - "given #{arguments.size} for 1") - end - - begin - ip = IPAddr.new(arguments[0]) - rescue ArgumentError - return false - end - - if ip.ipv4? or ip.ipv6? then - return true - else - return false - end - end -end - -# vim: set ts=2 sw=2 et : diff --git a/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/is_mac_address.rb b/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/is_mac_address.rb deleted file mode 100644 index 1b3088a..0000000 --- a/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/is_mac_address.rb +++ /dev/null @@ -1,27 +0,0 @@ -# -# is_mac_address.rb -# - -module Puppet::Parser::Functions - newfunction(:is_mac_address, :type => :rvalue, :doc => <<-EOS -Returns true if the string passed to this function is a valid mac address. - EOS - ) do |arguments| - - if (arguments.size != 1) then - raise(Puppet::ParseError, "is_mac_address(): Wrong number of arguments "+ - "given #{arguments.size} for 1") - end - - mac = arguments[0] - - if /^[a-fA-F0-9]{1,2}:[a-fA-F0-9]{1,2}:[a-fA-F0-9]{1,2}:[a-fA-F0-9]{1,2}:[a-fA-F0-9]{1,2}:[a-fA-F0-9]{1,2}$/.match(mac) then - return true - else - return false - end - - end -end - -# vim: set ts=2 sw=2 et : diff --git a/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/is_numeric.rb b/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/is_numeric.rb deleted file mode 100644 index abf0321..0000000 --- a/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/is_numeric.rb +++ /dev/null @@ -1,27 +0,0 @@ -# -# is_numeric.rb -# - -module Puppet::Parser::Functions - newfunction(:is_numeric, :type => :rvalue, :doc => <<-EOS -Returns true if the variable passed to this function is a number. - EOS - ) do |arguments| - - if (arguments.size != 1) then - raise(Puppet::ParseError, "is_numeric(): Wrong number of arguments "+ - "given #{arguments.size} for 1") - end - - value = arguments[0] - - if value == value.to_f.to_s or value == value.to_i.to_s or value.is_a? Numeric then - return true - else - return false - end - - end -end - -# vim: set ts=2 sw=2 et : diff --git a/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/is_string.rb b/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/is_string.rb deleted file mode 100644 index f5bef04..0000000 --- a/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/is_string.rb +++ /dev/null @@ -1,26 +0,0 @@ -# -# is_string.rb -# - -module Puppet::Parser::Functions - newfunction(:is_string, :type => :rvalue, :doc => <<-EOS -Returns true if the variable passed to this function is a string. - EOS - ) do |arguments| - - raise(Puppet::ParseError, "is_string(): Wrong number of arguments " + - "given (#{arguments.size} for 1)") if arguments.size < 1 - - type = arguments[0] - - result = type.is_a?(String) - - if result and (type == type.to_f.to_s or type == type.to_i.to_s) then - return false - end - - return result - end -end - -# vim: set ts=2 sw=2 et : diff --git a/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/join.rb b/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/join.rb deleted file mode 100644 index 005a46e..0000000 --- a/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/join.rb +++ /dev/null @@ -1,41 +0,0 @@ -# -# join.rb -# - -module Puppet::Parser::Functions - newfunction(:join, :type => :rvalue, :doc => <<-EOS -This function joins an array into a string using a seperator. - -*Examples:* - - join(['a','b','c'], ",") - -Would result in: "a,b,c" - EOS - ) do |arguments| - - # Technically we support two arguments but only first is mandatory ... - raise(Puppet::ParseError, "join(): Wrong number of arguments " + - "given (#{arguments.size} for 1)") if arguments.size < 1 - - array = arguments[0] - - unless array.is_a?(Array) - raise(Puppet::ParseError, 'join(): Requires array to work with') - end - - suffix = arguments[1] if arguments[1] - - if suffix - unless suffix.is_a?(String) - raise(Puppet::ParseError, 'join(): Requires string to work with') - end - end - - result = suffix ? array.join(suffix) : array.join - - return result - end -end - -# vim: set ts=2 sw=2 et : diff --git a/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/join_keys_to_values.rb b/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/join_keys_to_values.rb deleted file mode 100644 index e9924fe..0000000 --- a/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/join_keys_to_values.rb +++ /dev/null @@ -1,47 +0,0 @@ -# -# join.rb -# - -module Puppet::Parser::Functions - newfunction(:join_keys_to_values, :type => :rvalue, :doc => <<-EOS -This function joins each key of a hash to that key's corresponding value with a -separator. Keys and values are cast to strings. The return value is an array in -which each element is one joined key/value pair. - -*Examples:* - - join_keys_to_values({'a'=>1,'b'=>2}, " is ") - -Would result in: ["a is 1","b is 2"] - EOS - ) do |arguments| - - # Validate the number of arguments. - if arguments.size != 2 - raise(Puppet::ParseError, "join_keys_to_values(): Takes exactly two " + - "arguments, but #{arguments.size} given.") - end - - # Validate the first argument. - hash = arguments[0] - if not hash.is_a?(Hash) - raise(TypeError, "join_keys_to_values(): The first argument must be a " + - "hash, but a #{hash.class} was given.") - end - - # Validate the second argument. - separator = arguments[1] - if not separator.is_a?(String) - raise(TypeError, "join_keys_to_values(): The second argument must be a " + - "string, but a #{separator.class} was given.") - end - - # Join the keys to their values. - hash.map do |k,v| - String(k) + separator + String(v) - end - - end -end - -# vim: set ts=2 sw=2 et : diff --git a/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/keys.rb b/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/keys.rb deleted file mode 100644 index f0d13b6..0000000 --- a/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/keys.rb +++ /dev/null @@ -1,26 +0,0 @@ -# -# keys.rb -# - -module Puppet::Parser::Functions - newfunction(:keys, :type => :rvalue, :doc => <<-EOS -Returns the keys of a hash as an array. - EOS - ) do |arguments| - - raise(Puppet::ParseError, "keys(): Wrong number of arguments " + - "given (#{arguments.size} for 1)") if arguments.size < 1 - - hash = arguments[0] - - unless hash.is_a?(Hash) - raise(Puppet::ParseError, 'keys(): Requires hash to work with') - end - - result = hash.keys - - return result - end -end - -# vim: set ts=2 sw=2 et : diff --git a/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/loadyaml.rb b/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/loadyaml.rb deleted file mode 100644 index 10c4005..0000000 --- a/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/loadyaml.rb +++ /dev/null @@ -1,20 +0,0 @@ -module Puppet::Parser::Functions - - newfunction(:loadyaml, :type => :rvalue, :doc => <<-'ENDHEREDOC') do |args| - Load a YAML file containing an array, string, or hash, and return the data - in the corresponding native data type. - - For example: - - $myhash = loadyaml('/etc/puppet/data/myhash.yaml') - ENDHEREDOC - - unless args.length == 1 - raise Puppet::ParseError, ("loadyaml(): wrong number of arguments (#{args.length}; must be 1)") - end - - YAML.load_file(args[0]) - - end - -end diff --git a/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/lstrip.rb b/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/lstrip.rb deleted file mode 100644 index 3a64de3..0000000 --- a/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/lstrip.rb +++ /dev/null @@ -1,33 +0,0 @@ -# -# lstrip.rb -# - -module Puppet::Parser::Functions - newfunction(:lstrip, :type => :rvalue, :doc => <<-EOS -Strips leading spaces to the left of a string. - EOS - ) do |arguments| - - raise(Puppet::ParseError, "lstrip(): Wrong number of arguments " + - "given (#{arguments.size} for 1)") if arguments.size < 1 - - value = arguments[0] - klass = value.class - - unless [Array, String].include?(klass) - raise(Puppet::ParseError, 'lstrip(): Requires either ' + - 'array or string to work with') - end - - if value.is_a?(Array) - # Numbers in Puppet are often string-encoded which is troublesome ... - result = value.collect { |i| i.is_a?(String) ? i.lstrip : i } - else - result = value.lstrip - end - - return result - end -end - -# vim: set ts=2 sw=2 et : diff --git a/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/max.rb b/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/max.rb deleted file mode 100644 index 60fb94a..0000000 --- a/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/max.rb +++ /dev/null @@ -1,21 +0,0 @@ -module Puppet::Parser::Functions - newfunction(:max, :type => :rvalue, :doc => <<-EOS - Returns the highest value of all arguments. - Requires at least one argument. - EOS - ) do |args| - - raise(Puppet::ParseError, "max(): Wrong number of arguments " + - "need at least one") if args.size == 0 - - # Sometimes we get numbers as numerics and sometimes as strings. - # We try to compare them as numbers when possible - return args.max do |a,b| - if a.to_s =~ /\A-?\d+(.\d+)?\z/ and b.to_s =~ /\A-?\d+(.\d+)?\z/ then - a.to_f <=> b.to_f - else - a.to_s <=> b.to_s - end - end - end -end diff --git a/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/member.rb b/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/member.rb deleted file mode 100644 index 43d76af..0000000 --- a/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/member.rb +++ /dev/null @@ -1,44 +0,0 @@ -# -# member.rb -# - -# TODO(Krzysztof Wilczynski): We need to add support for regular expression ... -# TODO(Krzysztof Wilczynski): Support for strings and hashes too ... - -module Puppet::Parser::Functions - newfunction(:member, :type => :rvalue, :doc => <<-EOS -This function determines if a variable is a member of an array. - -*Examples:* - - member(['a','b'], 'b') - -Would return: true - - member(['a','b'], 'c') - -Would return: false - EOS - ) do |arguments| - - raise(Puppet::ParseError, "member(): Wrong number of arguments " + - "given (#{arguments.size} for 2)") if arguments.size < 2 - - array = arguments[0] - - unless array.is_a?(Array) - raise(Puppet::ParseError, 'member(): Requires array to work with') - end - - item = arguments[1] - - raise(Puppet::ParseError, 'member(): You must provide item ' + - 'to search for within array given') if item.empty? - - result = array.include?(item) - - return result - end -end - -# vim: set ts=2 sw=2 et : diff --git a/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/merge.rb b/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/merge.rb deleted file mode 100644 index 6ec085e..0000000 --- a/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/merge.rb +++ /dev/null @@ -1,33 +0,0 @@ -module Puppet::Parser::Functions - newfunction(:merge, :type => :rvalue, :doc => <<-'ENDHEREDOC') do |args| - Merges two or more hashes together and returns the resulting hash. - - For example: - - $hash1 = {'one' => 1, 'two', => 2} - $hash2 = {'two' => 'dos', 'three', => 'tres'} - $merged_hash = merge($hash1, $hash2) - # The resulting hash is equivalent to: - # $merged_hash = {'one' => 1, 'two' => 'dos', 'three' => 'tres'} - - When there is a duplicate key, the key in the rightmost hash will "win." - - ENDHEREDOC - - if args.length < 2 - raise Puppet::ParseError, ("merge(): wrong number of arguments (#{args.length}; must be at least 2)") - end - - # The hash we accumulate into - accumulator = Hash.new - # Merge into the accumulator hash - args.each do |arg| - unless arg.is_a?(Hash) - raise Puppet::ParseError, "merge: unexpected argument type #{arg.class}, only expects hash arguments" - end - accumulator.merge!(arg) - end - # Return the fully merged hash - accumulator - end -end diff --git a/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/min.rb b/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/min.rb deleted file mode 100644 index 6bd6ebf..0000000 --- a/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/min.rb +++ /dev/null @@ -1,21 +0,0 @@ -module Puppet::Parser::Functions - newfunction(:min, :type => :rvalue, :doc => <<-EOS - Returns the lowest value of all arguments. - Requires at least one argument. - EOS - ) do |args| - - raise(Puppet::ParseError, "min(): Wrong number of arguments " + - "need at least one") if args.size == 0 - - # Sometimes we get numbers as numerics and sometimes as strings. - # We try to compare them as numbers when possible - return args.min do |a,b| - if a.to_s =~ /\A^-?\d+(.\d+)?\z/ and b.to_s =~ /\A-?\d+(.\d+)?\z/ then - a.to_f <=> b.to_f - else - a.to_s <=> b.to_s - end - end - end -end diff --git a/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/num2bool.rb b/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/num2bool.rb deleted file mode 100644 index af0e6ed..0000000 --- a/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/num2bool.rb +++ /dev/null @@ -1,43 +0,0 @@ -# -# num2bool.rb -# - -module Puppet::Parser::Functions - newfunction(:num2bool, :type => :rvalue, :doc => <<-EOS -This function converts a number or a string representation of a number into a -true boolean. Zero or anything non-numeric becomes false. Numbers higher then 0 -become true. - EOS - ) do |arguments| - - raise(Puppet::ParseError, "num2bool(): Wrong number of arguments " + - "given (#{arguments.size} for 1)") if arguments.size != 1 - - number = arguments[0] - - case number - when Numeric - # Yay, it's a number - when String - begin - number = Float(number) - rescue ArgumentError => ex - raise(Puppet::ParseError, "num2bool(): '#{number}' does not look like a number: #{ex.message}") - end - else - begin - number = number.to_s - rescue NoMethodError => ex - raise(Puppet::ParseError, "num2bool(): Unable to parse argument: #{ex.message}") - end - end - - # Truncate Floats - number = number.to_i - - # Return true for any positive number and false otherwise - return number > 0 - end -end - -# vim: set ts=2 sw=2 et : diff --git a/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/parsejson.rb b/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/parsejson.rb deleted file mode 100644 index a9a16a4..0000000 --- a/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/parsejson.rb +++ /dev/null @@ -1,24 +0,0 @@ -# -# parsejson.rb -# - -module Puppet::Parser::Functions - newfunction(:parsejson, :type => :rvalue, :doc => <<-EOS -This function accepts JSON as a string and converts into the correct Puppet -structure. - EOS - ) do |arguments| - - if (arguments.size != 1) then - raise(Puppet::ParseError, "parsejson(): Wrong number of arguments "+ - "given #{arguments.size} for 1") - end - - json = arguments[0] - - # PSON is natively available in puppet - PSON.load(json) - end -end - -# vim: set ts=2 sw=2 et : diff --git a/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/parseyaml.rb b/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/parseyaml.rb deleted file mode 100644 index 53d54fa..0000000 --- a/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/parseyaml.rb +++ /dev/null @@ -1,24 +0,0 @@ -# -# parseyaml.rb -# - -module Puppet::Parser::Functions - newfunction(:parseyaml, :type => :rvalue, :doc => <<-EOS -This function accepts YAML as a string and converts it into the correct -Puppet structure. - EOS - ) do |arguments| - - if (arguments.size != 1) then - raise(Puppet::ParseError, "parseyaml(): Wrong number of arguments "+ - "given #{arguments.size} for 1") - end - - require 'yaml' - - YAML::load(arguments[0]) - - end -end - -# vim: set ts=2 sw=2 et : diff --git a/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/pick.rb b/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/pick.rb deleted file mode 100644 index cbc0300..0000000 --- a/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/pick.rb +++ /dev/null @@ -1,29 +0,0 @@ -module Puppet::Parser::Functions - newfunction(:pick, :type => :rvalue, :doc => <<-EOS - -This function is similar to a coalesce function in SQL in that it will return -the first value in a list of values that is not undefined or an empty string -(two things in Puppet that will return a boolean false value). Typically, -this function is used to check for a value in the Puppet Dashboard/Enterprise -Console, and failover to a default value like the following: - - $real_jenkins_version = pick($::jenkins_version, '1.449') - -The value of $real_jenkins_version will first look for a top-scope variable -called 'jenkins_version' (note that parameters set in the Puppet Dashboard/ -Enterprise Console are brought into Puppet as top-scope variables), and, -failing that, will use a default value of 1.449. - -EOS -) do |args| - args = args.compact - args.delete(:undef) - args.delete(:undefined) - args.delete("") - if args[0].to_s.empty? then - fail "Must provide non empty value." - else - return args[0] - end - end -end diff --git a/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/prefix.rb b/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/prefix.rb deleted file mode 100644 index 62211ae..0000000 --- a/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/prefix.rb +++ /dev/null @@ -1,45 +0,0 @@ -# -# prefix.rb -# - -module Puppet::Parser::Functions - newfunction(:prefix, :type => :rvalue, :doc => <<-EOS -This function applies a prefix to all elements in an array. - -*Examples:* - - prefix(['a','b','c'], 'p') - -Will return: ['pa','pb','pc'] - EOS - ) do |arguments| - - # Technically we support two arguments but only first is mandatory ... - raise(Puppet::ParseError, "prefix(): Wrong number of arguments " + - "given (#{arguments.size} for 1)") if arguments.size < 1 - - array = arguments[0] - - unless array.is_a?(Array) - raise Puppet::ParseError, "prefix(): expected first argument to be an Array, got #{array.inspect}" - end - - prefix = arguments[1] if arguments[1] - - if prefix - unless prefix.is_a?(String) - raise Puppet::ParseError, "prefix(): expected second argument to be a String, got #{suffix.inspect}" - end - end - - # Turn everything into string same as join would do ... - result = array.collect do |i| - i = i.to_s - prefix ? prefix + i : i - end - - return result - end -end - -# vim: set ts=2 sw=2 et : diff --git a/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/range.rb b/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/range.rb deleted file mode 100644 index 825617b..0000000 --- a/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/range.rb +++ /dev/null @@ -1,80 +0,0 @@ -# -# range.rb -# - -# TODO(Krzysztof Wilczynski): We probably need to approach numeric values differently ... - -module Puppet::Parser::Functions - newfunction(:range, :type => :rvalue, :doc => <<-EOS -When given range in the form of (start, stop) it will extrapolate a range as -an array. - -*Examples:* - - range("0", "9") - -Will return: [0,1,2,3,4,5,6,7,8,9] - - range("00", "09") - -Will return: [0,1,2,3,4,5,6,7,8,9] (Zero padded strings are converted to -integers automatically) - - range("a", "c") - -Will return: ["a","b","c"] - - range("host01", "host10") - -Will return: ["host01", "host02", ..., "host09", "host10"] - EOS - ) do |arguments| - - # We support more than one argument but at least one is mandatory ... - raise(Puppet::ParseError, "range(): Wrong number of " + - "arguments given (#{arguments.size} for 1)") if arguments.size < 1 - - if arguments.size > 1 - start = arguments[0] - stop = arguments[1] - - type = '..' # We select simplest type for Range available in Ruby ... - - elsif arguments.size > 0 - value = arguments[0] - - if m = value.match(/^(\w+)(\.\.\.?|\-)(\w+)$/) - start = m[1] - stop = m[3] - - type = m[2] - - elsif value.match(/^.+$/) - raise(Puppet::ParseError, 'range(): Unable to compute range ' + - 'from the value given') - else - raise(Puppet::ParseError, 'range(): Unknown format of range given') - end - end - - # Check whether we have integer value if so then make it so ... - if start.match(/^\d+$/) - start = start.to_i - stop = stop.to_i - else - start = start.to_s - stop = stop.to_s - end - - range = case type - when /^(\.\.|\-)$/ then (start .. stop) - when /^(\.\.\.)$/ then (start ... stop) # Exclusive of last element ... - end - - result = range.collect { |i| i } # Get them all ... Pokemon ... - - return result - end -end - -# vim: set ts=2 sw=2 et : diff --git a/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/reject.rb b/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/reject.rb deleted file mode 100644 index 1953ffc..0000000 --- a/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/reject.rb +++ /dev/null @@ -1,31 +0,0 @@ -# -# reject.rb -# - -module Puppet::Parser::Functions - newfunction(:reject, :type => :rvalue, :doc => <<-EOS) do |args| -This function searches through an array and rejects all elements that match -the provided regular expression. - -*Examples:* - - reject(['aaa','bbb','ccc','aaaddd'], 'aaa') - -Would return: - - ['bbb','ccc'] -EOS - - if (args.size != 2) - raise Puppet::ParseError, - "reject(): Wrong number of arguments given #{args.size} for 2" - end - - ary = args[0] - pattern = Regexp.new(args[1]) - - ary.reject { |e| e =~ pattern } - end -end - -# vim: set ts=2 sw=2 et : diff --git a/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/reverse.rb b/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/reverse.rb deleted file mode 100644 index fe04869..0000000 --- a/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/reverse.rb +++ /dev/null @@ -1,28 +0,0 @@ -# -# reverse.rb -# - -module Puppet::Parser::Functions - newfunction(:reverse, :type => :rvalue, :doc => <<-EOS -Reverses the order of a string or array. - EOS - ) do |arguments| - - raise(Puppet::ParseError, "reverse(): Wrong number of arguments " + - "given (#{arguments.size} for 1)") if arguments.size < 1 - - value = arguments[0] - klass = value.class - - unless [Array, String].include?(klass) - raise(Puppet::ParseError, 'reverse(): Requires either ' + - 'array or string to work with') - end - - result = value.reverse - - return result - end -end - -# vim: set ts=2 sw=2 et : diff --git a/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/rstrip.rb b/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/rstrip.rb deleted file mode 100644 index 29b0998..0000000 --- a/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/rstrip.rb +++ /dev/null @@ -1,32 +0,0 @@ -# -# rstrip.rb -# - -module Puppet::Parser::Functions - newfunction(:rstrip, :type => :rvalue, :doc => <<-EOS -Strips leading spaces to the right of the string. - EOS - ) do |arguments| - - raise(Puppet::ParseError, "rstrip(): Wrong number of arguments " + - "given (#{arguments.size} for 1)") if arguments.size < 1 - - value = arguments[0] - klass = value.class - - unless [Array, String].include?(klass) - raise(Puppet::ParseError, 'rstrip(): Requires either ' + - 'array or string to work with') - end - - if value.is_a?(Array) - result = value.collect { |i| i.is_a?(String) ? i.rstrip : i } - else - result = value.rstrip - end - - return result - end -end - -# vim: set ts=2 sw=2 et : diff --git a/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/shuffle.rb b/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/shuffle.rb deleted file mode 100644 index 18134ab..0000000 --- a/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/shuffle.rb +++ /dev/null @@ -1,46 +0,0 @@ -# -# shuffle.rb -# - -module Puppet::Parser::Functions - newfunction(:shuffle, :type => :rvalue, :doc => <<-EOS -Randomizes the order of a string or array elements. - EOS - ) do |arguments| - - raise(Puppet::ParseError, "shuffle(): Wrong number of arguments " + - "given (#{arguments.size} for 1)") if arguments.size < 1 - - value = arguments[0] - klass = value.class - - unless [Array, String].include?(klass) - raise(Puppet::ParseError, 'shuffle(): Requires either ' + - 'array or string to work with') - end - - result = value.clone - - string = value.is_a?(String) ? true : false - - # Check whether it makes sense to shuffle ... - return result if result.size <= 1 - - # We turn any string value into an array to be able to shuffle ... - result = string ? result.split('') : result - - elements = result.size - - # Simple implementation of Fisher–Yates in-place shuffle ... - elements.times do |i| - j = rand(elements - i) + i - result[j], result[i] = result[i], result[j] - end - - result = string ? result.join : result - - return result - end -end - -# vim: set ts=2 sw=2 et : diff --git a/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/size.rb b/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/size.rb deleted file mode 100644 index cc207e3..0000000 --- a/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/size.rb +++ /dev/null @@ -1,48 +0,0 @@ -# -# size.rb -# - -# TODO(Krzysztof Wilczynski): Support for hashes would be nice too ... - -module Puppet::Parser::Functions - newfunction(:size, :type => :rvalue, :doc => <<-EOS -Returns the number of elements in a string or array. - EOS - ) do |arguments| - - raise(Puppet::ParseError, "size(): Wrong number of arguments " + - "given (#{arguments.size} for 1)") if arguments.size < 1 - - item = arguments[0] - - if item.is_a?(String) - - begin - # - # Check whether your item is a numeric value or not ... - # This will take care about positive and/or negative numbers - # for both integer and floating-point values ... - # - # Please note that Puppet has no notion of hexadecimal - # nor octal numbers for its DSL at this point in time ... - # - Float(item) - - raise(Puppet::ParseError, 'size(): Requires either ' + - 'string or array to work with') - - rescue ArgumentError - result = item.size - end - - elsif item.is_a?(Array) - result = item.size - else - raise(Puppet::ParseError, 'size(): Unknown type given') - end - - return result - end -end - -# vim: set ts=2 sw=2 et : diff --git a/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/sort.rb b/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/sort.rb deleted file mode 100644 index cefbe54..0000000 --- a/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/sort.rb +++ /dev/null @@ -1,27 +0,0 @@ -# -# sort.rb -# - -module Puppet::Parser::Functions - newfunction(:sort, :type => :rvalue, :doc => <<-EOS -Sorts strings and arrays lexically. - EOS - ) do |arguments| - - if (arguments.size != 1) then - raise(Puppet::ParseError, "sort(): Wrong number of arguments "+ - "given #{arguments.size} for 1") - end - - value = arguments[0] - - if value.is_a?(Array) then - value.sort - elsif value.is_a?(String) then - value.split("").sort.join("") - end - - end -end - -# vim: set ts=2 sw=2 et : diff --git a/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/squeeze.rb b/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/squeeze.rb deleted file mode 100644 index 81fadfd..0000000 --- a/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/squeeze.rb +++ /dev/null @@ -1,36 +0,0 @@ -# -# squeeze.rb -# - -module Puppet::Parser::Functions - newfunction(:squeeze, :type => :rvalue, :doc => <<-EOS -Returns a new string where runs of the same character that occur in this set are replaced by a single character. - EOS - ) do |arguments| - - if ((arguments.size != 2) and (arguments.size != 1)) then - raise(Puppet::ParseError, "squeeze(): Wrong number of arguments "+ - "given #{arguments.size} for 2 or 1") - end - - item = arguments[0] - squeezeval = arguments[1] - - if item.is_a?(Array) then - if squeezeval then - item.collect { |i| i.squeeze(squeezeval) } - else - item.collect { |i| i.squeeze } - end - else - if squeezeval then - item.squeeze(squeezeval) - else - item.squeeze - end - end - - end -end - -# vim: set ts=2 sw=2 et : diff --git a/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/str2bool.rb b/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/str2bool.rb deleted file mode 100644 index fece7a6..0000000 --- a/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/str2bool.rb +++ /dev/null @@ -1,46 +0,0 @@ -# -# str2bool.rb -# - -module Puppet::Parser::Functions - newfunction(:str2bool, :type => :rvalue, :doc => <<-EOS -This converts a string to a boolean. This attempt to convert strings that -contain things like: y, 1, t, true to 'true' and strings that contain things -like: 0, f, n, false, no to 'false'. - EOS - ) do |arguments| - - raise(Puppet::ParseError, "str2bool(): Wrong number of arguments " + - "given (#{arguments.size} for 1)") if arguments.size < 1 - - string = arguments[0] - - # If string is already Boolean, return it - if !!string == string - return string - end - - unless string.is_a?(String) - raise(Puppet::ParseError, 'str2bool(): Requires either ' + - 'string to work with') - end - - # We consider all the yes, no, y, n and so on too ... - result = case string - # - # This is how undef looks like in Puppet ... - # We yield false in this case. - # - when /^$/, '' then false # Empty string will be false ... - when /^(1|t|y|true|yes)$/ then true - when /^(0|f|n|false|no)$/ then false - when /^(undef|undefined)$/ then false # This is not likely to happen ... - else - raise(Puppet::ParseError, 'str2bool(): Unknown type of boolean given') - end - - return result - end -end - -# vim: set ts=2 sw=2 et : diff --git a/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/str2saltedsha512.rb b/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/str2saltedsha512.rb deleted file mode 100644 index 7fe7b01..0000000 --- a/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/str2saltedsha512.rb +++ /dev/null @@ -1,32 +0,0 @@ -# -# str2saltedsha512.rb -# - -module Puppet::Parser::Functions - newfunction(:str2saltedsha512, :type => :rvalue, :doc => <<-EOS -This converts a string to a salted-SHA512 password hash (which is used for -OS X versions >= 10.7). Given any simple string, you will get a hex version -of a salted-SHA512 password hash that can be inserted into your Puppet -manifests as a valid password attribute. - EOS - ) do |arguments| - require 'digest/sha2' - - raise(Puppet::ParseError, "str2saltedsha512(): Wrong number of arguments " + - "passed (#{arguments.size} but we require 1)") if arguments.size != 1 - - password = arguments[0] - - unless password.is_a?(String) - raise(Puppet::ParseError, 'str2saltedsha512(): Requires a ' + - "String argument, you passed: #{password.class}") - end - - seedint = rand(2**31 - 1) - seedstring = Array(seedint).pack("L") - saltedpass = Digest::SHA512.digest(seedstring + password) - (seedstring + saltedpass).unpack('H*')[0] - end -end - -# vim: set ts=2 sw=2 et : diff --git a/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/strftime.rb b/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/strftime.rb deleted file mode 100644 index 0b52ade..0000000 --- a/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/strftime.rb +++ /dev/null @@ -1,107 +0,0 @@ -# -# strftime.rb -# - -module Puppet::Parser::Functions - newfunction(:strftime, :type => :rvalue, :doc => <<-EOS -This function returns formatted time. - -*Examples:* - -To return the time since epoch: - - strftime("%s") - -To return the date: - - strftime("%Y-%m-%d") - -*Format meaning:* - - %a - The abbreviated weekday name (``Sun'') - %A - The full weekday name (``Sunday'') - %b - The abbreviated month name (``Jan'') - %B - The full month name (``January'') - %c - The preferred local date and time representation - %C - Century (20 in 2009) - %d - Day of the month (01..31) - %D - Date (%m/%d/%y) - %e - Day of the month, blank-padded ( 1..31) - %F - Equivalent to %Y-%m-%d (the ISO 8601 date format) - %h - Equivalent to %b - %H - Hour of the day, 24-hour clock (00..23) - %I - Hour of the day, 12-hour clock (01..12) - %j - Day of the year (001..366) - %k - hour, 24-hour clock, blank-padded ( 0..23) - %l - hour, 12-hour clock, blank-padded ( 0..12) - %L - Millisecond of the second (000..999) - %m - Month of the year (01..12) - %M - Minute of the hour (00..59) - %n - Newline (\n) - %N - Fractional seconds digits, default is 9 digits (nanosecond) - %3N millisecond (3 digits) - %6N microsecond (6 digits) - %9N nanosecond (9 digits) - %p - Meridian indicator (``AM'' or ``PM'') - %P - Meridian indicator (``am'' or ``pm'') - %r - time, 12-hour (same as %I:%M:%S %p) - %R - time, 24-hour (%H:%M) - %s - Number of seconds since 1970-01-01 00:00:00 UTC. - %S - Second of the minute (00..60) - %t - Tab character (\t) - %T - time, 24-hour (%H:%M:%S) - %u - Day of the week as a decimal, Monday being 1. (1..7) - %U - Week number of the current year, - starting with the first Sunday as the first - day of the first week (00..53) - %v - VMS date (%e-%b-%Y) - %V - Week number of year according to ISO 8601 (01..53) - %W - Week number of the current year, - starting with the first Monday as the first - day of the first week (00..53) - %w - Day of the week (Sunday is 0, 0..6) - %x - Preferred representation for the date alone, no time - %X - Preferred representation for the time alone, no date - %y - Year without a century (00..99) - %Y - Year with century - %z - Time zone as hour offset from UTC (e.g. +0900) - %Z - Time zone name - %% - Literal ``%'' character - EOS - ) do |arguments| - - # Technically we support two arguments but only first is mandatory ... - raise(Puppet::ParseError, "strftime(): Wrong number of arguments " + - "given (#{arguments.size} for 1)") if arguments.size < 1 - - format = arguments[0] - - raise(Puppet::ParseError, 'strftime(): You must provide ' + - 'format for evaluation') if format.empty? - - # The Time Zone argument is optional ... - time_zone = arguments[1] if arguments[1] - - time = Time.new - - # There is probably a better way to handle Time Zone ... - if time_zone and not time_zone.empty? - original_zone = ENV['TZ'] - - local_time = time.clone - local_time = local_time.utc - - ENV['TZ'] = time_zone - - time = local_time.localtime - - ENV['TZ'] = original_zone - end - - result = time.strftime(format) - - return result - end -end - -# vim: set ts=2 sw=2 et : diff --git a/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/strip.rb b/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/strip.rb deleted file mode 100644 index 5f4630d..0000000 --- a/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/strip.rb +++ /dev/null @@ -1,39 +0,0 @@ -# -# strip.rb -# - -module Puppet::Parser::Functions - newfunction(:strip, :type => :rvalue, :doc => <<-EOS -This function removes leading and trailing whitespace from a string or from -every string inside an array. - -*Examples:* - - strip(" aaa ") - -Would result in: "aaa" - EOS - ) do |arguments| - - raise(Puppet::ParseError, "strip(): Wrong number of arguments " + - "given (#{arguments.size} for 1)") if arguments.size < 1 - - value = arguments[0] - klass = value.class - - unless [Array, String].include?(klass) - raise(Puppet::ParseError, 'strip(): Requires either ' + - 'array or string to work with') - end - - if value.is_a?(Array) - result = value.collect { |i| i.is_a?(String) ? i.strip : i } - else - result = value.strip - end - - return result - end -end - -# vim: set ts=2 sw=2 et : diff --git a/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/suffix.rb b/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/suffix.rb deleted file mode 100644 index f7792d6..0000000 --- a/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/suffix.rb +++ /dev/null @@ -1,45 +0,0 @@ -# -# suffix.rb -# - -module Puppet::Parser::Functions - newfunction(:suffix, :type => :rvalue, :doc => <<-EOS -This function applies a suffix to all elements in an array. - -*Examples:* - - suffix(['a','b','c'], 'p') - -Will return: ['ap','bp','cp'] - EOS - ) do |arguments| - - # Technically we support two arguments but only first is mandatory ... - raise(Puppet::ParseError, "suffix(): Wrong number of arguments " + - "given (#{arguments.size} for 1)") if arguments.size < 1 - - array = arguments[0] - - unless array.is_a?(Array) - raise Puppet::ParseError, "suffix(): expected first argument to be an Array, got #{array.inspect}" - end - - suffix = arguments[1] if arguments[1] - - if suffix - unless suffix.is_a? String - raise Puppet::ParseError, "suffix(): expected second argument to be a String, got #{suffix.inspect}" - end - end - - # Turn everything into string same as join would do ... - result = array.collect do |i| - i = i.to_s - suffix ? i + suffix : i - end - - return result - end -end - -# vim: set ts=2 sw=2 et : diff --git a/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/swapcase.rb b/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/swapcase.rb deleted file mode 100644 index b9e6632..0000000 --- a/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/swapcase.rb +++ /dev/null @@ -1,39 +0,0 @@ -# -# swapcase.rb -# - -module Puppet::Parser::Functions - newfunction(:swapcase, :type => :rvalue, :doc => <<-EOS -This function will swap the existing case of a string. - -*Examples:* - - swapcase("aBcD") - -Would result in: "AbCd" - EOS - ) do |arguments| - - raise(Puppet::ParseError, "swapcase(): Wrong number of arguments " + - "given (#{arguments.size} for 1)") if arguments.size < 1 - - value = arguments[0] - klass = value.class - - unless [Array, String].include?(klass) - raise(Puppet::ParseError, 'swapcase(): Requires either ' + - 'array or string to work with') - end - - if value.is_a?(Array) - # Numbers in Puppet are often string-encoded which is troublesome ... - result = value.collect { |i| i.is_a?(String) ? i.swapcase : i } - else - result = value.swapcase - end - - return result - end -end - -# vim: set ts=2 sw=2 et : diff --git a/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/time.rb b/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/time.rb deleted file mode 100644 index 0cddaf8..0000000 --- a/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/time.rb +++ /dev/null @@ -1,49 +0,0 @@ -# -# time.rb -# - -module Puppet::Parser::Functions - newfunction(:time, :type => :rvalue, :doc => <<-EOS -This function will return the current time since epoch as an integer. - -*Examples:* - - time() - -Will return something like: 1311972653 - EOS - ) do |arguments| - - # The Time Zone argument is optional ... - time_zone = arguments[0] if arguments[0] - - if (arguments.size != 0) and (arguments.size != 1) then - raise(Puppet::ParseError, "time(): Wrong number of arguments "+ - "given #{arguments.size} for 0 or 1") - end - - time = Time.new - - # There is probably a better way to handle Time Zone ... - if time_zone and not time_zone.empty? - original_zone = ENV['TZ'] - - local_time = time.clone - local_time = local_time.utc - - ENV['TZ'] = time_zone - - time = local_time.localtime - - ENV['TZ'] = original_zone - end - - # Calling Time#to_i on a receiver changes it. Trust me I am the Doctor. - result = time.strftime('%s') - result = result.to_i - - return result - end -end - -# vim: set ts=2 sw=2 et : diff --git a/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/to_bytes.rb b/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/to_bytes.rb deleted file mode 100644 index 8ff73d1..0000000 --- a/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/to_bytes.rb +++ /dev/null @@ -1,28 +0,0 @@ -module Puppet::Parser::Functions - newfunction(:to_bytes, :type => :rvalue, :doc => <<-EOS - Converts the argument into bytes, for example 4 kB becomes 4096. - Takes a single string value as an argument. - EOS - ) do |arguments| - - raise(Puppet::ParseError, "to_bytes(): Wrong number of arguments " + - "given (#{arguments.size} for 1)") if arguments.size != 1 - - arg = arguments[0] - - return arg if arg.is_a? Numeric - - value,prefix = */([0-9.e+-]*)\s*([^bB]?)/.match(arg)[1,2] - - value = value.to_f - case prefix - when '' then return value.to_i - when 'k' then return (value*(1<<10)).to_i - when 'M' then return (value*(1<<20)).to_i - when 'G' then return (value*(1<<30)).to_i - when 'T' then return (value*(1<<40)).to_i - when 'E' then return (value*(1<<50)).to_i - else raise Puppet::ParseError, "to_bytes(): Unknown prefix #{prefix}" - end - end -end diff --git a/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/type.rb b/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/type.rb deleted file mode 100644 index 8d85f11..0000000 --- a/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/type.rb +++ /dev/null @@ -1,50 +0,0 @@ -# -# type.rb -# - -module Puppet::Parser::Functions - newfunction(:type, :type => :rvalue, :doc => <<-EOS -Returns the type when passed a variable. Type can be one of: - -* string -* array -* hash -* float -* integer -* boolean - EOS - ) do |arguments| - - raise(Puppet::ParseError, "type(): Wrong number of arguments " + - "given (#{arguments.size} for 1)") if arguments.size < 1 - - value = arguments[0] - - klass = value.class - - if not [TrueClass, FalseClass, Array, Bignum, Fixnum, Float, Hash, String].include?(klass) - raise(Puppet::ParseError, 'type(): Unknown type') - end - - klass = klass.to_s # Ugly ... - - # We note that Integer is the parent to Bignum and Fixnum ... - result = case klass - when /^(?:Big|Fix)num$/ then 'integer' - when /^(?:True|False)Class$/ then 'boolean' - else klass - end - - if result == "String" then - if value == value.to_i.to_s then - result = "Integer" - elsif value == value.to_f.to_s then - result = "Float" - end - end - - return result.downcase - end -end - -# vim: set ts=2 sw=2 et : diff --git a/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/unique.rb b/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/unique.rb deleted file mode 100644 index 8844a74..0000000 --- a/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/unique.rb +++ /dev/null @@ -1,51 +0,0 @@ -# -# unique.rb -# - -module Puppet::Parser::Functions - newfunction(:unique, :type => :rvalue, :doc => <<-EOS -This function will remove duplicates from strings and arrays. - -*Examples:* - - unique("aabbcc") - -Will return: - - abc - -You can also use this with arrays: - - unique(["a","a","b","b","c","c"]) - -This returns: - - ["a","b","c"] - EOS - ) do |arguments| - - raise(Puppet::ParseError, "unique(): Wrong number of arguments " + - "given (#{arguments.size} for 1)") if arguments.size < 1 - - value = arguments[0] - klass = value.class - - unless [Array, String].include?(klass) - raise(Puppet::ParseError, 'unique(): Requires either ' + - 'array or string to work with') - end - - result = value.clone - - string = value.is_a?(String) ? true : false - - # We turn any string value into an array to be able to shuffle ... - result = string ? result.split('') : result - result = result.uniq # Remove duplicates ... - result = string ? result.join : result - - return result - end -end - -# vim: set ts=2 sw=2 et : diff --git a/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/upcase.rb b/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/upcase.rb deleted file mode 100644 index fe6cadc..0000000 --- a/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/upcase.rb +++ /dev/null @@ -1,41 +0,0 @@ -# -# upcase.rb -# - -module Puppet::Parser::Functions - newfunction(:upcase, :type => :rvalue, :doc => <<-EOS -Converts a string or an array of strings to uppercase. - -*Examples:* - - upcase("abcd") - -Will return: - - ASDF - EOS - ) do |arguments| - - raise(Puppet::ParseError, "upcase(): Wrong number of arguments " + - "given (#{arguments.size} for 1)") if arguments.size < 1 - - value = arguments[0] - klass = value.class - - unless [Array, String].include?(klass) - raise(Puppet::ParseError, 'upcase(): Requires either ' + - 'array or string to work with') - end - - if value.is_a?(Array) - # Numbers in Puppet are often string-encoded which is troublesome ... - result = value.collect { |i| i.is_a?(String) ? i.upcase : i } - else - result = value.upcase - end - - return result - end -end - -# vim: set ts=2 sw=2 et : diff --git a/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/uriescape.rb b/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/uriescape.rb deleted file mode 100644 index 67b93a6..0000000 --- a/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/uriescape.rb +++ /dev/null @@ -1,36 +0,0 @@ -# -# uriescape.rb -# -require 'uri' - -module Puppet::Parser::Functions - newfunction(:uriescape, :type => :rvalue, :doc => <<-EOS - Urlencodes a string or array of strings. - Requires either a single string or an array as an input. - EOS - ) do |arguments| - - raise(Puppet::ParseError, "uriescape(): Wrong number of arguments " + - "given (#{arguments.size} for 1)") if arguments.size < 1 - - value = arguments[0] - klass = value.class - unsafe = ":/?#[]@!$&'()*+,;= " - - unless [Array, String].include?(klass) - raise(Puppet::ParseError, 'uriescape(): Requires either ' + - 'array or string to work with') - end - - if value.is_a?(Array) - # Numbers in Puppet are often string-encoded which is troublesome ... - result = value.collect { |i| i.is_a?(String) ? URI.escape(i,unsafe) : i } - else - result = URI.escape(value,unsafe) - end - - return result - end -end - -# vim: set ts=2 sw=2 et : diff --git a/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/validate_absolute_path.rb b/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/validate_absolute_path.rb deleted file mode 100644 index fe27974..0000000 --- a/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/validate_absolute_path.rb +++ /dev/null @@ -1,56 +0,0 @@ -module Puppet::Parser::Functions - newfunction(:validate_absolute_path, :doc => <<-'ENDHEREDOC') do |args| - Validate the string represents an absolute path in the filesystem. This function works - for windows and unix style paths. - - The following values will pass: - - $my_path = "C:/Program Files (x86)/Puppet Labs/Puppet" - validate_absolute_path($my_path) - $my_path2 = "/var/lib/puppet" - validate_absolute_path($my_path2) - - - The following values will fail, causing compilation to abort: - - validate_absolute_path(true) - validate_absolute_path([ 'var/lib/puppet', '/var/foo' ]) - validate_absolute_path([ '/var/lib/puppet', 'var/foo' ]) - $undefined = undef - validate_absolute_path($undefined) - - ENDHEREDOC - - require 'puppet/util' - - unless args.length > 0 then - raise Puppet::ParseError, ("validate_absolute_path(): wrong number of arguments (#{args.length}; must be > 0)") - end - - args.each do |arg| - # This logic was borrowed from - # [lib/puppet/file_serving/base.rb](https://github.com/puppetlabs/puppet/blob/master/lib/puppet/file_serving/base.rb) - - # Puppet 2.7 and beyond will have Puppet::Util.absolute_path? Fall back to a back-ported implementation otherwise. - if Puppet::Util.respond_to?(:absolute_path?) then - unless Puppet::Util.absolute_path?(arg, :posix) or Puppet::Util.absolute_path?(arg, :windows) - raise Puppet::ParseError, ("#{arg.inspect} is not an absolute path.") - end - else - # This code back-ported from 2.7.x's lib/puppet/util.rb Puppet::Util.absolute_path? - # Determine in a platform-specific way whether a path is absolute. This - # defaults to the local platform if none is specified. - # Escape once for the string literal, and once for the regex. - slash = '[\\\\/]' - name = '[^\\\\/]+' - regexes = { - :windows => %r!^(([A-Z]:#{slash})|(#{slash}#{slash}#{name}#{slash}#{name})|(#{slash}#{slash}\?#{slash}#{name}))!i, - :posix => %r!^/!, - } - - rval = (!!(arg =~ regexes[:posix])) || (!!(arg =~ regexes[:windows])) - rval or raise Puppet::ParseError, ("#{arg.inspect} is not an absolute path.") - end - end - end -end diff --git a/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/validate_array.rb b/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/validate_array.rb deleted file mode 100644 index 34b5118..0000000 --- a/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/validate_array.rb +++ /dev/null @@ -1,33 +0,0 @@ -module Puppet::Parser::Functions - - newfunction(:validate_array, :doc => <<-'ENDHEREDOC') do |args| - Validate that all passed values are array data structures. Abort catalog - compilation if any value fails this check. - - The following values will pass: - - $my_array = [ 'one', 'two' ] - validate_array($my_array) - - The following values will fail, causing compilation to abort: - - validate_array(true) - validate_array('some_string') - $undefined = undef - validate_array($undefined) - - ENDHEREDOC - - unless args.length > 0 then - raise Puppet::ParseError, ("validate_array(): wrong number of arguments (#{args.length}; must be > 0)") - end - - args.each do |arg| - unless arg.is_a?(Array) - raise Puppet::ParseError, ("#{arg.inspect} is not an Array. It looks to be a #{arg.class}") - end - end - - end - -end diff --git a/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/validate_augeas.rb b/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/validate_augeas.rb deleted file mode 100644 index 154d660..0000000 --- a/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/validate_augeas.rb +++ /dev/null @@ -1,81 +0,0 @@ -module Puppet::Parser::Functions - newfunction(:validate_augeas, :doc => <<-'ENDHEREDOC') do |args| - Perform validation of a string using an Augeas lens - The first argument of this function should be a string to - test, and the second argument should be the name of the Augeas lens to use. - If Augeas fails to parse the string with the lens, the compilation will - abort with a parse error. - - A third argument can be specified, listing paths which should - not be found in the file. The `$file` variable points to the location - of the temporary file being tested in the Augeas tree. - - For example, if you want to make sure your passwd content never contains - a user `foo`, you could write: - - validate_augeas($passwdcontent, 'Passwd.lns', ['$file/foo']) - - Or if you wanted to ensure that no users used the '/bin/barsh' shell, - you could use: - - validate_augeas($passwdcontent, 'Passwd.lns', ['$file/*[shell="/bin/barsh"]'] - - If a fourth argument is specified, this will be the error message raised and - seen by the user. - - A helpful error message can be returned like this: - - validate_augeas($sudoerscontent, 'Sudoers.lns', [], 'Failed to validate sudoers content with Augeas') - - ENDHEREDOC - unless Puppet.features.augeas? - raise Puppet::ParseError, ("validate_augeas(): this function requires the augeas feature. See http://projects.puppetlabs.com/projects/puppet/wiki/Puppet_Augeas#Pre-requisites for how to activate it.") - end - - if (args.length < 2) or (args.length > 4) then - raise Puppet::ParseError, ("validate_augeas(): wrong number of arguments (#{args.length}; must be 2, 3, or 4)") - end - - msg = args[3] || "validate_augeas(): Failed to validate content against #{args[1].inspect}" - - require 'augeas' - aug = Augeas::open(nil, nil, Augeas::NO_MODL_AUTOLOAD) - begin - content = args[0] - - # Test content in a temporary file - tmpfile = Tempfile.new("validate_augeas") - begin - tmpfile.write(content) - ensure - tmpfile.close - end - - # Check for syntax - lens = args[1] - aug.transform( - :lens => lens, - :name => 'Validate_augeas', - :incl => tmpfile.path - ) - aug.load! - - unless aug.match("/augeas/files#{tmpfile.path}//error").empty? - error = aug.get("/augeas/files#{tmpfile.path}//error/message") - msg += " with error: #{error}" - raise Puppet::ParseError, (msg) - end - - # Launch unit tests - tests = args[2] || [] - aug.defvar('file', "/files#{tmpfile.path}") - tests.each do |t| - msg += " testing path #{t}" - raise Puppet::ParseError, (msg) unless aug.match(t).empty? - end - ensure - aug.close - tmpfile.unlink - end - end -end diff --git a/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/validate_bool.rb b/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/validate_bool.rb deleted file mode 100644 index 62c1d88..0000000 --- a/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/validate_bool.rb +++ /dev/null @@ -1,34 +0,0 @@ -module Puppet::Parser::Functions - - newfunction(:validate_bool, :doc => <<-'ENDHEREDOC') do |args| - Validate that all passed values are either true or false. Abort catalog - compilation if any value fails this check. - - The following values will pass: - - $iamtrue = true - validate_bool(true) - validate_bool(true, true, false, $iamtrue) - - The following values will fail, causing compilation to abort: - - $some_array = [ true ] - validate_bool("false") - validate_bool("true") - validate_bool($some_array) - - ENDHEREDOC - - unless args.length > 0 then - raise Puppet::ParseError, ("validate_bool(): wrong number of arguments (#{args.length}; must be > 0)") - end - - args.each do |arg| - unless (arg.is_a?(TrueClass) || arg.is_a?(FalseClass)) - raise Puppet::ParseError, ("#{arg.inspect} is not a boolean. It looks to be a #{arg.class}") - end - end - - end - -end diff --git a/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/validate_cmd.rb b/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/validate_cmd.rb deleted file mode 100644 index 344a80c..0000000 --- a/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/validate_cmd.rb +++ /dev/null @@ -1,47 +0,0 @@ -require 'puppet/util/execution' - -module Puppet::Parser::Functions - newfunction(:validate_cmd, :doc => <<-'ENDHEREDOC') do |args| - Perform validation of a string with an external command. - The first argument of this function should be a string to - test, and the second argument should be a path to a test command - taking a file as last argument. If the command, launched against - a tempfile containing the passed string, returns a non-null value, - compilation will abort with a parse error. - - If a third argument is specified, this will be the error message raised and - seen by the user. - - A helpful error message can be returned like this: - - Example: - - validate_cmd($sudoerscontent, '/usr/sbin/visudo -c -f', 'Visudo failed to validate sudoers content') - - ENDHEREDOC - if (args.length < 2) or (args.length > 3) then - raise Puppet::ParseError, ("validate_cmd(): wrong number of arguments (#{args.length}; must be 2 or 3)") - end - - msg = args[2] || "validate_cmd(): failed to validate content with command #{args[1].inspect}" - - content = args[0] - checkscript = args[1] - - # Test content in a temporary file - tmpfile = Tempfile.new("validate_cmd") - begin - tmpfile.write(content) - if Puppet::Util::Execution.respond_to?('execute') - Puppet::Util::Execution.execute("#{checkscript} #{tmpfile.path}") - else - Puppet::Util.execute("#{checkscript} #{tmpfile.path}") - end - rescue Puppet::ExecutionFailure => detail - msg += "\n#{detail}" - raise Puppet::ParseError, msg - ensure - tmpfile.unlink - end - end -end diff --git a/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/validate_hash.rb b/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/validate_hash.rb deleted file mode 100644 index 9bdd543..0000000 --- a/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/validate_hash.rb +++ /dev/null @@ -1,33 +0,0 @@ -module Puppet::Parser::Functions - - newfunction(:validate_hash, :doc => <<-'ENDHEREDOC') do |args| - Validate that all passed values are hash data structures. Abort catalog - compilation if any value fails this check. - - The following values will pass: - - $my_hash = { 'one' => 'two' } - validate_hash($my_hash) - - The following values will fail, causing compilation to abort: - - validate_hash(true) - validate_hash('some_string') - $undefined = undef - validate_hash($undefined) - - ENDHEREDOC - - unless args.length > 0 then - raise Puppet::ParseError, ("validate_hash(): wrong number of arguments (#{args.length}; must be > 0)") - end - - args.each do |arg| - unless arg.is_a?(Hash) - raise Puppet::ParseError, ("#{arg.inspect} is not a Hash. It looks to be a #{arg.class}") - end - end - - end - -end diff --git a/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/validate_re.rb b/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/validate_re.rb deleted file mode 100644 index ca25a70..0000000 --- a/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/validate_re.rb +++ /dev/null @@ -1,40 +0,0 @@ -module Puppet::Parser::Functions - newfunction(:validate_re, :doc => <<-'ENDHEREDOC') do |args| - Perform simple validation of a string against one or more regular - expressions. The first argument of this function should be a string to - test, and the second argument should be a stringified regular expression - (without the // delimiters) or an array of regular expressions. If none - of the regular expressions match the string passed in, compilation will - abort with a parse error. - - If a third argument is specified, this will be the error message raised and - seen by the user. - - The following strings will validate against the regular expressions: - - validate_re('one', '^one$') - validate_re('one', [ '^one', '^two' ]) - - The following strings will fail to validate, causing compilation to abort: - - validate_re('one', [ '^two', '^three' ]) - - A helpful error message can be returned like this: - - validate_re($::puppetversion, '^2.7', 'The $puppetversion fact value does not match 2.7') - - ENDHEREDOC - if (args.length < 2) or (args.length > 3) then - raise Puppet::ParseError, ("validate_re(): wrong number of arguments (#{args.length}; must be 2 or 3)") - end - - msg = args[2] || "validate_re(): #{args[0].inspect} does not match #{args[1].inspect}" - - # We're using a flattened array here because we can't call String#any? in - # Ruby 1.9 like we can in Ruby 1.8 - raise Puppet::ParseError, (msg) unless [args[1]].flatten.any? do |re_str| - args[0] =~ Regexp.compile(re_str) - end - - end -end diff --git a/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/validate_slength.rb b/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/validate_slength.rb deleted file mode 100644 index fdcc0a2..0000000 --- a/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/validate_slength.rb +++ /dev/null @@ -1,52 +0,0 @@ -module Puppet::Parser::Functions - - newfunction(:validate_slength, :doc => <<-'ENDHEREDOC') do |args| - Validate that the first argument is a string (or an array of strings), and - less/equal to than the length of the second argument. It fails if the first - argument is not a string or array of strings, and if arg 2 is not convertable - to a number. - - The following values will pass: - - validate_slength("discombobulate",17) - validate_slength(["discombobulate","moo"],17) - - The following valueis will not: - - validate_slength("discombobulate",1) - validate_slength(["discombobulate","thermometer"],5) - - ENDHEREDOC - - raise Puppet::ParseError, ("validate_slength(): Wrong number of arguments (#{args.length}; must be = 2)") unless args.length == 2 - - unless (args[0].is_a?(String) or args[0].is_a?(Array)) - raise Puppet::ParseError, ("validate_slength(): please pass a string, or an array of strings - what you passed didn't work for me at all - #{args[0].class}") - end - - begin - max_length = args[1].to_i - rescue NoMethodError => e - raise Puppet::ParseError, ("validate_slength(): Couldn't convert whatever you passed as the length parameter to an integer - sorry: " + e.message ) - end - - raise Puppet::ParseError, ("validate_slength(): please pass a positive number as max_length") unless max_length > 0 - - case args[0] - when String - raise Puppet::ParseError, ("validate_slength(): #{args[0].inspect} is #{args[0].length} characters. It should have been less than or equal to #{max_length} characters") unless args[0].length <= max_length - when Array - args[0].each do |arg| - if arg.is_a?(String) - unless ( arg.is_a?(String) and arg.length <= max_length ) - raise Puppet::ParseError, ("validate_slength(): #{arg.inspect} is #{arg.length} characters. It should have been less than or equal to #{max_length} characters") - end - else - raise Puppet::ParseError, ("validate_slength(): #{arg.inspect} is not a string, it's a #{arg.class}") - end - end - else - raise Puppet::ParseError, ("validate_slength(): please pass a string, or an array of strings - what you passed didn't work for me at all - #{args[0].class}") - end - end -end diff --git a/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/validate_string.rb b/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/validate_string.rb deleted file mode 100644 index e667794..0000000 --- a/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/validate_string.rb +++ /dev/null @@ -1,33 +0,0 @@ -module Puppet::Parser::Functions - - newfunction(:validate_string, :doc => <<-'ENDHEREDOC') do |args| - Validate that all passed values are string data structures. Abort catalog - compilation if any value fails this check. - - The following values will pass: - - $my_string = "one two" - validate_string($my_string, 'three') - - The following values will fail, causing compilation to abort: - - validate_string(true) - validate_string([ 'some', 'array' ]) - $undefined = undef - validate_string($undefined) - - ENDHEREDOC - - unless args.length > 0 then - raise Puppet::ParseError, ("validate_string(): wrong number of arguments (#{args.length}; must be > 0)") - end - - args.each do |arg| - unless arg.is_a?(String) - raise Puppet::ParseError, ("#{arg.inspect} is not a string. It looks to be a #{arg.class}") - end - end - - end - -end diff --git a/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/values.rb b/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/values.rb deleted file mode 100644 index 1606756..0000000 --- a/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/values.rb +++ /dev/null @@ -1,39 +0,0 @@ -# -# values.rb -# - -module Puppet::Parser::Functions - newfunction(:values, :type => :rvalue, :doc => <<-EOS -When given a hash this function will return the values of that hash. - -*Examples:* - - $hash = { - 'a' => 1, - 'b' => 2, - 'c' => 3, - } - values($hash) - -This example would return: - - [1,2,3] - EOS - ) do |arguments| - - raise(Puppet::ParseError, "values(): Wrong number of arguments " + - "given (#{arguments.size} for 1)") if arguments.size < 1 - - hash = arguments[0] - - unless hash.is_a?(Hash) - raise(Puppet::ParseError, 'values(): Requires hash to work with') - end - - result = hash.values - - return result - end -end - -# vim: set ts=2 sw=2 et : diff --git a/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/values_at.rb b/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/values_at.rb deleted file mode 100644 index d3e69d9..0000000 --- a/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/values_at.rb +++ /dev/null @@ -1,98 +0,0 @@ -# -# values_at.rb -# - -module Puppet::Parser::Functions - newfunction(:values_at, :type => :rvalue, :doc => <<-EOS -Finds value inside an array based on location. - -The first argument is the array you want to analyze, and the second element can -be a combination of: - -* A single numeric index -* A range in the form of 'start-stop' (eg. 4-9) -* An array combining the above - -*Examples*: - - values_at(['a','b','c'], 2) - -Would return ['c']. - - values_at(['a','b','c'], ["0-1"]) - -Would return ['a','b']. - - values_at(['a','b','c','d','e'], [0, "2-3"]) - -Would return ['a','c','d']. - EOS - ) do |arguments| - - raise(Puppet::ParseError, "values_at(): Wrong number of " + - "arguments given (#{arguments.size} for 2)") if arguments.size < 2 - - array = arguments.shift - - unless array.is_a?(Array) - raise(Puppet::ParseError, 'values_at(): Requires array to work with') - end - - indices = [arguments.shift].flatten() # Get them all ... Pokemon ... - - if not indices or indices.empty? - raise(Puppet::ParseError, 'values_at(): You must provide ' + - 'at least one positive index to collect') - end - - result = [] - indices_list = [] - - indices.each do |i| - if m = i.match(/^(\d+)(\.\.\.?|\-)(\d+)$/) - start = m[1].to_i - stop = m[3].to_i - - type = m[2] - - if start > stop - raise(Puppet::ParseError, 'values_at(): Stop index in ' + - 'given indices range is smaller than the start index') - elsif stop > array.size - 1 # First element is at index 0 is it not? - raise(Puppet::ParseError, 'values_at(): Stop index in ' + - 'given indices range exceeds array size') - end - - range = case type - when /^(\.\.|\-)$/ then (start .. stop) - when /^(\.\.\.)$/ then (start ... stop) # Exclusive of last element ... - end - - range.each { |i| indices_list << i.to_i } - else - # Only positive numbers allowed in this case ... - if not i.match(/^\d+$/) - raise(Puppet::ParseError, 'values_at(): Unknown format ' + - 'of given index') - end - - # In Puppet numbers are often string-encoded ... - i = i.to_i - - if i > array.size - 1 # Same story. First element is at index 0 ... - raise(Puppet::ParseError, 'values_at(): Given index ' + - 'exceeds array size') - end - - indices_list << i - end - end - - # We remove nil values as they make no sense in Puppet DSL ... - result = indices_list.collect { |i| array[i] }.compact - - return result - end -end - -# vim: set ts=2 sw=2 et : diff --git a/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/zip.rb b/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/zip.rb deleted file mode 100644 index 2b56e9c..0000000 --- a/custom_zulip_files/puppet/stdlib/lib/puppet/parser/functions/zip.rb +++ /dev/null @@ -1,65 +0,0 @@ -# -# zip.rb -# - -module Puppet::Parser::Functions - newfunction(:zip, :type => :rvalue, :doc => <<-EOS -Takes one element from first array and merges corresponding elements from second array. This generates a sequence of n-element arrays, where n is one more than the count of arguments. - -*Example:* - - zip(['1','2','3'],['4','5','6']) - -Would result in: - - ["1", "4"], ["2", "5"], ["3", "6"] - EOS - ) do |arguments| - - # Technically we support three arguments but only first is mandatory ... - raise(Puppet::ParseError, "zip(): Wrong number of arguments " + - "given (#{arguments.size} for 2)") if arguments.size < 2 - - a = arguments[0] - b = arguments[1] - - unless a.is_a?(Array) and b.is_a?(Array) - raise(Puppet::ParseError, 'zip(): Requires array to work with') - end - - flatten = arguments[2] if arguments[2] - - if flatten - klass = flatten.class - - # We can have either true or false, or string which resembles boolean ... - unless [FalseClass, TrueClass, String].include?(klass) - raise(Puppet::ParseError, 'zip(): Requires either ' + - 'boolean or string to work with') - end - - if flatten.is_a?(String) - # We consider all the yes, no, y, n and so on too ... - flatten = case flatten - # - # This is how undef looks like in Puppet ... - # We yield false in this case. - # - when /^$/, '' then false # Empty string will be false ... - when /^(1|t|y|true|yes)$/ then true - when /^(0|f|n|false|no)$/ then false - when /^(undef|undefined)$/ then false # This is not likely to happen ... - else - raise(Puppet::ParseError, 'zip(): Unknown type of boolean given') - end - end - end - - result = a.zip(b) - result = flatten ? result.flatten : result - - return result - end -end - -# vim: set ts=2 sw=2 et : diff --git a/custom_zulip_files/puppet/stdlib/lib/puppet/provider/file_line/ruby.rb b/custom_zulip_files/puppet/stdlib/lib/puppet/provider/file_line/ruby.rb deleted file mode 100644 index a3219d3..0000000 --- a/custom_zulip_files/puppet/stdlib/lib/puppet/provider/file_line/ruby.rb +++ /dev/null @@ -1,59 +0,0 @@ - -Puppet::Type.type(:file_line).provide(:ruby) do - - def exists? - lines.find do |line| - line.chomp == resource[:line].chomp - end - end - - def create - if resource[:match] - handle_create_with_match() - else - handle_create_without_match() - end - end - - def destroy - local_lines = lines - File.open(resource[:path],'w') do |fh| - fh.write(local_lines.reject{|l| l.chomp == resource[:line] }.join('')) - end - end - - private - def lines - # If this type is ever used with very large files, we should - # write this in a different way, using a temp - # file; for now assuming that this type is only used on - # small-ish config files that can fit into memory without - # too much trouble. - @lines ||= File.readlines(resource[:path]) - end - - def handle_create_with_match() - regex = resource[:match] ? Regexp.new(resource[:match]) : nil - match_count = lines.select { |l| regex.match(l) }.size - if match_count > 1 - raise Puppet::Error, "More than one line in file '#{resource[:path]}' matches pattern '#{resource[:match]}'" - end - File.open(resource[:path], 'w') do |fh| - lines.each do |l| - fh.puts(regex.match(l) ? resource[:line] : l) - end - - if (match_count == 0) - fh.puts(resource[:line]) - end - end - end - - def handle_create_without_match - File.open(resource[:path], 'a') do |fh| - fh.puts resource[:line] - end - end - - -end diff --git a/custom_zulip_files/puppet/stdlib/lib/puppet/type/anchor.rb b/custom_zulip_files/puppet/stdlib/lib/puppet/type/anchor.rb deleted file mode 100644 index fe1e5aa..0000000 --- a/custom_zulip_files/puppet/stdlib/lib/puppet/type/anchor.rb +++ /dev/null @@ -1,46 +0,0 @@ -Puppet::Type.newtype(:anchor) do - desc <<-'ENDOFDESC' - A simple resource type intended to be used as an anchor in a composite class. - - In Puppet 2.6, when a class declares another class, the resources in the - interior class are not contained by the exterior class. This interacts badly - with the pattern of composing complex modules from smaller classes, as it - makes it impossible for end users to specify order relationships between the - exterior class and other modules. - - The anchor type lets you work around this. By sandwiching any interior - classes between two no-op resources that _are_ contained by the exterior - class, you can ensure that all resources in the module are contained. - - class ntp { - # These classes will have the correct order relationship with each - # other. However, without anchors, they won't have any order - # relationship to Class['ntp']. - class { 'ntp::package': } - -> class { 'ntp::config': } - -> class { 'ntp::service': } - - # These two resources "anchor" the composed classes within the ntp - # class. - anchor { 'ntp::begin': } -> Class['ntp::package'] - Class['ntp::service'] -> anchor { 'ntp::end': } - } - - This allows the end user of the ntp module to establish require and before - relationships with Class['ntp']: - - class { 'ntp': } -> class { 'mcollective': } - class { 'mcollective': } -> class { 'ntp': } - - ENDOFDESC - - newparam :name do - desc "The name of the anchor resource." - end - - def refresh - # We don't do anything with them, but we need this to - # show that we are "refresh aware" and not break the - # chain of propagation. - end -end diff --git a/custom_zulip_files/puppet/stdlib/lib/puppet/type/file_line.rb b/custom_zulip_files/puppet/stdlib/lib/puppet/type/file_line.rb deleted file mode 100644 index f71a4bc..0000000 --- a/custom_zulip_files/puppet/stdlib/lib/puppet/type/file_line.rb +++ /dev/null @@ -1,70 +0,0 @@ -Puppet::Type.newtype(:file_line) do - - desc <<-EOT - Ensures that a given line is contained within a file. The implementation - matches the full line, including whitespace at the beginning and end. If - the line is not contained in the given file, Puppet will add the line to - ensure the desired state. Multiple resources may be declared to manage - multiple lines in the same file. - - Example: - - file_line { 'sudo_rule': - path => '/etc/sudoers', - line => '%sudo ALL=(ALL) ALL', - } - file_line { 'sudo_rule_nopw': - path => '/etc/sudoers', - line => '%sudonopw ALL=(ALL) NOPASSWD: ALL', - } - - In this example, Puppet will ensure both of the specified lines are - contained in the file /etc/sudoers. - - EOT - - ensurable do - defaultvalues - defaultto :present - end - - newparam(:name, :namevar => true) do - desc 'An arbitrary name used as the identity of the resource.' - end - - newparam(:match) do - desc 'An optional regular expression to run against existing lines in the file;\n' + - 'if a match is found, we replace that line rather than adding a new line.' - end - - newparam(:line) do - desc 'The line to be appended to the file located by the path parameter.' - end - - newparam(:path) do - desc 'The file Puppet will ensure contains the line specified by the line parameter.' - validate do |value| - unless (Puppet.features.posix? and value =~ /^\//) or (Puppet.features.microsoft_windows? and (value =~ /^.:\// or value =~ /^\/\/[^\/]+\/[^\/]+/)) - raise(Puppet::Error, "File paths must be fully qualified, not '#{value}'") - end - end - end - - # Autorequire the file resource if it's being managed - autorequire(:file) do - self[:path] - end - - validate do - unless self[:line] and self[:path] - raise(Puppet::Error, "Both line and path are required attributes") - end - - if (self[:match]) - unless Regexp.new(self[:match]).match(self[:line]) - raise(Puppet::Error, "When providing a 'match' parameter, the value must be a regex that matches against the value of your 'line' parameter") - end - end - - end -end diff --git a/custom_zulip_files/puppet/stdlib/manifests/init.pp b/custom_zulip_files/puppet/stdlib/manifests/init.pp deleted file mode 100644 index 500ad77..0000000 --- a/custom_zulip_files/puppet/stdlib/manifests/init.pp +++ /dev/null @@ -1,20 +0,0 @@ -# Class: stdlib -# -# This module manages stdlib. Most of stdlib's features are automatically -# loaded by Puppet, but this class should be declared in order to use the -# standardized run stages. -# -# Parameters: none -# -# Actions: -# -# Declares all other classes in the stdlib module. Currently, this consists -# of stdlib::stages. -# -# Requires: nothing -# -class stdlib { - - class { 'stdlib::stages': } - -} diff --git a/custom_zulip_files/puppet/stdlib/manifests/stages.pp b/custom_zulip_files/puppet/stdlib/manifests/stages.pp deleted file mode 100644 index eb15fd6..0000000 --- a/custom_zulip_files/puppet/stdlib/manifests/stages.pp +++ /dev/null @@ -1,43 +0,0 @@ -# Class: stdlib::stages -# -# This class manages a standard set of run stages for Puppet. It is managed by -# the stdlib class, and should not be declared independently. -# -# The high level stages are (in order): -# -# * setup -# * main -# * runtime -# * setup_infra -# * deploy_infra -# * setup_app -# * deploy_app -# * deploy -# -# Parameters: none -# -# Actions: -# -# Declares various run-stages for deploying infrastructure, -# language runtimes, and application layers. -# -# Requires: nothing -# -# Sample Usage: -# -# node default { -# include stdlib -# class { java: stage => 'runtime' } -# } -# -class stdlib::stages { - - stage { 'setup': before => Stage['main'] } - stage { 'runtime': require => Stage['main'] } - -> stage { 'setup_infra': } - -> stage { 'deploy_infra': } - -> stage { 'setup_app': } - -> stage { 'deploy_app': } - -> stage { 'deploy': } - -} diff --git a/custom_zulip_files/puppet/stdlib/metadata.json b/custom_zulip_files/puppet/stdlib/metadata.json deleted file mode 100644 index 5d3308e..0000000 --- a/custom_zulip_files/puppet/stdlib/metadata.json +++ /dev/null @@ -1,270 +0,0 @@ -{ - "types": [ - { - "doc": " A simple resource type intended to be used as an anchor in a composite class.\n\n In Puppet 2.6, when a class declares another class, the resources in the\n interior class are not contained by the exterior class. This interacts badly\n with the pattern of composing complex modules from smaller classes, as it\n makes it impossible for end users to specify order relationships between the\n exterior class and other modules.\n\n The anchor type lets you work around this. By sandwiching any interior\n classes between two no-op resources that _are_ contained by the exterior\n class, you can ensure that all resources in the module are contained.\n\n class ntp {\n # These classes will have the correct order relationship with each\n # other. However, without anchors, they won't have any order\n # relationship to Class['ntp'].\n class { 'ntp::package': }\n -> class { 'ntp::config': }\n -> class { 'ntp::service': }\n\n # These two resources \"anchor\" the composed classes within the ntp\n # class.\n anchor { 'ntp::begin': } -> Class['ntp::package']\n Class['ntp::service'] -> anchor { 'ntp::end': }\n }\n\n This allows the end user of the ntp module to establish require and before\n relationships with Class['ntp']:\n\n class { 'ntp': } -> class { 'mcollective': }\n class { 'mcollective': } -> class { 'ntp': }\n\n", - "parameters": [ - { - "doc": "The name of the anchor resource.", - "name": "name" - } - ], - "name": "anchor", - "properties": [ - - ] - }, - { - "doc": " Ensures that a given line is contained within a file. The implementation\n matches the full line, including whitespace at the beginning and end. If\n the line is not contained in the given file, Puppet will add the line to\n ensure the desired state. Multiple resources may be declared to manage\n multiple lines in the same file.\n\n Example:\n\n file_line { 'sudo_rule':\n path => '/etc/sudoers',\n line => '%sudo ALL=(ALL) ALL',\n }\n file_line { 'sudo_rule_nopw':\n path => '/etc/sudoers',\n line => '%sudonopw ALL=(ALL) NOPASSWD: ALL',\n }\n\n In this example, Puppet will ensure both of the specified lines are\n contained in the file /etc/sudoers.\n\n", - "providers": [ - { - "doc": "", - "name": "ruby" - } - ], - "parameters": [ - { - "doc": "An arbitrary name used as the identity of the resource.", - "name": "name" - }, - { - "doc": "An optional regular expression to run against existing lines in the file;\\nif a match is found, we replace that line rather than adding a new line.", - "name": "match" - }, - { - "doc": "The line to be appended to the file located by the path parameter.", - "name": "line" - }, - { - "doc": "The file Puppet will ensure contains the line specified by the line parameter.", - "name": "path" - } - ], - "name": "file_line", - "properties": [ - { - "doc": "The basic property that the resource should be in. Valid values are `present`, `absent`.", - "name": "ensure" - } - ] - } - ], - "license": "Apache 2.0", - "checksums": { - "spec/unit/puppet/parser/functions/uriescape_spec.rb": "8d9e15156d93fe29bfe91a2e83352ff4", - "Gemfile": "a7144ac8fdb2255ed7badb6b54f6c342", - "spec/unit/facter/root_home_spec.rb": "4f4c4236ac2368d2e27fd2f3eb606a19", - "spec/unit/puppet/parser/functions/size_spec.rb": "d126b696b21a8cd754d58f78ddba6f06", - "spec/unit/puppet/parser/functions/shuffle_spec.rb": "2141a54d2fb3cf725b88184d639677f4", - "spec/unit/puppet/parser/functions/validate_re_spec.rb": "b21292ad2f30c0d43ab2f0c2df0ba7d5", - "lib/puppet/parser/functions/flatten.rb": "25777b76f9719162a8bab640e5595b7a", - "lib/puppet/parser/functions/ensure_packages.rb": "ca852b2441ca44b91a984094de4e3afc", - "lib/puppet/parser/functions/validate_augeas.rb": "d4acca7b8a9fdada9ae39e5101902cc1", - "spec/unit/puppet/parser/functions/unique_spec.rb": "2df8b3b2edb9503943cb4dcb4a371867", - "tests/has_ip_network.pp": "abc05686797a776ea8c054657e6f7456", - "spec/fixtures/manifests/site.pp": "d41d8cd98f00b204e9800998ecf8427e", - "lib/puppet/parser/functions/defined_with_params.rb": "ffab4433d03f32b551f2ea024a2948fc", - "lib/puppet/parser/functions/size.rb": "8972d48c0f9e487d659bd7326b40b642", - "lib/puppet/parser/functions/has_ip_address.rb": "ee207f47906455a5aa49c4fb219dd325", - "lib/facter/util/puppet_settings.rb": "9f1d2593d0ae56bfca89d4b9266aeee1", - "spec/unit/puppet/parser/functions/any2array_spec.rb": "167e114cfa222de971bf8be141766b6a", - "spec/unit/facter/pe_required_facts_spec.rb": "0ec83db2a004a0d7f6395b34939c53b9", - "spec/unit/puppet/parser/functions/bool2num_spec.rb": "67c3055d5d4e4c9fbcaca82038a09081", - "lib/facter/root_home.rb": "f559294cceafcf70799339627d94871d", - "lib/puppet/parser/functions/loadyaml.rb": "2b912f257aa078e376d3b3f6a86c2a00", - "spec/unit/puppet/parser/functions/is_float_spec.rb": "171fc0e382d9856c2d8db2b70c9ec9cd", - "lib/puppet/type/anchor.rb": "bbd36bb49c3b554f8602d8d3df366c0c", - "lib/puppet/parser/functions/getparam.rb": "4dd7a0e35f4a3780dcfc9b19b4e0006e", - "lib/facter/facter_dot_d.rb": "b35b8b59ec579901444f984127f0b833", - "lib/puppet/parser/functions/strftime.rb": "e02e01a598ca5d7d6eee0ba22440304a", - "lib/puppet/parser/functions/max.rb": "f652fd0b46ef7d2fbdb42b141f8fdd1d", - "spec/spec_helper.rb": "4449b0cafd8f7b2fb440c0cdb0a1f2b3", - "lib/puppet/parser/functions/merge.rb": "52281fe881b762e2adfef20f58dc4180", - "lib/puppet/parser/functions/validate_slength.rb": "0ca530d1d3b45c3fe2d604c69acfc22f", - "spec/unit/puppet/parser/functions/suffix_spec.rb": "c3eed8e40066f2ad56264405c4192f2e", - "spec/unit/puppet/parser/functions/validate_bool_spec.rb": "32a580f280ba62bf17ccd30460d357bd", - "spec/unit/puppet/parser/functions/str2bool_spec.rb": "60e3eaea48b0f6efccc97010df7d912c", - "lib/puppet/parser/functions/reject.rb": "689f6a7c961a55fe9dcd240921f4c7f9", - "lib/puppet/parser/functions/delete.rb": "9b17b9f7f820adf02360147c1a2f4279", - "lib/puppet/parser/functions/strip.rb": "273d547c7b05c0598556464dfd12f5fd", - "lib/puppet/parser/functions/values.rb": "066a6e4170e5034edb9a80463dff2bb5", - "LICENSE": "38a048b9d82e713d4e1b2573e370a756", - "lib/puppet/parser/functions/is_array.rb": "875ca4356cb0d7a10606fb146b4a3d11", - "spec/unit/puppet/parser/functions/strip_spec.rb": "a01796bebbdabd3fad12b0662ea5966e", - "lib/puppet/parser/functions/swapcase.rb": "4902f38f0b9292afec66d40fee4b02ec", - "lib/puppet/parser/functions/has_ip_network.rb": "b4d726c8b2a0afac81ced8a3a28aa731", - "spec/unit/puppet/parser/functions/validate_array_spec.rb": "bcd231229554785c4270ca92ef99cb60", - "lib/puppet/parser/functions/validate_re.rb": "c6664b3943bc820415a43f16372dc2a9", - "lib/puppet/parser/functions/time.rb": "08d88d52abd1e230e3a2f82107545d48", - "lib/puppet/parser/functions/is_numeric.rb": "0a9bcc49e8f57af81bdfbb7e7c3a575c", - "spec/unit/puppet/parser/functions/merge_spec.rb": "a63c0bc2f812e27fbef570d834ef61ce", - "lib/puppet/parser/functions/count.rb": "9eb74eccd93e2b3c87fd5ea14e329eba", - "spec/unit/puppet/parser/functions/values_at_spec.rb": "de45fd8abbc4c037c3c4fac2dcf186f9", - "spec/monkey_patches/publicize_methods.rb": "ce2c98f38b683138c5ac649344a39276", - "spec/unit/puppet/parser/functions/is_hash_spec.rb": "408e121a5e30c4c5c4a0a383beb6e209", - "lib/puppet/parser/functions/chop.rb": "4691a56e6064b792ed4575e4ad3f3d20", - "spec/unit/puppet/parser/functions/validate_cmd_spec.rb": "538db08292a0ecc4cd902a14aaa55d74", - "spec/unit/puppet/parser/functions/is_integer_spec.rb": "a302cf1de5ccb494ca9614d2fc2b53c5", - "spec/functions/ensure_resource_spec.rb": "3423a445e13efc7663a71c6641d49d07", - "spec/unit/puppet/parser/functions/keys_spec.rb": "35cc2ed490dc68da6464f245dfebd617", - "manifests/init.pp": "f2ba5f36e7227ed87bbb69034fc0de8b", - "lib/puppet/parser/functions/dirname.rb": "bef7214eb89db3eb8f7ee5fc9dca0233", - "lib/puppet/parser/functions/validate_hash.rb": "e9cfaca68751524efe16ecf2f958a9a0", - "lib/puppet/parser/functions/join_keys_to_values.rb": "f29da49531228f6ca5b3aa0df00a14c2", - "spec/unit/puppet/parser/functions/delete_spec.rb": "0d84186ea618523b4b2a4ca0b5a09c9e", - "lib/puppet/parser/functions/validate_string.rb": "6afcbc51f83f0714348b8d61e06ea7eb", - "spec/unit/puppet/parser/functions/rstrip_spec.rb": "a408e933753c9c323a05d7079d32cbb3", - "spec/unit/puppet/parser/functions/fqdn_rotate_spec.rb": "c67b71737bee9936f5261d41a37bad46", - "spec/unit/puppet/parser/functions/concat_spec.rb": "c21aaa84609f92290d5ffb2ce8ea4bf5", - "lib/puppet/parser/functions/unique.rb": "217ccce6d23235af92923f50f8556963", - "CHANGELOG": "344383410cb78409f0c59ecf38e8c21a", - "lib/puppet/parser/functions/member.rb": "541e67d06bc4155e79b00843a125e9bc", - "spec/unit/puppet/parser/functions/validate_string_spec.rb": "64a4f681084cba55775a070f7fab5e0c", - "lib/facter/puppet_vardir.rb": "c7ddc97e8a84ded3dd93baa5b9b3283d", - "lib/puppet/parser/functions/pick.rb": "2bede116a0651405c47e650bbf942abe", - "spec/unit/puppet/parser/functions/parseyaml_spec.rb": "65dfed872930ffe0d21954c15daaf498", - "lib/puppet/parser/functions/delete_at.rb": "6bc24b79390d463d8be95396c963381a", - "lib/puppet/parser/functions/zip.rb": "a80782461ed9465f0cd0c010936f1855", - "tests/file_line.pp": "67727539aa7b7dd76f06626fe734f7f7", - "lib/puppet/parser/functions/ensure_resource.rb": "3f68b8e17a16bfd01455cd73f8e324ba", - "lib/puppet/parser/functions/num2bool.rb": "605c12fa518c87ed2c66ae153e0686ce", - "spec/unit/puppet/parser/functions/grep_spec.rb": "78179537496a7150469e591a95e255d8", - "lib/puppet/parser/functions/keys.rb": "eb6ac815ea14fbf423580ed903ef7bad", - "spec/unit/puppet/parser/functions/num2bool_spec.rb": "8cd5b46b7c8e612dfae3362e3a68a5f9", - "lib/puppet/parser/functions/parsejson.rb": "e7f968c34928107b84cd0860daf50ab1", - "lib/puppet/parser/functions/is_mac_address.rb": "288bd4b38d4df42a83681f13e7eaaee0", - "lib/puppet/parser/functions/join.rb": "b28087823456ca5cf943de4a233ac77f", - "spec/unit/puppet/parser/functions/type_spec.rb": "422f2c33458fe9b0cc9614d16f7573ba", - "lib/puppet/parser/functions/downcase.rb": "9204a04c2a168375a38d502db8811bbe", - "spec/unit/puppet/parser/functions/validate_augeas_spec.rb": "1d5bcfbf97dc56b45734248a14358d4f", - "spec/unit/puppet/parser/functions/has_ip_address_spec.rb": "f53c7baeaf024ff577447f6c28c0f3a7", - "lib/puppet/parser/functions/is_function_available.rb": "88c63869cb5df3402bc9756a8d40c16d", - "lib/puppet/parser/functions/prefix.rb": "21fd6a2c1ee8370964346b3bfe829d2b", - "spec/watchr.rb": "b588ddf9ef1c19ab97aa892cc776da73", - "spec/unit/puppet/parser/functions/has_key_spec.rb": "3e4e730d98bbdfb88438b6e08e45868e", - "lib/puppet/parser/functions/values_at.rb": "094ac110ce9f7a5b16d0c80a0cf2243c", - "lib/puppet/parser/functions/fqdn_rotate.rb": "20743a138c56fc806a35cb7b60137dbc", - "lib/puppet/parser/functions/rstrip.rb": "8a0d69876bdbc88a2054ba41c9c38961", - "spec/unit/puppet/parser/functions/validate_slength_spec.rb": "a1b4d805149dc0143e9a57e43e1f84bf", - "spec/functions/ensure_packages_spec.rb": "935b4aec5ab36bdd0458c1a9b2a93ad5", - "lib/puppet/parser/functions/suffix.rb": "109279db4180441e75545dbd5f273298", - "lib/puppet/parser/functions/str2saltedsha512.rb": "49afad7b386be38ce53deaefef326e85", - "spec/unit/puppet/parser/functions/count_spec.rb": "db98ef89752a7112425f0aade10108e0", - "lib/puppet/parser/functions/hash.rb": "9d072527dfc7354b69292e9302906530", - "manifests/stages.pp": "cc6ed1751d334b0ea278c0335c7f0b5a", - "spec/unit/puppet/parser/functions/is_ip_address_spec.rb": "6040a9bae4e5c853966148b634501157", - "spec/unit/facter/pe_version_spec.rb": "ef031cca838f36f99b1dab3259df96a5", - "spec/unit/puppet/parser/functions/get_module_path_spec.rb": "b7ea196f548b1a9a745ab6671295ab27", - "lib/puppet/parser/functions/is_integer.rb": "a50ebc15c30bffd759e4a6f8ec6a0cf3", - "lib/puppet/parser/functions/reverse.rb": "1386371c0f5301055fdf99079e862b3e", - "spec/unit/puppet/parser/functions/has_interface_with_spec.rb": "7c16d731c518b434c81b8cb2227cc916", - "README_SPECS.markdown": "82bb4c6abbb711f40778b162ec0070c1", - "spec/unit/puppet/parser/functions/is_domain_name_spec.rb": "8eed3a9eb9334bf6a473ad4e2cabc2ec", - "spec/unit/puppet/parser/functions/join_spec.rb": "c3b50c39390a86b493511be2c6722235", - "lib/puppet/parser/functions/chomp.rb": "719d46923d75251f7b6b68b6e015cccc", - "lib/puppet/parser/functions/is_string.rb": "2bd9a652bbb2668323eee6c57729ff64", - "spec/unit/puppet/parser/functions/is_array_spec.rb": "8c020af9c360abdbbf1ba887bb26babe", - "Modulefile": "351bba73290cd526ca7bacd4c7d250dc", - "spec/unit/puppet/parser/functions/reject_spec.rb": "8e16c9f064870e958b6278261e480954", - "spec/unit/puppet/type/file_line_spec.rb": "d9f4e08e8b98e565a07f1b995593fa89", - "spec/unit/puppet/parser/functions/lstrip_spec.rb": "1fc2c2d80b5f724a358c3cfeeaae6249", - "lib/puppet/parser/functions/type.rb": "62f914d6c90662aaae40c5539701be60", - "lib/puppet/parser/functions/shuffle.rb": "6445e6b4dc62c37b184a60eeaf34414b", - "lib/puppet/parser/functions/has_key.rb": "7cd9728c38f0b0065f832dabd62b0e7e", - "lib/puppet/parser/functions/concat.rb": "f28a09811ff4d19bb5e7a540e767d65c", - "spec/unit/puppet/parser/functions/capitalize_spec.rb": "82a4209a033fc88c624f708c12e64e2a", - "tests/init.pp": "1d98070412c76824e66db4b7eb74d433", - "lib/puppet/provider/file_line/ruby.rb": "a445a57f9b884037320ea37307dbc92b", - "tests/has_ip_address.pp": "93ce02915f67ddfb43a049b2b84ef391", - "spec/unit/puppet/parser/functions/min_spec.rb": "bf80bf58261117bb24392670b624a611", - "lib/puppet/parser/functions/to_bytes.rb": "83f23c33adbfa42b2a9d9fc2db3daeb4", - "lib/puppet/parser/functions/sort.rb": "504b033b438461ca4f9764feeb017833", - "lib/puppet/parser/functions/capitalize.rb": "14481fc8c7c83fe002066ebcf6722f17", - "lib/puppet/type/file_line.rb": "3e8222cb58f3503b3ea7de3647c602a0", - "lib/puppet/parser/functions/has_interface_with.rb": "8d3ebca805dc6edb88b6b7a13d404787", - "spec/functions/getparam_spec.rb": "122f37cf9ec7489f1dae10db39c871b5", - "Rakefile": "f37e6131fe7de9a49b09d31596f5fbf1", - "spec/unit/puppet/parser/functions/downcase_spec.rb": "b0197829512f2e92a2d2b06ce8e2226f", - "spec/unit/puppet/parser/functions/max_spec.rb": "5562bccc643443af7e4fa7c9d1e52b8b", - "lib/puppet/parser/functions/validate_absolute_path.rb": "385137ac24a2dec6cecc4e6ea75be442", - "spec/unit/puppet/parser/functions/getvar_spec.rb": "842bf88d47077a9ae64097b6e39c3364", - "spec/unit/puppet/parser/functions/sort_spec.rb": "7039cd230a94e95d9d1de2e1094acae2", - "spec/unit/puppet/parser/functions/strftime_spec.rb": "bf140883ecf3254277306fa5b25f0344", - "spec/unit/puppet/parser/functions/is_mac_address_spec.rb": "644cd498b426ff2f9ea9cbc5d8e141d7", - "spec/unit/puppet/parser/functions/empty_spec.rb": "028c30267d648a172d8a81a9262c3abe", - "lib/puppet/parser/functions/is_domain_name.rb": "fba9f855df3bbf90d72dfd5201f65d2b", - "lib/puppet/parser/functions/get_module_path.rb": "d4bf50da25c0b98d26b75354fa1bcc45", - "spec/unit/puppet/provider/file_line/ruby_spec.rb": "e8cd7432739cb212d40a9148523bd4d7", - "spec/unit/puppet/parser/functions/reverse_spec.rb": "48169990e59081ccbd112b6703418ce4", - "spec/unit/puppet/parser/functions/str2saltedsha512_spec.rb": "1de174be8835ba6fef86b590887bb2cc", - "spec/unit/puppet/parser/functions/prefix_spec.rb": "16a95b321d76e773812693c80edfbe36", - "spec/spec.opts": "a600ded995d948e393fbe2320ba8e51c", - "spec/monkey_patches/alias_should_to_must.rb": "7cd4065c63f06f1ab3aaa1c5f92af947", - "lib/puppet/parser/functions/uriescape.rb": "9ebc34f1b2f319626512b8cd7cde604c", - "lib/puppet/parser/functions/floor.rb": "c5a960e9714810ebb99198ff81a11a3b", - "lib/puppet/parser/functions/empty.rb": "ae92905c9d94ddca30bf56b7b1dabedf", - "spec/unit/puppet/parser/functions/range_spec.rb": "91d69115dea43f62a2dca9a10467d836", - "tests/has_interface_with.pp": "59c98b4af0d39fc11d1ef4c7a6dc8f7a", - "spec/unit/puppet/parser/functions/is_function_available.rb": "069ef7490eba66424cab75444f36828a", - "README_DEVELOPER.markdown": "220a8b28521b5c5d2ea87c4ddb511165", - "spec/unit/puppet/parser/functions/flatten_spec.rb": "583c9a70f93e492cfb22ffa1811f6aa0", - "lib/puppet/parser/functions/upcase.rb": "a5744a74577cfa136fca2835e75888d3", - "lib/puppet/parser/functions/str2bool.rb": "c822a8944747f5624b13f2da0df8db21", - "lib/puppet/parser/functions/is_hash.rb": "8c7d9a05084dab0389d1b779c8a05b1a", - "lib/puppet/parser/functions/abs.rb": "32161bd0435fdfc2aec2fc559d2b454b", - "spec/unit/puppet/parser/functions/validate_hash_spec.rb": "8529c74051ceb71e6b1b97c9cecdf625", - "spec/unit/puppet/parser/functions/member_spec.rb": "067c60985efc57022ca1c5508d74d77f", - "README.markdown": "b63097a958f22abf7999d475a6a4d32a", - "spec/unit/puppet/parser/functions/values_spec.rb": "0ac9e141ed1f612d7cc224f747b2d1d9", - "lib/puppet/parser/functions/validate_cmd.rb": "0319a15d24fd077ebabc2f79969f6ab5", - "lib/puppet/parser/functions/is_float.rb": "f1b0d333061d31bf0c25bd4c33dc134b", - "lib/puppet/parser/functions/bool2num.rb": "8e627eee990e811e35e7e838c586bd77", - "lib/puppet/parser/functions/validate_bool.rb": "4ddffdf5954b15863d18f392950b88f4", - "lib/puppet/parser/functions/grep.rb": "5682995af458b05f3b53dd794c4bf896", - "spec/unit/puppet/parser/functions/upcase_spec.rb": "813668919bc62cdd1d349dafc19fbbb3", - "spec/unit/puppet/parser/functions/parsejson_spec.rb": "37ab84381e035c31d6a3dd9bf73a3d53", - "spec/unit/puppet/parser/functions/squeeze_spec.rb": "df5b349c208a9a2a4d4b8e6d9324756f", - "spec/unit/puppet/parser/functions/validate_absolute_path_spec.rb": "07839082d24d5a7628fd5bce6c8b35c3", - "spec/unit/puppet/parser/functions/chop_spec.rb": "4e9534d25b952b261c9f46add677c390", - "lib/puppet/parser/functions/squeeze.rb": "541f85b4203b55c9931d3d6ecd5c75f8", - "lib/puppet/parser/functions/lstrip.rb": "210b103f78622e099f91cc2956b6f741", - "spec/unit/puppet/type/anchor_spec.rb": "a5478a72a7fab2d215f39982a9230c18", - "lib/facter/pe_version.rb": "4a9353952963b011759f3e6652a10da5", - "spec/unit/puppet/parser/functions/hash_spec.rb": "826337a92d8f7a189b7ac19615db0ed7", - "spec/unit/puppet/parser/functions/floor_spec.rb": "d01ef7dfe0245d7a0a73d7df13cb02e3", - "spec/unit/puppet/parser/functions/time_spec.rb": "b6d0279062779efe5153fe5cfafc5bbd", - "spec/unit/puppet/parser/functions/swapcase_spec.rb": "0660ce8807608cc8f98ad1edfa76a402", - "lib/puppet/parser/functions/validate_array.rb": "72b29289b8af1cfc3662ef9be78911b8", - "lib/puppet/parser/functions/is_ip_address.rb": "a714a736c1560e8739aaacd9030cca00", - "lib/puppet/parser/functions/getvar.rb": "10bf744212947bc6a7bfd2c9836dbd23", - "RELEASE_PROCESS.markdown": "94b92bc99ac4106ba1a74d5c04e520f9", - "spec/classes/anchor_spec.rb": "695d65275c3ac310d7fa23b91f8bbb4a", - "lib/puppet/parser/functions/any2array.rb": "a81e71d6b67a551d38770ba9a1948a75", - "spec/functions/defined_with_params_spec.rb": "3bdfac38e3d6f06140ff2e926f4ebed2", - "spec/unit/puppet/parser/functions/pick_spec.rb": "aba6247d3925e373272fca6768fd5403", - "spec/unit/puppet/parser/functions/to_bytes_spec.rb": "80aaf68cf7e938e46b5278c1907af6be", - "spec/unit/puppet/parser/functions/is_string_spec.rb": "5c015d8267de852da3a12b984e077092", - "spec/unit/puppet/parser/functions/abs_spec.rb": "0a5864a29a8e9e99acc483268bd5917c", - "spec/unit/facter/util/puppet_settings_spec.rb": "345bcbef720458e25be0190b7638e4d9", - "spec/unit/puppet/parser/functions/zip_spec.rb": "06a86e4e70d2aea63812582aae1d26c4", - "spec/unit/puppet/parser/functions/dirname_spec.rb": "1d7cf70468c2cfa6dacfc75935322395", - "spec/unit/puppet/parser/functions/delete_at_spec.rb": "5a4287356b5bd36a6e4c100421215b8e", - "spec/unit/puppet/parser/functions/chomp_spec.rb": "3cd8e2fe6b12efeffad94cce5b693b7c", - "spec/unit/puppet/parser/functions/join_keys_to_values_spec.rb": "7c7937411b7fe4bb944c0c022d3a96b0", - "lib/puppet/parser/functions/range.rb": "033048bba333fe429e77e0f2e91db25f", - "lib/puppet/parser/functions/parseyaml.rb": "00f10ec1e2b050e23d80c256061ebdd7", - "spec/unit/puppet/parser/functions/is_numeric_spec.rb": "5f08148803b6088c27b211c446ad3658", - "spec/unit/puppet/parser/functions/has_ip_network_spec.rb": "885ea8a4c987b735d683b742bf846cb1", - "lib/puppet/parser/functions/min.rb": "0d2a1b7e735ab251c5469e735fa3f4c6", - "CONTRIBUTING.md": "fdddc4606dc3b6949e981e6bf50bc8e5" - }, - "version": "4.1.0", - "description": "Standard Library for Puppet Modules", - "source": "git://github.com/puppetlabs/puppetlabs-stdlib.git", - "project_page": "https://github.com/puppetlabs/puppetlabs-stdlib", - "summary": "Puppet Module Standard Library", - "dependencies": [ - - ], - "author": "puppetlabs", - "name": "puppetlabs-stdlib" -} \ No newline at end of file diff --git a/custom_zulip_files/puppet/stdlib/spec/classes/anchor_spec.rb b/custom_zulip_files/puppet/stdlib/spec/classes/anchor_spec.rb deleted file mode 100644 index 2dd17de..0000000 --- a/custom_zulip_files/puppet/stdlib/spec/classes/anchor_spec.rb +++ /dev/null @@ -1,32 +0,0 @@ -require 'puppet' -require 'rspec-puppet' - -describe "anchorrefresh" do - let(:node) { 'testhost.example.com' } - let :pre_condition do - <<-ANCHORCLASS -class anchored { - anchor { 'anchored::begin': } - ~> anchor { 'anchored::end': } -} - -class anchorrefresh { - notify { 'first': } - ~> class { 'anchored': } - ~> anchor { 'final': } -} - ANCHORCLASS - end - - def apply_catalog_and_return_exec_rsrc - catalog = subject.to_ral - transaction = catalog.apply - transaction.resource_status("Anchor[final]") - end - - it 'propagates events through the anchored class' do - resource = apply_catalog_and_return_exec_rsrc - - expect(resource.restarted).to eq(true) - end -end diff --git a/custom_zulip_files/puppet/stdlib/spec/fixtures/manifests/site.pp b/custom_zulip_files/puppet/stdlib/spec/fixtures/manifests/site.pp deleted file mode 100644 index e69de29..0000000 diff --git a/custom_zulip_files/puppet/stdlib/spec/functions/defined_with_params_spec.rb b/custom_zulip_files/puppet/stdlib/spec/functions/defined_with_params_spec.rb deleted file mode 100644 index 28dbab3..0000000 --- a/custom_zulip_files/puppet/stdlib/spec/functions/defined_with_params_spec.rb +++ /dev/null @@ -1,37 +0,0 @@ -#! /usr/bin/env ruby -S rspec -require 'spec_helper' - -require 'rspec-puppet' -describe 'defined_with_params' do - describe 'when a resource is not specified' do - it { should run.with_params().and_raise_error(ArgumentError) } - end - describe 'when compared against a resource with no attributes' do - let :pre_condition do - 'user { "dan": }' - end - it do - should run.with_params('User[dan]', {}).and_return(true) - should run.with_params('User[bob]', {}).and_return(false) - should run.with_params('User[dan]', {'foo' => 'bar'}).and_return(false) - end - end - - describe 'when compared against a resource with attributes' do - let :pre_condition do - 'user { "dan": ensure => present, shell => "/bin/csh", managehome => false}' - end - it do - should run.with_params('User[dan]', {}).and_return(true) - should run.with_params('User[dan]', '').and_return(true) - should run.with_params('User[dan]', {'ensure' => 'present'} - ).and_return(true) - should run.with_params('User[dan]', - {'ensure' => 'present', 'managehome' => false} - ).and_return(true) - should run.with_params('User[dan]', - {'ensure' => 'absent', 'managehome' => false} - ).and_return(false) - end - end -end diff --git a/custom_zulip_files/puppet/stdlib/spec/functions/ensure_packages_spec.rb b/custom_zulip_files/puppet/stdlib/spec/functions/ensure_packages_spec.rb deleted file mode 100644 index 1c2a328..0000000 --- a/custom_zulip_files/puppet/stdlib/spec/functions/ensure_packages_spec.rb +++ /dev/null @@ -1,42 +0,0 @@ -#! /usr/bin/env ruby - -require 'spec_helper' -require 'rspec-puppet' - -describe 'ensure_packages' do - let(:scope) { PuppetlabsSpec::PuppetInternals.scope } - - describe 'argument handling' do - it 'fails with no arguments' do - should run.with_params().and_raise_error(Puppet::ParseError) - end - it 'requires an array' do - lambda { scope.function_ensure_packages([['foo']]) }.should_not raise_error - end - it 'fails when given a string' do - should run.with_params('foo').and_raise_error(Puppet::ParseError) - end - end - - context 'given a catalog containing Package[puppet]{ensure => absent}' do - let :pre_condition do - 'package { puppet: ensure => absent }' - end - - # NOTE: should run.with_params has the side effect of making the compiler - # available to the test harness. - it 'has no effect on Package[puppet]' do - should run.with_params(['puppet']) - rsrc = compiler.catalog.resource('Package[puppet]') - rsrc.to_hash.should == {:ensure => "absent"} - end - end - - context 'given a clean catalog' do - it 'declares package resources with ensure => present' do - should run.with_params(['facter']) - rsrc = compiler.catalog.resource('Package[facter]') - rsrc.to_hash.should == {:name => "facter", :ensure => "present"} - end - end -end diff --git a/custom_zulip_files/puppet/stdlib/spec/functions/ensure_resource_spec.rb b/custom_zulip_files/puppet/stdlib/spec/functions/ensure_resource_spec.rb deleted file mode 100644 index 2e8aefc..0000000 --- a/custom_zulip_files/puppet/stdlib/spec/functions/ensure_resource_spec.rb +++ /dev/null @@ -1,64 +0,0 @@ -#! /usr/bin/env ruby -S rspec -require 'spec_helper' - -require 'rspec-puppet' -describe 'ensure_resource' do - describe 'when a type or title is not specified' do - it { should run.with_params().and_raise_error(ArgumentError) } - it { should run.with_params(['type']).and_raise_error(ArgumentError) } - end - - describe 'when compared against a resource with no attributes' do - let :pre_condition do - 'user { "dan": }' - end - it "should contain the the ensured resources" do - subject.should run.with_params('user', 'dan', {}) - compiler.catalog.resource('User[dan]').to_s.should == 'User[dan]' - end - end - - describe 'when compared against a resource with attributes' do - let :pre_condition do - 'user { "dan": ensure => present, shell => "/bin/csh", managehome => false}' - end - # these first three should not fail - it { should run.with_params('User', 'dan', {}) } - it { should run.with_params('User', 'dan', '') } - it { should run.with_params('User', 'dan', {'ensure' => 'present'}) } - it { should run.with_params('User', 'dan', {'ensure' => 'present', 'managehome' => false}) } - # test that this fails - it { should run.with_params('User', 'dan', {'ensure' => 'absent', 'managehome' => false}).and_raise_error(Puppet::Error) } - end - - describe 'when an array of new resources are passed in' do - it "should contain the ensured resources" do - subject.should run.with_params('User', ['dan', 'alex'], {}) - compiler.catalog.resource('User[dan]').to_s.should == 'User[dan]' - compiler.catalog.resource('User[alex]').to_s.should == 'User[alex]' - end - end - - describe 'when an array of existing resources is compared against existing resources' do - let :pre_condition do - 'user { "dan": ensure => present; "alex": ensure => present }' - end - it "should return the existing resources" do - subject.should run.with_params('User', ['dan', 'alex'], {}) - compiler.catalog.resource('User[dan]').to_s.should == 'User[dan]' - compiler.catalog.resource('User[alex]').to_s.should == 'User[alex]' - end - end - - describe 'when compared against existing resources with attributes' do - let :pre_condition do - 'user { "dan": ensure => present; "alex": ensure => present }' - end - # These should not fail - it { should run.with_params('User', ['dan', 'alex'], {}) } - it { should run.with_params('User', ['dan', 'alex'], '') } - it { should run.with_params('User', ['dan', 'alex'], {'ensure' => 'present'}) } - # This should fail - it { should run.with_params('User', ['dan', 'alex'], {'ensure' => 'absent'}).and_raise_error(Puppet::Error) } - end -end diff --git a/custom_zulip_files/puppet/stdlib/spec/functions/getparam_spec.rb b/custom_zulip_files/puppet/stdlib/spec/functions/getparam_spec.rb deleted file mode 100644 index d9c50a6..0000000 --- a/custom_zulip_files/puppet/stdlib/spec/functions/getparam_spec.rb +++ /dev/null @@ -1,34 +0,0 @@ -#! /usr/bin/env ruby -S rspec -require 'spec_helper' - -require 'rspec-puppet' -describe 'getparam' do - describe 'when a resource is not specified' do - it do - should run.with_params().and_raise_error(ArgumentError) - should run.with_params('User[dan]').and_raise_error(ArgumentError) - should run.with_params('User[dan]', {}).and_raise_error(ArgumentError) - should run.with_params('User[dan]', '').and_return('') - end - end - describe 'when compared against a resource with no params' do - let :pre_condition do - 'user { "dan": }' - end - it do - should run.with_params('User[dan]', 'shell').and_return('') - end - end - - describe 'when compared against a resource with params' do - let :pre_condition do - 'user { "dan": ensure => present, shell => "/bin/sh", managehome => false}' - end - it do - should run.with_params('User[dan]', 'shell').and_return('/bin/sh') - should run.with_params('User[dan]', '').and_return('') - should run.with_params('User[dan]', 'ensure').and_return('present') - should run.with_params('User[dan]', 'managehome').and_return(false) - end - end -end diff --git a/custom_zulip_files/puppet/stdlib/spec/monkey_patches/alias_should_to_must.rb b/custom_zulip_files/puppet/stdlib/spec/monkey_patches/alias_should_to_must.rb deleted file mode 100755 index 1a11117..0000000 --- a/custom_zulip_files/puppet/stdlib/spec/monkey_patches/alias_should_to_must.rb +++ /dev/null @@ -1,8 +0,0 @@ -require 'rspec' - -class Object - # This is necessary because the RAL has a 'should' - # method. - alias :must :should - alias :must_not :should_not -end diff --git a/custom_zulip_files/puppet/stdlib/spec/monkey_patches/publicize_methods.rb b/custom_zulip_files/puppet/stdlib/spec/monkey_patches/publicize_methods.rb deleted file mode 100755 index f3a1abf..0000000 --- a/custom_zulip_files/puppet/stdlib/spec/monkey_patches/publicize_methods.rb +++ /dev/null @@ -1,10 +0,0 @@ -# Some monkey-patching to allow us to test private methods. -class Class - def publicize_methods(*methods) - saved_private_instance_methods = methods.empty? ? self.private_instance_methods : methods - - self.class_eval { public(*saved_private_instance_methods) } - yield - self.class_eval { private(*saved_private_instance_methods) } - end -end diff --git a/custom_zulip_files/puppet/stdlib/spec/spec.opts b/custom_zulip_files/puppet/stdlib/spec/spec.opts deleted file mode 100644 index 91cd642..0000000 --- a/custom_zulip_files/puppet/stdlib/spec/spec.opts +++ /dev/null @@ -1,6 +0,0 @@ ---format -s ---colour ---loadby -mtime ---backtrace diff --git a/custom_zulip_files/puppet/stdlib/spec/spec_helper.rb b/custom_zulip_files/puppet/stdlib/spec/spec_helper.rb deleted file mode 100644 index 931d35c..0000000 --- a/custom_zulip_files/puppet/stdlib/spec/spec_helper.rb +++ /dev/null @@ -1,28 +0,0 @@ -dir = File.expand_path(File.dirname(__FILE__)) -$LOAD_PATH.unshift File.join(dir, 'lib') - -# Don't want puppet getting the command line arguments for rake or autotest -ARGV.clear - -require 'puppet' -require 'facter' -require 'mocha' -gem 'rspec', '>=2.0.0' -require 'rspec/expectations' - -require 'puppetlabs_spec_helper/module_spec_helper' - -RSpec.configure do |config| - # FIXME REVISIT - We may want to delegate to Facter like we do in - # Puppet::PuppetSpecInitializer.initialize_via_testhelper(config) because - # this behavior is a duplication of the spec_helper in Facter. - config.before :each do - # Ensure that we don't accidentally cache facts and environment between - # test cases. This requires each example group to explicitly load the - # facts being exercised with something like - # Facter.collection.loader.load(:ipaddress) - Facter::Util::Loader.any_instance.stubs(:load_all) - Facter.clear - Facter.clear_messages - end -end diff --git a/custom_zulip_files/puppet/stdlib/spec/unit/facter/pe_required_facts_spec.rb b/custom_zulip_files/puppet/stdlib/spec/unit/facter/pe_required_facts_spec.rb deleted file mode 100644 index f219b37..0000000 --- a/custom_zulip_files/puppet/stdlib/spec/unit/facter/pe_required_facts_spec.rb +++ /dev/null @@ -1,69 +0,0 @@ -# Puppet Enterprise requires the following facts to be set in order to operate. -# These facts are set using the file ???? and the two facts are -# `fact_stomp_port`, and `fact_stomp_server`. -# - -require 'spec_helper' - -describe "External facts in /etc/puppetlabs/facter/facts.d/puppet_enterprise_installer.txt" do - context "With Facter 1.6.17 which does not have external facts support" do - before :each do - Facter.stubs(:version).returns("1.6.17") - # Stub out the filesystem for stdlib - Dir.stubs(:entries).with("/etc/puppetlabs/facter/facts.d"). - returns(['puppet_enterprise_installer.txt']) - Dir.stubs(:entries).with("/etc/facter/facts.d").returns([]) - File.stubs(:readlines).with('/etc/puppetlabs/facter/facts.d/puppet_enterprise_installer.txt'). - returns([ - "fact_stomp_port=61613\n", - "fact_stomp_server=puppetmaster.acme.com\n", - "fact_is_puppetagent=true\n", - "fact_is_puppetmaster=false\n", - "fact_is_puppetca=false\n", - "fact_is_puppetconsole=false\n", - ]) - if Facter.collection.respond_to? :load - Facter.collection.load(:facter_dot_d) - else - Facter.collection.loader.load(:facter_dot_d) - end - end - - it 'defines fact_stomp_port' do - Facter.fact(:fact_stomp_port).value.should == '61613' - end - it 'defines fact_stomp_server' do - Facter.fact(:fact_stomp_server).value.should == 'puppetmaster.acme.com' - end - it 'defines fact_is_puppetagent' do - Facter.fact(:fact_is_puppetagent).value.should == 'true' - end - it 'defines fact_is_puppetmaster' do - Facter.fact(:fact_is_puppetmaster).value.should == 'false' - end - it 'defines fact_is_puppetca' do - Facter.fact(:fact_is_puppetca).value.should == 'false' - end - it 'defines fact_is_puppetconsole' do - Facter.fact(:fact_is_puppetconsole).value.should == 'false' - end - end - - [ '1.7.1', '2.0.1' ].each do |v| - context "With Facter #{v} which has external facts support" do - before :each do - Facter.stubs(:version).returns(v) - end - - it 'does not call Facter::Util::DotD.new' do - Facter::Util::DotD.expects(:new).never - - if Facter.collection.respond_to? :load - Facter.collection.load(:facter_dot_d) - else - Facter.collection.loader.load(:facter_dot_d) - end - end - end - end -end diff --git a/custom_zulip_files/puppet/stdlib/spec/unit/facter/pe_version_spec.rb b/custom_zulip_files/puppet/stdlib/spec/unit/facter/pe_version_spec.rb deleted file mode 100644 index 931c6d4..0000000 --- a/custom_zulip_files/puppet/stdlib/spec/unit/facter/pe_version_spec.rb +++ /dev/null @@ -1,76 +0,0 @@ -#!/usr/bin/env rspec - -require 'spec_helper' - -describe "PE Version specs" do - before :each do - # Explicitly load the pe_version.rb file which contains generated facts - # that cannot be automatically loaded. Puppet 2.x implements - # Facter.collection.load while Facter 1.x markes Facter.collection.load as - # a private method. - if Facter.collection.respond_to? :load - Facter.collection.load(:pe_version) - else - Facter.collection.loader.load(:pe_version) - end - end - - context "If PE is installed" do - %w{ 2.6.1 2.10.300 }.each do |version| - puppetversion = "2.7.19 (Puppet Enterprise #{version})" - context "puppetversion => #{puppetversion}" do - before :each do - Facter.fact(:puppetversion).stubs(:value).returns(puppetversion) - end - - (major,minor,patch) = version.split(".") - - it "Should return true" do - Facter.fact(:is_pe).value.should == true - end - - it "Should have a version of #{version}" do - Facter.fact(:pe_version).value.should == version - end - - it "Should have a major version of #{major}" do - Facter.fact(:pe_major_version).value.should == major - end - - it "Should have a minor version of #{minor}" do - Facter.fact(:pe_minor_version).value.should == minor - end - - it "Should have a patch version of #{patch}" do - Facter.fact(:pe_patch_version).value.should == patch - end - end - end - end - - context "When PE is not installed" do - before :each do - Facter.fact(:puppetversion).stubs(:value).returns("2.7.19") - end - - it "is_pe is false" do - Facter.fact(:is_pe).value.should == false - end - - it "pe_version is nil" do - Facter.fact(:pe_version).value.should be_nil - end - - it "pe_major_version is nil" do - Facter.fact(:pe_major_version).value.should be_nil - end - - it "pe_minor_version is nil" do - Facter.fact(:pe_minor_version).value.should be_nil - end - - it "Should have a patch version" do - Facter.fact(:pe_patch_version).value.should be_nil - end - end -end diff --git a/custom_zulip_files/puppet/stdlib/spec/unit/facter/root_home_spec.rb b/custom_zulip_files/puppet/stdlib/spec/unit/facter/root_home_spec.rb deleted file mode 100644 index ce80684..0000000 --- a/custom_zulip_files/puppet/stdlib/spec/unit/facter/root_home_spec.rb +++ /dev/null @@ -1,40 +0,0 @@ -require 'spec_helper' -require 'facter/root_home' - -describe Facter::Util::RootHome do - context "solaris" do - let(:root_ent) { "root:x:0:0:Super-User:/:/sbin/sh" } - let(:expected_root_home) { "/" } - - it "should return /" do - Facter::Util::Resolution.expects(:exec).with("getent passwd root").returns(root_ent) - Facter::Util::RootHome.get_root_home.should == expected_root_home - end - end - context "linux" do - let(:root_ent) { "root:x:0:0:root:/root:/bin/bash" } - let(:expected_root_home) { "/root" } - - it "should return /root" do - Facter::Util::Resolution.expects(:exec).with("getent passwd root").returns(root_ent) - Facter::Util::RootHome.get_root_home.should == expected_root_home - end - end - context "macosx" do - let(:root_ent) { "root:*:0:0:System Administrator:/var/root:/bin/sh" } - let(:expected_root_home) { "/var/root" } - - it "should return /var/root" do - Facter::Util::Resolution.expects(:exec).with("getent passwd root").returns(root_ent) - Facter::Util::RootHome.get_root_home.should == expected_root_home - end - end - context "windows" do - before :each do - Facter::Util::Resolution.expects(:exec).with("getent passwd root").returns(nil) - end - it "should be nil on windows" do - Facter::Util::RootHome.get_root_home.should be_nil - end - end -end diff --git a/custom_zulip_files/puppet/stdlib/spec/unit/facter/util/puppet_settings_spec.rb b/custom_zulip_files/puppet/stdlib/spec/unit/facter/util/puppet_settings_spec.rb deleted file mode 100644 index c3ce6ea..0000000 --- a/custom_zulip_files/puppet/stdlib/spec/unit/facter/util/puppet_settings_spec.rb +++ /dev/null @@ -1,35 +0,0 @@ -require 'spec_helper' -require 'facter/util/puppet_settings' - -describe Facter::Util::PuppetSettings do - - describe "#with_puppet" do - context "Without Puppet loaded" do - before(:each) do - Module.expects(:const_get).with("Puppet").raises(NameError) - end - - it 'should be nil' do - subject.with_puppet { Puppet[:vardir] }.should be_nil - end - it 'should not yield to the block' do - Puppet.expects(:[]).never - subject.with_puppet { Puppet[:vardir] }.should be_nil - end - end - context "With Puppet loaded" do - module Puppet; end - let(:vardir) { "/var/lib/puppet" } - - before :each do - Puppet.expects(:[]).with(:vardir).returns vardir - end - it 'should yield to the block' do - subject.with_puppet { Puppet[:vardir] } - end - it 'should return the nodes vardir' do - subject.with_puppet { Puppet[:vardir] }.should eq vardir - end - end - end -end diff --git a/custom_zulip_files/puppet/stdlib/spec/unit/puppet/parser/functions/abs_spec.rb b/custom_zulip_files/puppet/stdlib/spec/unit/puppet/parser/functions/abs_spec.rb deleted file mode 100755 index c0b4297..0000000 --- a/custom_zulip_files/puppet/stdlib/spec/unit/puppet/parser/functions/abs_spec.rb +++ /dev/null @@ -1,25 +0,0 @@ -#! /usr/bin/env ruby -S rspec - -require 'spec_helper' - -describe "the abs function" do - let(:scope) { PuppetlabsSpec::PuppetInternals.scope } - - it "should exist" do - Puppet::Parser::Functions.function("abs").should == "function_abs" - end - - it "should raise a ParseError if there is less than 1 arguments" do - lambda { scope.function_abs([]) }.should( raise_error(Puppet::ParseError)) - end - - it "should convert a negative number into a positive" do - result = scope.function_abs(["-34"]) - result.should(eq(34)) - end - - it "should do nothing with a positive number" do - result = scope.function_abs(["5678"]) - result.should(eq(5678)) - end -end diff --git a/custom_zulip_files/puppet/stdlib/spec/unit/puppet/parser/functions/any2array_spec.rb b/custom_zulip_files/puppet/stdlib/spec/unit/puppet/parser/functions/any2array_spec.rb deleted file mode 100644 index b266e84..0000000 --- a/custom_zulip_files/puppet/stdlib/spec/unit/puppet/parser/functions/any2array_spec.rb +++ /dev/null @@ -1,55 +0,0 @@ -#! /usr/bin/env ruby -S rspec -require 'spec_helper' - -describe "the any2array function" do - let(:scope) { PuppetlabsSpec::PuppetInternals.scope } - - it "should exist" do - Puppet::Parser::Functions.function("any2array").should == "function_any2array" - end - - it "should return an empty array if there is less than 1 argument" do - result = scope.function_any2array([]) - result.should(eq([])) - end - - it "should convert boolean true to [ true ] " do - result = scope.function_any2array([true]) - result.should(eq([true])) - end - - it "should convert one object to [object]" do - result = scope.function_any2array(['one']) - result.should(eq(['one'])) - end - - it "should convert multiple objects to [objects]" do - result = scope.function_any2array(['one', 'two']) - result.should(eq(['one', 'two'])) - end - - it "should return empty array it was called with" do - result = scope.function_any2array([[]]) - result.should(eq([])) - end - - it "should return one-member array it was called with" do - result = scope.function_any2array([['string']]) - result.should(eq(['string'])) - end - - it "should return multi-member array it was called with" do - result = scope.function_any2array([['one', 'two']]) - result.should(eq(['one', 'two'])) - end - - it "should return members of a hash it was called with" do - result = scope.function_any2array([{ 'key' => 'value' }]) - result.should(eq(['key', 'value'])) - end - - it "should return an empty array if it was called with an empty hash" do - result = scope.function_any2array([{ }]) - result.should(eq([])) - end -end diff --git a/custom_zulip_files/puppet/stdlib/spec/unit/puppet/parser/functions/bool2num_spec.rb b/custom_zulip_files/puppet/stdlib/spec/unit/puppet/parser/functions/bool2num_spec.rb deleted file mode 100755 index 518ac85..0000000 --- a/custom_zulip_files/puppet/stdlib/spec/unit/puppet/parser/functions/bool2num_spec.rb +++ /dev/null @@ -1,24 +0,0 @@ -#! /usr/bin/env ruby -S rspec -require 'spec_helper' - -describe "the bool2num function" do - let(:scope) { PuppetlabsSpec::PuppetInternals.scope } - - it "should exist" do - Puppet::Parser::Functions.function("bool2num").should == "function_bool2num" - end - - it "should raise a ParseError if there is less than 1 arguments" do - lambda { scope.function_bool2num([]) }.should( raise_error(Puppet::ParseError)) - end - - it "should convert true to 1" do - result = scope.function_bool2num([true]) - result.should(eq(1)) - end - - it "should convert false to 0" do - result = scope.function_bool2num([false]) - result.should(eq(0)) - end -end diff --git a/custom_zulip_files/puppet/stdlib/spec/unit/puppet/parser/functions/capitalize_spec.rb b/custom_zulip_files/puppet/stdlib/spec/unit/puppet/parser/functions/capitalize_spec.rb deleted file mode 100755 index 69c9758..0000000 --- a/custom_zulip_files/puppet/stdlib/spec/unit/puppet/parser/functions/capitalize_spec.rb +++ /dev/null @@ -1,19 +0,0 @@ -#! /usr/bin/env ruby -S rspec -require 'spec_helper' - -describe "the capitalize function" do - let(:scope) { PuppetlabsSpec::PuppetInternals.scope } - - it "should exist" do - Puppet::Parser::Functions.function("capitalize").should == "function_capitalize" - end - - it "should raise a ParseError if there is less than 1 arguments" do - lambda { scope.function_capitalize([]) }.should( raise_error(Puppet::ParseError)) - end - - it "should capitalize the beginning of a string" do - result = scope.function_capitalize(["abc"]) - result.should(eq("Abc")) - end -end diff --git a/custom_zulip_files/puppet/stdlib/spec/unit/puppet/parser/functions/chomp_spec.rb b/custom_zulip_files/puppet/stdlib/spec/unit/puppet/parser/functions/chomp_spec.rb deleted file mode 100755 index e425365..0000000 --- a/custom_zulip_files/puppet/stdlib/spec/unit/puppet/parser/functions/chomp_spec.rb +++ /dev/null @@ -1,19 +0,0 @@ -#! /usr/bin/env ruby -S rspec -require 'spec_helper' - -describe "the chomp function" do - let(:scope) { PuppetlabsSpec::PuppetInternals.scope } - - it "should exist" do - Puppet::Parser::Functions.function("chomp").should == "function_chomp" - end - - it "should raise a ParseError if there is less than 1 arguments" do - lambda { scope.function_chomp([]) }.should( raise_error(Puppet::ParseError)) - end - - it "should chomp the end of a string" do - result = scope.function_chomp(["abc\n"]) - result.should(eq("abc")) - end -end diff --git a/custom_zulip_files/puppet/stdlib/spec/unit/puppet/parser/functions/chop_spec.rb b/custom_zulip_files/puppet/stdlib/spec/unit/puppet/parser/functions/chop_spec.rb deleted file mode 100755 index 9e466de..0000000 --- a/custom_zulip_files/puppet/stdlib/spec/unit/puppet/parser/functions/chop_spec.rb +++ /dev/null @@ -1,19 +0,0 @@ -#! /usr/bin/env ruby -S rspec -require 'spec_helper' - -describe "the chop function" do - let(:scope) { PuppetlabsSpec::PuppetInternals.scope } - - it "should exist" do - Puppet::Parser::Functions.function("chop").should == "function_chop" - end - - it "should raise a ParseError if there is less than 1 arguments" do - lambda { scope.function_chop([]) }.should( raise_error(Puppet::ParseError)) - end - - it "should chop the end of a string" do - result = scope.function_chop(["asdf\n"]) - result.should(eq("asdf")) - end -end diff --git a/custom_zulip_files/puppet/stdlib/spec/unit/puppet/parser/functions/concat_spec.rb b/custom_zulip_files/puppet/stdlib/spec/unit/puppet/parser/functions/concat_spec.rb deleted file mode 100644 index 123188b..0000000 --- a/custom_zulip_files/puppet/stdlib/spec/unit/puppet/parser/functions/concat_spec.rb +++ /dev/null @@ -1,15 +0,0 @@ -#! /usr/bin/env ruby -S rspec -require 'spec_helper' - -describe "the concat function" do - let(:scope) { PuppetlabsSpec::PuppetInternals.scope } - - it "should raise a ParseError if there is less than 1 arguments" do - lambda { scope.function_concat([]) }.should( raise_error(Puppet::ParseError)) - end - - it "should be able to concat an array" do - result = scope.function_concat([['1','2','3'],['4','5','6']]) - result.should(eq(['1','2','3','4','5','6'])) - end -end diff --git a/custom_zulip_files/puppet/stdlib/spec/unit/puppet/parser/functions/count_spec.rb b/custom_zulip_files/puppet/stdlib/spec/unit/puppet/parser/functions/count_spec.rb deleted file mode 100644 index 2453815..0000000 --- a/custom_zulip_files/puppet/stdlib/spec/unit/puppet/parser/functions/count_spec.rb +++ /dev/null @@ -1,31 +0,0 @@ -#! /usr/bin/env ruby -S rspec - -require 'spec_helper' - -describe "the count function" do - let(:scope) { PuppetlabsSpec::PuppetInternals.scope } - - it "should exist" do - Puppet::Parser::Functions.function("count").should == "function_count" - end - - it "should raise a ArgumentError if there is more than 2 arguments" do - lambda { scope.function_count(['foo', 'bar', 'baz']) }.should( raise_error(ArgumentError)) - end - - it "should be able to count arrays" do - scope.function_count([["1","2","3"]]).should(eq(3)) - end - - it "should be able to count matching elements in arrays" do - scope.function_count([["1", "2", "2"], "2"]).should(eq(2)) - end - - it "should not count nil or empty strings" do - scope.function_count([["foo","bar",nil,""]]).should(eq(2)) - end - - it 'does not count an undefined hash key or an out of bound array index (which are both :undef)' do - expect(scope.function_count([["foo",:undef,:undef]])).to eq(1) - end -end diff --git a/custom_zulip_files/puppet/stdlib/spec/unit/puppet/parser/functions/delete_at_spec.rb b/custom_zulip_files/puppet/stdlib/spec/unit/puppet/parser/functions/delete_at_spec.rb deleted file mode 100755 index d8d9618..0000000 --- a/custom_zulip_files/puppet/stdlib/spec/unit/puppet/parser/functions/delete_at_spec.rb +++ /dev/null @@ -1,19 +0,0 @@ -#! /usr/bin/env ruby -S rspec -require 'spec_helper' - -describe "the delete_at function" do - let(:scope) { PuppetlabsSpec::PuppetInternals.scope } - - it "should exist" do - Puppet::Parser::Functions.function("delete_at").should == "function_delete_at" - end - - it "should raise a ParseError if there is less than 1 arguments" do - lambda { scope.function_delete_at([]) }.should( raise_error(Puppet::ParseError)) - end - - it "should delete an item at specified location from an array" do - result = scope.function_delete_at([['a','b','c'],1]) - result.should(eq(['a','c'])) - end -end diff --git a/custom_zulip_files/puppet/stdlib/spec/unit/puppet/parser/functions/delete_spec.rb b/custom_zulip_files/puppet/stdlib/spec/unit/puppet/parser/functions/delete_spec.rb deleted file mode 100755 index 2f29c93..0000000 --- a/custom_zulip_files/puppet/stdlib/spec/unit/puppet/parser/functions/delete_spec.rb +++ /dev/null @@ -1,38 +0,0 @@ -#! /usr/bin/env ruby -S rspec -require 'spec_helper' - -describe "the delete function" do - let(:scope) { PuppetlabsSpec::PuppetInternals.scope } - - it "should exist" do - Puppet::Parser::Functions.function("delete").should == "function_delete" - end - - it "should raise a ParseError if there are fewer than 2 arguments" do - lambda { scope.function_delete([]) }.should( raise_error(Puppet::ParseError)) - end - - it "should raise a ParseError if there are greater than 2 arguments" do - lambda { scope.function_delete([[], 'foo', 'bar']) }.should( raise_error(Puppet::ParseError)) - end - - it "should raise a TypeError if a number is passed as the first argument" do - lambda { scope.function_delete([1, 'bar']) }.should( raise_error(TypeError)) - end - - it "should delete all instances of an element from an array" do - result = scope.function_delete([['a','b','c','b'],'b']) - result.should(eq(['a','c'])) - end - - it "should delete all instances of a substring from a string" do - result = scope.function_delete(['foobarbabarz','bar']) - result.should(eq('foobaz')) - end - - it "should delete a key from a hash" do - result = scope.function_delete([{ 'a' => 1, 'b' => 2, 'c' => 3 },'b']) - result.should(eq({ 'a' => 1, 'c' => 3 })) - end - -end diff --git a/custom_zulip_files/puppet/stdlib/spec/unit/puppet/parser/functions/dirname_spec.rb b/custom_zulip_files/puppet/stdlib/spec/unit/puppet/parser/functions/dirname_spec.rb deleted file mode 100755 index fb3b4fe..0000000 --- a/custom_zulip_files/puppet/stdlib/spec/unit/puppet/parser/functions/dirname_spec.rb +++ /dev/null @@ -1,24 +0,0 @@ -#! /usr/bin/env ruby -S rspec -require 'spec_helper' - -describe "the dirname function" do - let(:scope) { PuppetlabsSpec::PuppetInternals.scope } - - it "should exist" do - Puppet::Parser::Functions.function("dirname").should == "function_dirname" - end - - it "should raise a ParseError if there is less than 1 arguments" do - lambda { scope.function_dirname([]) }.should( raise_error(Puppet::ParseError)) - end - - it "should return dirname for an absolute path" do - result = scope.function_dirname(['/path/to/a/file.ext']) - result.should(eq('/path/to/a')) - end - - it "should return dirname for a relative path" do - result = scope.function_dirname(['path/to/a/file.ext']) - result.should(eq('path/to/a')) - end -end diff --git a/custom_zulip_files/puppet/stdlib/spec/unit/puppet/parser/functions/downcase_spec.rb b/custom_zulip_files/puppet/stdlib/spec/unit/puppet/parser/functions/downcase_spec.rb deleted file mode 100755 index acef1f0..0000000 --- a/custom_zulip_files/puppet/stdlib/spec/unit/puppet/parser/functions/downcase_spec.rb +++ /dev/null @@ -1,24 +0,0 @@ -#! /usr/bin/env ruby -S rspec -require 'spec_helper' - -describe "the downcase function" do - let(:scope) { PuppetlabsSpec::PuppetInternals.scope } - - it "should exist" do - Puppet::Parser::Functions.function("downcase").should == "function_downcase" - end - - it "should raise a ParseError if there is less than 1 arguments" do - lambda { scope.function_downcase([]) }.should( raise_error(Puppet::ParseError)) - end - - it "should downcase a string" do - result = scope.function_downcase(["ASFD"]) - result.should(eq("asfd")) - end - - it "should do nothing to a string that is already downcase" do - result = scope.function_downcase(["asdf asdf"]) - result.should(eq("asdf asdf")) - end -end diff --git a/custom_zulip_files/puppet/stdlib/spec/unit/puppet/parser/functions/empty_spec.rb b/custom_zulip_files/puppet/stdlib/spec/unit/puppet/parser/functions/empty_spec.rb deleted file mode 100755 index 7745875..0000000 --- a/custom_zulip_files/puppet/stdlib/spec/unit/puppet/parser/functions/empty_spec.rb +++ /dev/null @@ -1,23 +0,0 @@ -#! /usr/bin/env ruby -S rspec -require 'spec_helper' - -describe "the empty function" do - let(:scope) { PuppetlabsSpec::PuppetInternals.scope } - it "should exist" do - Puppet::Parser::Functions.function("empty").should == "function_empty" - end - - it "should raise a ParseError if there is less than 1 arguments" do - lambda { scope.function_empty([]) }.should( raise_error(Puppet::ParseError)) - end - - it "should return a true for an empty string" do - result = scope.function_empty(['']) - result.should(eq(true)) - end - - it "should return a false for a non-empty string" do - result = scope.function_empty(['asdf']) - result.should(eq(false)) - end -end diff --git a/custom_zulip_files/puppet/stdlib/spec/unit/puppet/parser/functions/flatten_spec.rb b/custom_zulip_files/puppet/stdlib/spec/unit/puppet/parser/functions/flatten_spec.rb deleted file mode 100755 index dba7a6b..0000000 --- a/custom_zulip_files/puppet/stdlib/spec/unit/puppet/parser/functions/flatten_spec.rb +++ /dev/null @@ -1,27 +0,0 @@ -#! /usr/bin/env ruby -S rspec -require 'spec_helper' - -describe "the flatten function" do - let(:scope) { PuppetlabsSpec::PuppetInternals.scope } - it "should exist" do - Puppet::Parser::Functions.function("flatten").should == "function_flatten" - end - - it "should raise a ParseError if there is less than 1 arguments" do - lambda { scope.function_flatten([]) }.should( raise_error(Puppet::ParseError)) - end - - it "should raise a ParseError if there is more than 1 argument" do - lambda { scope.function_flatten([[], []]) }.should( raise_error(Puppet::ParseError)) - end - - it "should flatten a complex data structure" do - result = scope.function_flatten([["a","b",["c",["d","e"],"f","g"]]]) - result.should(eq(["a","b","c","d","e","f","g"])) - end - - it "should do nothing to a structure that is already flat" do - result = scope.function_flatten([["a","b","c","d"]]) - result.should(eq(["a","b","c","d"])) - end -end diff --git a/custom_zulip_files/puppet/stdlib/spec/unit/puppet/parser/functions/floor_spec.rb b/custom_zulip_files/puppet/stdlib/spec/unit/puppet/parser/functions/floor_spec.rb deleted file mode 100644 index dbc8c77..0000000 --- a/custom_zulip_files/puppet/stdlib/spec/unit/puppet/parser/functions/floor_spec.rb +++ /dev/null @@ -1,39 +0,0 @@ -#! /usr/bin/env ruby -S rspec - -require 'spec_helper' - -describe "the floor function" do - let(:scope) { PuppetlabsSpec::PuppetInternals.scope } - - it "should exist" do - Puppet::Parser::Functions.function("floor").should == "function_floor" - end - - it "should raise a ParseError if there is less than 1 argument" do - lambda { scope.function_floor([]) }.should( raise_error(Puppet::ParseError, /Wrong number of arguments/)) - end - - it "should should raise a ParseError if input isn't numeric (eg. String)" do - lambda { scope.function_floor(["foo"]) }.should( raise_error(Puppet::ParseError, /Wrong argument type/)) - end - - it "should should raise a ParseError if input isn't numeric (eg. Boolean)" do - lambda { scope.function_floor([true]) }.should( raise_error(Puppet::ParseError, /Wrong argument type/)) - end - - it "should return an integer when a numeric type is passed" do - result = scope.function_floor([12.4]) - result.is_a?(Integer).should(eq(true)) - end - - it "should return the input when an integer is passed" do - result = scope.function_floor([7]) - result.should(eq(7)) - end - - it "should return the largest integer less than or equal to the input" do - result = scope.function_floor([3.8]) - result.should(eq(3)) - end -end - diff --git a/custom_zulip_files/puppet/stdlib/spec/unit/puppet/parser/functions/fqdn_rotate_spec.rb b/custom_zulip_files/puppet/stdlib/spec/unit/puppet/parser/functions/fqdn_rotate_spec.rb deleted file mode 100644 index 2577723..0000000 --- a/custom_zulip_files/puppet/stdlib/spec/unit/puppet/parser/functions/fqdn_rotate_spec.rb +++ /dev/null @@ -1,33 +0,0 @@ -#! /usr/bin/env ruby -S rspec -require 'spec_helper' - -describe "the fqdn_rotate function" do - let(:scope) { PuppetlabsSpec::PuppetInternals.scope } - - it "should exist" do - Puppet::Parser::Functions.function("fqdn_rotate").should == "function_fqdn_rotate" - end - - it "should raise a ParseError if there is less than 1 arguments" do - lambda { scope.function_fqdn_rotate([]) }.should( raise_error(Puppet::ParseError)) - end - - it "should rotate a string and the result should be the same size" do - scope.expects(:lookupvar).with("::fqdn").returns("127.0.0.1") - result = scope.function_fqdn_rotate(["asdf"]) - result.size.should(eq(4)) - end - - it "should rotate a string to give the same results for one host" do - scope.expects(:lookupvar).with("::fqdn").returns("127.0.0.1").twice - scope.function_fqdn_rotate(["abcdefg"]).should eql(scope.function_fqdn_rotate(["abcdefg"])) - end - - it "should rotate a string to give different values on different hosts" do - scope.expects(:lookupvar).with("::fqdn").returns("127.0.0.1") - val1 = scope.function_fqdn_rotate(["abcdefghijklmnopqrstuvwxyz01234567890987654321"]) - scope.expects(:lookupvar).with("::fqdn").returns("127.0.0.2") - val2 = scope.function_fqdn_rotate(["abcdefghijklmnopqrstuvwxyz01234567890987654321"]) - val1.should_not eql(val2) - end -end diff --git a/custom_zulip_files/puppet/stdlib/spec/unit/puppet/parser/functions/get_module_path_spec.rb b/custom_zulip_files/puppet/stdlib/spec/unit/puppet/parser/functions/get_module_path_spec.rb deleted file mode 100644 index 486bef6..0000000 --- a/custom_zulip_files/puppet/stdlib/spec/unit/puppet/parser/functions/get_module_path_spec.rb +++ /dev/null @@ -1,46 +0,0 @@ -#! /usr/bin/env ruby -S rspec -require 'spec_helper' - -describe Puppet::Parser::Functions.function(:get_module_path) do - Internals = PuppetlabsSpec::PuppetInternals - class StubModule - attr_reader :path - def initialize(path) - @path = path - end - end - - def scope(environment = "production") - Internals.scope(:compiler => Internals.compiler(:node => Internals.node(:environment => environment))) - end - - it 'should only allow one argument' do - expect { scope.function_get_module_path([]) }.to raise_error(Puppet::ParseError, /Wrong number of arguments, expects one/) - expect { scope.function_get_module_path(['1','2','3']) }.to raise_error(Puppet::ParseError, /Wrong number of arguments, expects one/) - end - it 'should raise an exception when the module cannot be found' do - expect { scope.function_get_module_path(['foo']) }.to raise_error(Puppet::ParseError, /Could not find module/) - end - describe 'when locating a module' do - let(:modulepath) { "/tmp/does_not_exist" } - let(:path_of_module_foo) { StubModule.new("/tmp/does_not_exist/foo") } - - before(:each) { Puppet[:modulepath] = modulepath } - - it 'should be able to find module paths from the modulepath setting' do - Puppet::Module.expects(:find).with('foo', 'production').returns(path_of_module_foo) - scope.function_get_module_path(['foo']).should == path_of_module_foo.path - end - it 'should be able to find module paths when the modulepath is a list' do - Puppet[:modulepath] = modulepath + ":/tmp" - Puppet::Module.expects(:find).with('foo', 'production').returns(path_of_module_foo) - scope.function_get_module_path(['foo']).should == path_of_module_foo.path - end - it 'should respect the environment' do - pending("Disabled on Puppet 2.6.x") if Puppet.version =~ /^2\.6\b/ - Puppet.settings[:environment] = 'danstestenv' - Puppet::Module.expects(:find).with('foo', 'danstestenv').returns(path_of_module_foo) - scope('danstestenv').function_get_module_path(['foo']).should == path_of_module_foo.path - end - end -end diff --git a/custom_zulip_files/puppet/stdlib/spec/unit/puppet/parser/functions/getvar_spec.rb b/custom_zulip_files/puppet/stdlib/spec/unit/puppet/parser/functions/getvar_spec.rb deleted file mode 100644 index 5ff834e..0000000 --- a/custom_zulip_files/puppet/stdlib/spec/unit/puppet/parser/functions/getvar_spec.rb +++ /dev/null @@ -1,37 +0,0 @@ -#! /usr/bin/env ruby -S rspec -require 'spec_helper' - -describe Puppet::Parser::Functions.function(:getvar) do - let(:scope) { PuppetlabsSpec::PuppetInternals.scope } - describe 'when calling getvar from puppet' do - - it "should not compile when no arguments are passed" do - pending("Fails on 2.6.x, see bug #15912") if Puppet.version =~ /^2\.6\./ - Puppet[:code] = '$foo = getvar()' - expect { - scope.compiler.compile - }.to raise_error(Puppet::ParseError, /wrong number of arguments/) - end - - it "should not compile when too many arguments are passed" do - pending("Fails on 2.6.x, see bug #15912") if Puppet.version =~ /^2\.6\./ - Puppet[:code] = '$foo = getvar("foo::bar", "baz")' - expect { - scope.compiler.compile - }.to raise_error(Puppet::ParseError, /wrong number of arguments/) - end - - it "should lookup variables in other namespaces" do - pending("Fails on 2.6.x, see bug #15912") if Puppet.version =~ /^2\.6\./ - Puppet[:code] = <<-'ENDofPUPPETcode' - class site::data { $foo = 'baz' } - include site::data - $foo = getvar("site::data::foo") - if $foo != 'baz' { - fail('getvar did not return what we expect') - } - ENDofPUPPETcode - scope.compiler.compile - end - end -end diff --git a/custom_zulip_files/puppet/stdlib/spec/unit/puppet/parser/functions/grep_spec.rb b/custom_zulip_files/puppet/stdlib/spec/unit/puppet/parser/functions/grep_spec.rb deleted file mode 100755 index a93b842..0000000 --- a/custom_zulip_files/puppet/stdlib/spec/unit/puppet/parser/functions/grep_spec.rb +++ /dev/null @@ -1,19 +0,0 @@ -#! /usr/bin/env ruby -S rspec -require 'spec_helper' - -describe "the grep function" do - let(:scope) { PuppetlabsSpec::PuppetInternals.scope } - - it "should exist" do - Puppet::Parser::Functions.function("grep").should == "function_grep" - end - - it "should raise a ParseError if there is less than 1 arguments" do - lambda { scope.function_grep([]) }.should( raise_error(Puppet::ParseError)) - end - - it "should grep contents from an array" do - result = scope.function_grep([["aaabbb","bbbccc","dddeee"], "bbb"]) - result.should(eq(["aaabbb","bbbccc"])) - end -end diff --git a/custom_zulip_files/puppet/stdlib/spec/unit/puppet/parser/functions/has_interface_with_spec.rb b/custom_zulip_files/puppet/stdlib/spec/unit/puppet/parser/functions/has_interface_with_spec.rb deleted file mode 100755 index c5264e4..0000000 --- a/custom_zulip_files/puppet/stdlib/spec/unit/puppet/parser/functions/has_interface_with_spec.rb +++ /dev/null @@ -1,64 +0,0 @@ -#!/usr/bin/env ruby -S rspec -require 'spec_helper' - -describe Puppet::Parser::Functions.function(:has_interface_with) do - - let(:scope) do - PuppetlabsSpec::PuppetInternals.scope - end - - # The subject of these examples is the method itself. - subject do - function_name = Puppet::Parser::Functions.function(:has_interface_with) - scope.method(function_name) - end - - # We need to mock out the Facts so we can specify how we expect this function - # to behave on different platforms. - context "On Mac OS X Systems" do - before :each do - scope.stubs(:lookupvar).with("interfaces").returns('lo0,gif0,stf0,en1,p2p0,fw0,en0,vmnet1,vmnet8,utun0') - end - it 'should have loopback (lo0)' do - subject.call(['lo0']).should be_true - end - it 'should not have loopback (lo)' do - subject.call(['lo']).should be_false - end - end - context "On Linux Systems" do - before :each do - scope.stubs(:lookupvar).with("interfaces").returns('eth0,lo') - scope.stubs(:lookupvar).with("ipaddress").returns('10.0.0.1') - scope.stubs(:lookupvar).with("ipaddress_lo").returns('127.0.0.1') - scope.stubs(:lookupvar).with("ipaddress_eth0").returns('10.0.0.1') - scope.stubs(:lookupvar).with('muppet').returns('kermit') - scope.stubs(:lookupvar).with('muppet_lo').returns('mspiggy') - scope.stubs(:lookupvar).with('muppet_eth0').returns('kermit') - end - it 'should have loopback (lo)' do - subject.call(['lo']).should be_true - end - it 'should not have loopback (lo0)' do - subject.call(['lo0']).should be_false - end - it 'should have ipaddress with 127.0.0.1' do - subject.call(['ipaddress', '127.0.0.1']).should be_true - end - it 'should have ipaddress with 10.0.0.1' do - subject.call(['ipaddress', '10.0.0.1']).should be_true - end - it 'should not have ipaddress with 10.0.0.2' do - subject.call(['ipaddress', '10.0.0.2']).should be_false - end - it 'should have muppet named kermit' do - subject.call(['muppet', 'kermit']).should be_true - end - it 'should have muppet named mspiggy' do - subject.call(['muppet', 'mspiggy']).should be_true - end - it 'should not have muppet named bigbird' do - subject.call(['muppet', 'bigbird']).should be_false - end - end -end diff --git a/custom_zulip_files/puppet/stdlib/spec/unit/puppet/parser/functions/has_ip_address_spec.rb b/custom_zulip_files/puppet/stdlib/spec/unit/puppet/parser/functions/has_ip_address_spec.rb deleted file mode 100755 index 5a68460..0000000 --- a/custom_zulip_files/puppet/stdlib/spec/unit/puppet/parser/functions/has_ip_address_spec.rb +++ /dev/null @@ -1,39 +0,0 @@ -#!/usr/bin/env ruby -S rspec -require 'spec_helper' - -describe Puppet::Parser::Functions.function(:has_ip_address) do - - let(:scope) do - PuppetlabsSpec::PuppetInternals.scope - end - - subject do - function_name = Puppet::Parser::Functions.function(:has_ip_address) - scope.method(function_name) - end - - context "On Linux Systems" do - before :each do - scope.stubs(:lookupvar).with('interfaces').returns('eth0,lo') - scope.stubs(:lookupvar).with('ipaddress').returns('10.0.2.15') - scope.stubs(:lookupvar).with('ipaddress_eth0').returns('10.0.2.15') - scope.stubs(:lookupvar).with('ipaddress_lo').returns('127.0.0.1') - end - - it 'should have primary address (10.0.2.15)' do - subject.call(['10.0.2.15']).should be_true - end - - it 'should have lookupback address (127.0.0.1)' do - subject.call(['127.0.0.1']).should be_true - end - - it 'should not have other address' do - subject.call(['192.1681.1.1']).should be_false - end - - it 'should not have "mspiggy" on an interface' do - subject.call(['mspiggy']).should be_false - end - end -end diff --git a/custom_zulip_files/puppet/stdlib/spec/unit/puppet/parser/functions/has_ip_network_spec.rb b/custom_zulip_files/puppet/stdlib/spec/unit/puppet/parser/functions/has_ip_network_spec.rb deleted file mode 100755 index c3a289e..0000000 --- a/custom_zulip_files/puppet/stdlib/spec/unit/puppet/parser/functions/has_ip_network_spec.rb +++ /dev/null @@ -1,36 +0,0 @@ -#!/usr/bin/env ruby -S rspec -require 'spec_helper' - -describe Puppet::Parser::Functions.function(:has_ip_network) do - - let(:scope) do - PuppetlabsSpec::PuppetInternals.scope - end - - subject do - function_name = Puppet::Parser::Functions.function(:has_ip_network) - scope.method(function_name) - end - - context "On Linux Systems" do - before :each do - scope.stubs(:lookupvar).with('interfaces').returns('eth0,lo') - scope.stubs(:lookupvar).with('network').returns(:undefined) - scope.stubs(:lookupvar).with('network_eth0').returns('10.0.2.0') - scope.stubs(:lookupvar).with('network_lo').returns('127.0.0.1') - end - - it 'should have primary network (10.0.2.0)' do - subject.call(['10.0.2.0']).should be_true - end - - it 'should have loopback network (127.0.0.0)' do - subject.call(['127.0.0.1']).should be_true - end - - it 'should not have other network' do - subject.call(['192.168.1.0']).should be_false - end - end -end - diff --git a/custom_zulip_files/puppet/stdlib/spec/unit/puppet/parser/functions/has_key_spec.rb b/custom_zulip_files/puppet/stdlib/spec/unit/puppet/parser/functions/has_key_spec.rb deleted file mode 100644 index 490daea..0000000 --- a/custom_zulip_files/puppet/stdlib/spec/unit/puppet/parser/functions/has_key_spec.rb +++ /dev/null @@ -1,42 +0,0 @@ -#! /usr/bin/env ruby -S rspec -require 'spec_helper' - -describe Puppet::Parser::Functions.function(:has_key) do - let(:scope) { PuppetlabsSpec::PuppetInternals.scope } - - describe 'when calling has_key from puppet' do - it "should not compile when no arguments are passed" do - pending("Fails on 2.6.x, see bug #15912") if Puppet.version =~ /^2\.6\./ - Puppet[:code] = '$x = has_key()' - expect { - scope.compiler.compile - }.to raise_error(Puppet::ParseError, /wrong number of arguments/) - end - - it "should not compile when 1 argument is passed" do - pending("Fails on 2.6.x, see bug #15912") if Puppet.version =~ /^2\.6\./ - Puppet[:code] = "$x = has_key('foo')" - expect { - scope.compiler.compile - }.to raise_error(Puppet::ParseError, /wrong number of arguments/) - end - - it "should require the first value to be a Hash" do - pending("Fails on 2.6.x, see bug #15912") if Puppet.version =~ /^2\.6\./ - Puppet[:code] = "$x = has_key('foo', 'bar')" - expect { - scope.compiler.compile - }.to raise_error(Puppet::ParseError, /expects the first argument to be a hash/) - end - end - - describe 'when calling the function has_key from a scope instance' do - it 'should detect existing keys' do - scope.function_has_key([{'one' => 1}, 'one']).should be_true - end - - it 'should detect existing keys' do - scope.function_has_key([{'one' => 1}, 'two']).should be_false - end - end -end diff --git a/custom_zulip_files/puppet/stdlib/spec/unit/puppet/parser/functions/hash_spec.rb b/custom_zulip_files/puppet/stdlib/spec/unit/puppet/parser/functions/hash_spec.rb deleted file mode 100644 index 7c91be9..0000000 --- a/custom_zulip_files/puppet/stdlib/spec/unit/puppet/parser/functions/hash_spec.rb +++ /dev/null @@ -1,19 +0,0 @@ -#! /usr/bin/env ruby -S rspec -require 'spec_helper' - -describe "the hash function" do - let(:scope) { PuppetlabsSpec::PuppetInternals.scope } - - it "should exist" do - Puppet::Parser::Functions.function("hash").should == "function_hash" - end - - it "should raise a ParseError if there is less than 1 arguments" do - lambda { scope.function_hash([]) }.should( raise_error(Puppet::ParseError)) - end - - it "should convert an array to a hash" do - result = scope.function_hash([['a',1,'b',2,'c',3]]) - result.should(eq({'a'=>1,'b'=>2,'c'=>3})) - end -end diff --git a/custom_zulip_files/puppet/stdlib/spec/unit/puppet/parser/functions/is_array_spec.rb b/custom_zulip_files/puppet/stdlib/spec/unit/puppet/parser/functions/is_array_spec.rb deleted file mode 100644 index e7f4bcd..0000000 --- a/custom_zulip_files/puppet/stdlib/spec/unit/puppet/parser/functions/is_array_spec.rb +++ /dev/null @@ -1,29 +0,0 @@ -#! /usr/bin/env ruby -S rspec -require 'spec_helper' - -describe "the is_array function" do - let(:scope) { PuppetlabsSpec::PuppetInternals.scope } - - it "should exist" do - Puppet::Parser::Functions.function("is_array").should == "function_is_array" - end - - it "should raise a ParseError if there is less than 1 arguments" do - lambda { scope.function_is_array([]) }.should( raise_error(Puppet::ParseError)) - end - - it "should return true if passed an array" do - result = scope.function_is_array([[1,2,3]]) - result.should(eq(true)) - end - - it "should return false if passed a hash" do - result = scope.function_is_array([{'a'=>1}]) - result.should(eq(false)) - end - - it "should return false if passed a string" do - result = scope.function_is_array(["asdf"]) - result.should(eq(false)) - end -end diff --git a/custom_zulip_files/puppet/stdlib/spec/unit/puppet/parser/functions/is_domain_name_spec.rb b/custom_zulip_files/puppet/stdlib/spec/unit/puppet/parser/functions/is_domain_name_spec.rb deleted file mode 100644 index f2ea76d..0000000 --- a/custom_zulip_files/puppet/stdlib/spec/unit/puppet/parser/functions/is_domain_name_spec.rb +++ /dev/null @@ -1,64 +0,0 @@ -#! /usr/bin/env ruby -S rspec -require 'spec_helper' - -describe "the is_domain_name function" do - let(:scope) { PuppetlabsSpec::PuppetInternals.scope } - - it "should exist" do - Puppet::Parser::Functions.function("is_domain_name").should == "function_is_domain_name" - end - - it "should raise a ParseError if there is less than 1 arguments" do - lambda { scope.function_is_domain_name([]) }.should( raise_error(Puppet::ParseError)) - end - - it "should return true if a valid short domain name" do - result = scope.function_is_domain_name(["x.com"]) - result.should(be_true) - end - - it "should return true if the domain is ." do - result = scope.function_is_domain_name(["."]) - result.should(be_true) - end - - it "should return true if the domain is x.com." do - result = scope.function_is_domain_name(["x.com."]) - result.should(be_true) - end - - it "should return true if a valid domain name" do - result = scope.function_is_domain_name(["foo.bar.com"]) - result.should(be_true) - end - - it "should allow domain parts to start with numbers" do - result = scope.function_is_domain_name(["3foo.2bar.com"]) - result.should(be_true) - end - - it "should allow domain to end with a dot" do - result = scope.function_is_domain_name(["3foo.2bar.com."]) - result.should(be_true) - end - - it "should allow a single part domain" do - result = scope.function_is_domain_name(["orange"]) - result.should(be_true) - end - - it "should return false if domain parts start with hyphens" do - result = scope.function_is_domain_name(["-3foo.2bar.com"]) - result.should(be_false) - end - - it "should return true if domain contains hyphens" do - result = scope.function_is_domain_name(["3foo-bar.2bar-fuzz.com"]) - result.should(be_true) - end - - it "should return false if domain name contains spaces" do - result = scope.function_is_domain_name(["not valid"]) - result.should(be_false) - end -end diff --git a/custom_zulip_files/puppet/stdlib/spec/unit/puppet/parser/functions/is_float_spec.rb b/custom_zulip_files/puppet/stdlib/spec/unit/puppet/parser/functions/is_float_spec.rb deleted file mode 100644 index b7d73b0..0000000 --- a/custom_zulip_files/puppet/stdlib/spec/unit/puppet/parser/functions/is_float_spec.rb +++ /dev/null @@ -1,33 +0,0 @@ -#! /usr/bin/env ruby -S rspec -require 'spec_helper' - -describe "the is_float function" do - let(:scope) { PuppetlabsSpec::PuppetInternals.scope } - - it "should exist" do - Puppet::Parser::Functions.function("is_float").should == "function_is_float" - end - - it "should raise a ParseError if there is less than 1 arguments" do - lambda { scope.function_is_float([]) }.should( raise_error(Puppet::ParseError)) - end - - it "should return true if a float" do - result = scope.function_is_float(["0.12"]) - result.should(eq(true)) - end - - it "should return false if a string" do - result = scope.function_is_float(["asdf"]) - result.should(eq(false)) - end - - it "should return false if an integer" do - result = scope.function_is_float(["3"]) - result.should(eq(false)) - end - it "should return true if a float is created from an arithmetical operation" do - result = scope.function_is_float([3.2*2]) - result.should(eq(true)) - end -end diff --git a/custom_zulip_files/puppet/stdlib/spec/unit/puppet/parser/functions/is_function_available.rb b/custom_zulip_files/puppet/stdlib/spec/unit/puppet/parser/functions/is_function_available.rb deleted file mode 100644 index bd40c51..0000000 --- a/custom_zulip_files/puppet/stdlib/spec/unit/puppet/parser/functions/is_function_available.rb +++ /dev/null @@ -1,31 +0,0 @@ -#!/usr/bin/env rspec -require 'spec_helper' - -describe "the is_function_available function" do - before :all do - Puppet::Parser::Functions.autoloader.loadall - end - - before :each do - @scope = Puppet::Parser::Scope.new - end - - it "should exist" do - Puppet::Parser::Functions.function("is_function_available").should == "function_is_function_available" - end - - it "should raise a ParseError if there is less than 1 arguments" do - lambda { @scope.function_is_function_available([]) }.should( raise_error(Puppet::ParseError)) - end - - it "should return false if a nonexistent function is passed" do - result = @scope.function_is_function_available(['jeff_mccunes_left_sock']) - result.should(eq(false)) - end - - it "should return true if an available function is passed" do - result = @scope.function_is_function_available(['require']) - result.should(eq(true)) - end - -end diff --git a/custom_zulip_files/puppet/stdlib/spec/unit/puppet/parser/functions/is_hash_spec.rb b/custom_zulip_files/puppet/stdlib/spec/unit/puppet/parser/functions/is_hash_spec.rb deleted file mode 100644 index bbebf39..0000000 --- a/custom_zulip_files/puppet/stdlib/spec/unit/puppet/parser/functions/is_hash_spec.rb +++ /dev/null @@ -1,29 +0,0 @@ -#! /usr/bin/env ruby -S rspec -require 'spec_helper' - -describe "the is_hash function" do - let(:scope) { PuppetlabsSpec::PuppetInternals.scope } - - it "should exist" do - Puppet::Parser::Functions.function("is_hash").should == "function_is_hash" - end - - it "should raise a ParseError if there is less than 1 arguments" do - lambda { scope.function_is_hash([]) }.should( raise_error(Puppet::ParseError)) - end - - it "should return true if passed a hash" do - result = scope.function_is_hash([{"a"=>1,"b"=>2}]) - result.should(eq(true)) - end - - it "should return false if passed an array" do - result = scope.function_is_hash([["a","b"]]) - result.should(eq(false)) - end - - it "should return false if passed a string" do - result = scope.function_is_hash(["asdf"]) - result.should(eq(false)) - end -end diff --git a/custom_zulip_files/puppet/stdlib/spec/unit/puppet/parser/functions/is_integer_spec.rb b/custom_zulip_files/puppet/stdlib/spec/unit/puppet/parser/functions/is_integer_spec.rb deleted file mode 100644 index 4335795..0000000 --- a/custom_zulip_files/puppet/stdlib/spec/unit/puppet/parser/functions/is_integer_spec.rb +++ /dev/null @@ -1,34 +0,0 @@ -#! /usr/bin/env ruby -S rspec -require 'spec_helper' - -describe "the is_integer function" do - let(:scope) { PuppetlabsSpec::PuppetInternals.scope } - - it "should exist" do - Puppet::Parser::Functions.function("is_integer").should == "function_is_integer" - end - - it "should raise a ParseError if there is less than 1 arguments" do - lambda { scope.function_is_integer([]) }.should( raise_error(Puppet::ParseError)) - end - - it "should return true if an integer" do - result = scope.function_is_integer(["3"]) - result.should(eq(true)) - end - - it "should return false if a float" do - result = scope.function_is_integer(["3.2"]) - result.should(eq(false)) - end - - it "should return false if a string" do - result = scope.function_is_integer(["asdf"]) - result.should(eq(false)) - end - - it "should return true if an integer is created from an arithmetical operation" do - result = scope.function_is_integer([3*2]) - result.should(eq(true)) - end -end diff --git a/custom_zulip_files/puppet/stdlib/spec/unit/puppet/parser/functions/is_ip_address_spec.rb b/custom_zulip_files/puppet/stdlib/spec/unit/puppet/parser/functions/is_ip_address_spec.rb deleted file mode 100644 index c0debb3..0000000 --- a/custom_zulip_files/puppet/stdlib/spec/unit/puppet/parser/functions/is_ip_address_spec.rb +++ /dev/null @@ -1,39 +0,0 @@ -#! /usr/bin/env ruby -S rspec -require 'spec_helper' - -describe "the is_ip_address function" do - let(:scope) { PuppetlabsSpec::PuppetInternals.scope } - - it "should exist" do - Puppet::Parser::Functions.function("is_ip_address").should == "function_is_ip_address" - end - - it "should raise a ParseError if there is less than 1 arguments" do - lambda { scope.function_is_ip_address([]) }.should( raise_error(Puppet::ParseError)) - end - - it "should return true if an IPv4 address" do - result = scope.function_is_ip_address(["1.2.3.4"]) - result.should(eq(true)) - end - - it "should return true if a full IPv6 address" do - result = scope.function_is_ip_address(["fe80:0000:cd12:d123:e2f8:47ff:fe09:dd74"]) - result.should(eq(true)) - end - - it "should return true if a compressed IPv6 address" do - result = scope.function_is_ip_address(["fe00::1"]) - result.should(eq(true)) - end - - it "should return false if not valid" do - result = scope.function_is_ip_address(["asdf"]) - result.should(eq(false)) - end - - it "should return false if IP octets out of range" do - result = scope.function_is_ip_address(["1.1.1.300"]) - result.should(eq(false)) - end -end diff --git a/custom_zulip_files/puppet/stdlib/spec/unit/puppet/parser/functions/is_mac_address_spec.rb b/custom_zulip_files/puppet/stdlib/spec/unit/puppet/parser/functions/is_mac_address_spec.rb deleted file mode 100644 index ca9c590..0000000 --- a/custom_zulip_files/puppet/stdlib/spec/unit/puppet/parser/functions/is_mac_address_spec.rb +++ /dev/null @@ -1,29 +0,0 @@ -#! /usr/bin/env ruby -S rspec -require 'spec_helper' - -describe "the is_mac_address function" do - let(:scope) { PuppetlabsSpec::PuppetInternals.scope } - - it "should exist" do - Puppet::Parser::Functions.function("is_mac_address").should == "function_is_mac_address" - end - - it "should raise a ParseError if there is less than 1 arguments" do - lambda { scope.function_is_mac_address([]) }.should( raise_error(Puppet::ParseError)) - end - - it "should return true if a valid mac address" do - result = scope.function_is_mac_address(["00:a0:1f:12:7f:a0"]) - result.should(eq(true)) - end - - it "should return false if octets are out of range" do - result = scope.function_is_mac_address(["00:a0:1f:12:7f:g0"]) - result.should(eq(false)) - end - - it "should return false if not valid" do - result = scope.function_is_mac_address(["not valid"]) - result.should(eq(false)) - end -end diff --git a/custom_zulip_files/puppet/stdlib/spec/unit/puppet/parser/functions/is_numeric_spec.rb b/custom_zulip_files/puppet/stdlib/spec/unit/puppet/parser/functions/is_numeric_spec.rb deleted file mode 100644 index d7440fb..0000000 --- a/custom_zulip_files/puppet/stdlib/spec/unit/puppet/parser/functions/is_numeric_spec.rb +++ /dev/null @@ -1,39 +0,0 @@ -#! /usr/bin/env ruby -S rspec -require 'spec_helper' - -describe "the is_numeric function" do - let(:scope) { PuppetlabsSpec::PuppetInternals.scope } - - it "should exist" do - Puppet::Parser::Functions.function("is_numeric").should == "function_is_numeric" - end - - it "should raise a ParseError if there is less than 1 argument" do - lambda { scope.function_is_numeric([]) }.should( raise_error(Puppet::ParseError)) - end - - it "should return true if an integer" do - result = scope.function_is_numeric(["3"]) - result.should(eq(true)) - end - - it "should return true if a float" do - result = scope.function_is_numeric(["3.2"]) - result.should(eq(true)) - end - - it "should return true if an integer is created from an arithmetical operation" do - result = scope.function_is_numeric([3*2]) - result.should(eq(true)) - end - - it "should return true if a float is created from an arithmetical operation" do - result = scope.function_is_numeric([3.2*2]) - result.should(eq(true)) - end - - it "should return false if a string" do - result = scope.function_is_numeric(["asdf"]) - result.should(eq(false)) - end -end diff --git a/custom_zulip_files/puppet/stdlib/spec/unit/puppet/parser/functions/is_string_spec.rb b/custom_zulip_files/puppet/stdlib/spec/unit/puppet/parser/functions/is_string_spec.rb deleted file mode 100644 index 3756bea..0000000 --- a/custom_zulip_files/puppet/stdlib/spec/unit/puppet/parser/functions/is_string_spec.rb +++ /dev/null @@ -1,34 +0,0 @@ -#! /usr/bin/env ruby -S rspec -require 'spec_helper' - -describe "the is_string function" do - let(:scope) { PuppetlabsSpec::PuppetInternals.scope } - - it "should exist" do - Puppet::Parser::Functions.function("is_string").should == "function_is_string" - end - - it "should raise a ParseError if there is less than 1 arguments" do - lambda { scope.function_is_string([]) }.should( raise_error(Puppet::ParseError)) - end - - it "should return true if a string" do - result = scope.function_is_string(["asdf"]) - result.should(eq(true)) - end - - it "should return false if an integer" do - result = scope.function_is_string(["3"]) - result.should(eq(false)) - end - - it "should return false if a float" do - result = scope.function_is_string(["3.23"]) - result.should(eq(false)) - end - - it "should return false if an array" do - result = scope.function_is_string([["a","b","c"]]) - result.should(eq(false)) - end -end diff --git a/custom_zulip_files/puppet/stdlib/spec/unit/puppet/parser/functions/join_keys_to_values_spec.rb b/custom_zulip_files/puppet/stdlib/spec/unit/puppet/parser/functions/join_keys_to_values_spec.rb deleted file mode 100644 index a52fb71..0000000 --- a/custom_zulip_files/puppet/stdlib/spec/unit/puppet/parser/functions/join_keys_to_values_spec.rb +++ /dev/null @@ -1,40 +0,0 @@ -#! /usr/bin/env ruby -S rspec -require 'spec_helper' - -describe "the join_keys_to_values function" do - let(:scope) { PuppetlabsSpec::PuppetInternals.scope } - - it "should exist" do - Puppet::Parser::Functions.function("join_keys_to_values").should == "function_join_keys_to_values" - end - - it "should raise a ParseError if there are fewer than two arguments" do - lambda { scope.function_join_keys_to_values([{}]) }.should raise_error Puppet::ParseError - end - - it "should raise a ParseError if there are greater than two arguments" do - lambda { scope.function_join_keys_to_values([{}, 'foo', 'bar']) }.should raise_error Puppet::ParseError - end - - it "should raise a TypeError if the first argument is an array" do - lambda { scope.function_join_keys_to_values([[1,2], ',']) }.should raise_error TypeError - end - - it "should raise a TypeError if the second argument is an array" do - lambda { scope.function_join_keys_to_values([{}, [1,2]]) }.should raise_error TypeError - end - - it "should raise a TypeError if the second argument is a number" do - lambda { scope.function_join_keys_to_values([{}, 1]) }.should raise_error TypeError - end - - it "should return an empty array given an empty hash" do - result = scope.function_join_keys_to_values([{}, ":"]) - result.should == [] - end - - it "should join hash's keys to its values" do - result = scope.function_join_keys_to_values([{'a'=>1,2=>'foo',:b=>nil}, ":"]) - result.should =~ ['a:1','2:foo','b:'] - end -end diff --git a/custom_zulip_files/puppet/stdlib/spec/unit/puppet/parser/functions/join_spec.rb b/custom_zulip_files/puppet/stdlib/spec/unit/puppet/parser/functions/join_spec.rb deleted file mode 100644 index aafa1a7..0000000 --- a/custom_zulip_files/puppet/stdlib/spec/unit/puppet/parser/functions/join_spec.rb +++ /dev/null @@ -1,19 +0,0 @@ -#! /usr/bin/env ruby -S rspec -require 'spec_helper' - -describe "the join function" do - let(:scope) { PuppetlabsSpec::PuppetInternals.scope } - - it "should exist" do - Puppet::Parser::Functions.function("join").should == "function_join" - end - - it "should raise a ParseError if there is less than 1 arguments" do - lambda { scope.function_join([]) }.should( raise_error(Puppet::ParseError)) - end - - it "should join an array into a string" do - result = scope.function_join([["a","b","c"], ":"]) - result.should(eq("a:b:c")) - end -end diff --git a/custom_zulip_files/puppet/stdlib/spec/unit/puppet/parser/functions/keys_spec.rb b/custom_zulip_files/puppet/stdlib/spec/unit/puppet/parser/functions/keys_spec.rb deleted file mode 100644 index fdd7a70..0000000 --- a/custom_zulip_files/puppet/stdlib/spec/unit/puppet/parser/functions/keys_spec.rb +++ /dev/null @@ -1,21 +0,0 @@ -#! /usr/bin/env ruby -S rspec -require 'spec_helper' - -describe "the keys function" do - let(:scope) { PuppetlabsSpec::PuppetInternals.scope } - - it "should exist" do - Puppet::Parser::Functions.function("keys").should == "function_keys" - end - - it "should raise a ParseError if there is less than 1 arguments" do - lambda { scope.function_keys([]) }.should( raise_error(Puppet::ParseError)) - end - - it "should return an array of keys when given a hash" do - result = scope.function_keys([{'a'=>1, 'b'=>2}]) - # =~ performs 'array with same elements' (set) matching - # For more info see RSpec::Matchers::MatchArray - result.should =~ ['a','b'] - end -end diff --git a/custom_zulip_files/puppet/stdlib/spec/unit/puppet/parser/functions/lstrip_spec.rb b/custom_zulip_files/puppet/stdlib/spec/unit/puppet/parser/functions/lstrip_spec.rb deleted file mode 100644 index b280ae7..0000000 --- a/custom_zulip_files/puppet/stdlib/spec/unit/puppet/parser/functions/lstrip_spec.rb +++ /dev/null @@ -1,19 +0,0 @@ -#! /usr/bin/env ruby -S rspec -require 'spec_helper' - -describe "the lstrip function" do - let(:scope) { PuppetlabsSpec::PuppetInternals.scope } - - it "should exist" do - Puppet::Parser::Functions.function("lstrip").should == "function_lstrip" - end - - it "should raise a ParseError if there is less than 1 arguments" do - lambda { scope.function_lstrip([]) }.should( raise_error(Puppet::ParseError)) - end - - it "should lstrip a string" do - result = scope.function_lstrip([" asdf"]) - result.should(eq('asdf')) - end -end diff --git a/custom_zulip_files/puppet/stdlib/spec/unit/puppet/parser/functions/max_spec.rb b/custom_zulip_files/puppet/stdlib/spec/unit/puppet/parser/functions/max_spec.rb deleted file mode 100755 index ff6f2b3..0000000 --- a/custom_zulip_files/puppet/stdlib/spec/unit/puppet/parser/functions/max_spec.rb +++ /dev/null @@ -1,27 +0,0 @@ -#! /usr/bin/env ruby -S rspec - -require 'spec_helper' - -describe "the max function" do - let(:scope) { PuppetlabsSpec::PuppetInternals.scope } - - it "should exist" do - Puppet::Parser::Functions.function("max").should == "function_max" - end - - it "should raise a ParseError if there is less than 1 arguments" do - lambda { scope.function_max([]) }.should( raise_error(Puppet::ParseError)) - end - - it "should be able to compare strings" do - scope.function_max(["albatross","dog","horse"]).should(eq("horse")) - end - - it "should be able to compare numbers" do - scope.function_max([6,8,4]).should(eq(8)) - end - - it "should be able to compare a number with a stringified number" do - scope.function_max([1,"2"]).should(eq("2")) - end -end diff --git a/custom_zulip_files/puppet/stdlib/spec/unit/puppet/parser/functions/member_spec.rb b/custom_zulip_files/puppet/stdlib/spec/unit/puppet/parser/functions/member_spec.rb deleted file mode 100644 index 6e9a023..0000000 --- a/custom_zulip_files/puppet/stdlib/spec/unit/puppet/parser/functions/member_spec.rb +++ /dev/null @@ -1,24 +0,0 @@ -#! /usr/bin/env ruby -S rspec -require 'spec_helper' - -describe "the member function" do - let(:scope) { PuppetlabsSpec::PuppetInternals.scope } - - it "should exist" do - Puppet::Parser::Functions.function("member").should == "function_member" - end - - it "should raise a ParseError if there is less than 1 arguments" do - lambda { scope.function_member([]) }.should( raise_error(Puppet::ParseError)) - end - - it "should return true if a member is in an array" do - result = scope.function_member([["a","b","c"], "a"]) - result.should(eq(true)) - end - - it "should return false if a member is not in an array" do - result = scope.function_member([["a","b","c"], "d"]) - result.should(eq(false)) - end -end diff --git a/custom_zulip_files/puppet/stdlib/spec/unit/puppet/parser/functions/merge_spec.rb b/custom_zulip_files/puppet/stdlib/spec/unit/puppet/parser/functions/merge_spec.rb deleted file mode 100644 index 04169e7..0000000 --- a/custom_zulip_files/puppet/stdlib/spec/unit/puppet/parser/functions/merge_spec.rb +++ /dev/null @@ -1,47 +0,0 @@ -#! /usr/bin/env ruby -S rspec - -require 'spec_helper' - -describe Puppet::Parser::Functions.function(:merge) do - let(:scope) { PuppetlabsSpec::PuppetInternals.scope } - - describe 'when calling merge from puppet' do - it "should not compile when no arguments are passed" do - pending("Fails on 2.6.x, see bug #15912") if Puppet.version =~ /^2\.6\./ - Puppet[:code] = '$x = merge()' - expect { - scope.compiler.compile - }.to raise_error(Puppet::ParseError, /wrong number of arguments/) - end - - it "should not compile when 1 argument is passed" do - pending("Fails on 2.6.x, see bug #15912") if Puppet.version =~ /^2\.6\./ - Puppet[:code] = "$my_hash={'one' => 1}\n$x = merge($my_hash)" - expect { - scope.compiler.compile - }.to raise_error(Puppet::ParseError, /wrong number of arguments/) - end - end - - describe 'when calling merge on the scope instance' do - it 'should require all parameters are hashes' do - expect { new_hash = scope.function_merge([{}, '2'])}.to raise_error(Puppet::ParseError, /unexpected argument type String/) - end - - it 'should be able to merge two hashes' do - new_hash = scope.function_merge([{'one' => '1', 'two' => '1'}, {'two' => '2', 'three' => '2'}]) - new_hash['one'].should == '1' - new_hash['two'].should == '2' - new_hash['three'].should == '2' - end - - it 'should merge multiple hashes' do - hash = scope.function_merge([{'one' => 1}, {'one' => '2'}, {'one' => '3'}]) - hash['one'].should == '3' - end - - it 'should accept empty hashes' do - scope.function_merge([{},{},{}]).should == {} - end - end -end diff --git a/custom_zulip_files/puppet/stdlib/spec/unit/puppet/parser/functions/min_spec.rb b/custom_zulip_files/puppet/stdlib/spec/unit/puppet/parser/functions/min_spec.rb deleted file mode 100755 index 71d593e..0000000 --- a/custom_zulip_files/puppet/stdlib/spec/unit/puppet/parser/functions/min_spec.rb +++ /dev/null @@ -1,27 +0,0 @@ -#! /usr/bin/env ruby -S rspec - -require 'spec_helper' - -describe "the min function" do - let(:scope) { PuppetlabsSpec::PuppetInternals.scope } - - it "should exist" do - Puppet::Parser::Functions.function("min").should == "function_min" - end - - it "should raise a ParseError if there is less than 1 arguments" do - lambda { scope.function_min([]) }.should( raise_error(Puppet::ParseError)) - end - - it "should be able to compare strings" do - scope.function_min(["albatross","dog","horse"]).should(eq("albatross")) - end - - it "should be able to compare numbers" do - scope.function_min([6,8,4]).should(eq(4)) - end - - it "should be able to compare a number with a stringified number" do - scope.function_min([1,"2"]).should(eq(1)) - end -end diff --git a/custom_zulip_files/puppet/stdlib/spec/unit/puppet/parser/functions/num2bool_spec.rb b/custom_zulip_files/puppet/stdlib/spec/unit/puppet/parser/functions/num2bool_spec.rb deleted file mode 100644 index b56196d..0000000 --- a/custom_zulip_files/puppet/stdlib/spec/unit/puppet/parser/functions/num2bool_spec.rb +++ /dev/null @@ -1,67 +0,0 @@ -#! /usr/bin/env ruby -S rspec -require 'spec_helper' - -describe "the num2bool function" do - let(:scope) { PuppetlabsSpec::PuppetInternals.scope } - - it "should exist" do - Puppet::Parser::Functions.function("num2bool").should == "function_num2bool" - end - - it "should raise a ParseError if there are no arguments" do - lambda { scope.function_num2bool([]) }.should( raise_error(Puppet::ParseError)) - end - - it "should raise a ParseError if there are more than 1 arguments" do - lambda { scope.function_num2bool(["foo","bar"]) }.should( raise_error(Puppet::ParseError)) - end - - it "should raise a ParseError if passed something non-numeric" do - lambda { scope.function_num2bool(["xyzzy"]) }.should( raise_error(Puppet::ParseError)) - end - - it "should return true if passed string 1" do - result = scope.function_num2bool(["1"]) - result.should(be_true) - end - - it "should return true if passed string 1.5" do - result = scope.function_num2bool(["1.5"]) - result.should(be_true) - end - - it "should return true if passed number 1" do - result = scope.function_num2bool([1]) - result.should(be_true) - end - - it "should return false if passed string 0" do - result = scope.function_num2bool(["0"]) - result.should(be_false) - end - - it "should return false if passed number 0" do - result = scope.function_num2bool([0]) - result.should(be_false) - end - - it "should return false if passed string -1" do - result = scope.function_num2bool(["-1"]) - result.should(be_false) - end - - it "should return false if passed string -1.5" do - result = scope.function_num2bool(["-1.5"]) - result.should(be_false) - end - - it "should return false if passed number -1" do - result = scope.function_num2bool([-1]) - result.should(be_false) - end - - it "should return false if passed float -1.5" do - result = scope.function_num2bool([-1.5]) - result.should(be_false) - end -end diff --git a/custom_zulip_files/puppet/stdlib/spec/unit/puppet/parser/functions/parsejson_spec.rb b/custom_zulip_files/puppet/stdlib/spec/unit/puppet/parser/functions/parsejson_spec.rb deleted file mode 100644 index f179ac1..0000000 --- a/custom_zulip_files/puppet/stdlib/spec/unit/puppet/parser/functions/parsejson_spec.rb +++ /dev/null @@ -1,22 +0,0 @@ -#! /usr/bin/env ruby -S rspec -require 'spec_helper' - -describe "the parsejson function" do - let(:scope) { PuppetlabsSpec::PuppetInternals.scope } - - it "should exist" do - Puppet::Parser::Functions.function("parsejson").should == "function_parsejson" - end - - it "should raise a ParseError if there is less than 1 arguments" do - lambda { scope.function_parsejson([]) }.should( raise_error(Puppet::ParseError)) - end - - it "should convert JSON to a data structure" do - json = <<-EOS -["aaa","bbb","ccc"] -EOS - result = scope.function_parsejson([json]) - result.should(eq(['aaa','bbb','ccc'])) - end -end diff --git a/custom_zulip_files/puppet/stdlib/spec/unit/puppet/parser/functions/parseyaml_spec.rb b/custom_zulip_files/puppet/stdlib/spec/unit/puppet/parser/functions/parseyaml_spec.rb deleted file mode 100644 index 0c7aea8..0000000 --- a/custom_zulip_files/puppet/stdlib/spec/unit/puppet/parser/functions/parseyaml_spec.rb +++ /dev/null @@ -1,24 +0,0 @@ -#! /usr/bin/env ruby -S rspec -require 'spec_helper' - -describe "the parseyaml function" do - let(:scope) { PuppetlabsSpec::PuppetInternals.scope } - - it "should exist" do - Puppet::Parser::Functions.function("parseyaml").should == "function_parseyaml" - end - - it "should raise a ParseError if there is less than 1 arguments" do - lambda { scope.function_parseyaml([]) }.should( raise_error(Puppet::ParseError)) - end - - it "should convert YAML to a data structure" do - yaml = <<-EOS -- aaa -- bbb -- ccc -EOS - result = scope.function_parseyaml([yaml]) - result.should(eq(['aaa','bbb','ccc'])) - end -end diff --git a/custom_zulip_files/puppet/stdlib/spec/unit/puppet/parser/functions/pick_spec.rb b/custom_zulip_files/puppet/stdlib/spec/unit/puppet/parser/functions/pick_spec.rb deleted file mode 100644 index 761db6b..0000000 --- a/custom_zulip_files/puppet/stdlib/spec/unit/puppet/parser/functions/pick_spec.rb +++ /dev/null @@ -1,34 +0,0 @@ -#!/usr/bin/env ruby -S rspec -require 'spec_helper' - -describe "the pick function" do - let(:scope) { PuppetlabsSpec::PuppetInternals.scope } - - it "should exist" do - Puppet::Parser::Functions.function("pick").should == "function_pick" - end - - it 'should return the correct value' do - scope.function_pick(['first', 'second']).should == 'first' - end - - it 'should return the correct value if the first value is empty' do - scope.function_pick(['', 'second']).should == 'second' - end - - it 'should remove empty string values' do - scope.function_pick(['', 'first']).should == 'first' - end - - it 'should remove :undef values' do - scope.function_pick([:undef, 'first']).should == 'first' - end - - it 'should remove :undefined values' do - scope.function_pick([:undefined, 'first']).should == 'first' - end - - it 'should error if no values are passed' do - expect { scope.function_pick([]) }.to raise_error(Puppet::Error, /Must provide non empty value./) - end -end diff --git a/custom_zulip_files/puppet/stdlib/spec/unit/puppet/parser/functions/prefix_spec.rb b/custom_zulip_files/puppet/stdlib/spec/unit/puppet/parser/functions/prefix_spec.rb deleted file mode 100644 index 5cf592b..0000000 --- a/custom_zulip_files/puppet/stdlib/spec/unit/puppet/parser/functions/prefix_spec.rb +++ /dev/null @@ -1,19 +0,0 @@ -#! /usr/bin/env ruby -S rspec -require 'spec_helper' - -describe "the prefix function" do - let(:scope) { PuppetlabsSpec::PuppetInternals.scope } - - it "should exist" do - Puppet::Parser::Functions.function("prefix").should == "function_prefix" - end - - it "should raise a ParseError if there is less than 1 arguments" do - lambda { scope.function_prefix([]) }.should( raise_error(Puppet::ParseError)) - end - - it "should return a prefixed array" do - result = scope.function_prefix([['a','b','c'], 'p']) - result.should(eq(['pa','pb','pc'])) - end -end diff --git a/custom_zulip_files/puppet/stdlib/spec/unit/puppet/parser/functions/range_spec.rb b/custom_zulip_files/puppet/stdlib/spec/unit/puppet/parser/functions/range_spec.rb deleted file mode 100644 index 42751f4..0000000 --- a/custom_zulip_files/puppet/stdlib/spec/unit/puppet/parser/functions/range_spec.rb +++ /dev/null @@ -1,34 +0,0 @@ -#! /usr/bin/env ruby -S rspec -require 'spec_helper' - -describe "the range function" do - let(:scope) { PuppetlabsSpec::PuppetInternals.scope } - - it "should exist" do - Puppet::Parser::Functions.function("range").should == "function_range" - end - - it "should raise a ParseError if there is less than 1 arguments" do - lambda { scope.function_range([]) }.should( raise_error(Puppet::ParseError)) - end - - it "should return a letter range" do - result = scope.function_range(["a","d"]) - result.should(eq(['a','b','c','d'])) - end - - it "should return a number range" do - result = scope.function_range(["1","4"]) - result.should(eq([1,2,3,4])) - end - - it "should work with padded hostname like strings" do - expected = ("host01".."host10").to_a - scope.function_range(["host01","host10"]).should eq expected - end - - it "should coerce zero padded digits to integers" do - expected = (0..10).to_a - scope.function_range(["00", "10"]).should eq expected - end -end diff --git a/custom_zulip_files/puppet/stdlib/spec/unit/puppet/parser/functions/reject_spec.rb b/custom_zulip_files/puppet/stdlib/spec/unit/puppet/parser/functions/reject_spec.rb deleted file mode 100755 index f2cb741..0000000 --- a/custom_zulip_files/puppet/stdlib/spec/unit/puppet/parser/functions/reject_spec.rb +++ /dev/null @@ -1,20 +0,0 @@ -#!/usr/bin/env ruby - -require 'spec_helper' - -describe "the reject function" do - let(:scope) { PuppetlabsSpec::PuppetInternals.scope } - - it "should exist" do - Puppet::Parser::Functions.function("reject").should == "function_reject" - end - - it "should raise a ParseError if there is less than 1 arguments" do - lambda { scope.function_reject([]) }.should( raise_error(Puppet::ParseError)) - end - - it "should reject contents from an array" do - result = scope.function_reject([["1111", "aaabbb","bbbccc","dddeee"], "bbb"]) - result.should(eq(["1111", "dddeee"])) - end -end diff --git a/custom_zulip_files/puppet/stdlib/spec/unit/puppet/parser/functions/reverse_spec.rb b/custom_zulip_files/puppet/stdlib/spec/unit/puppet/parser/functions/reverse_spec.rb deleted file mode 100644 index 1b59206..0000000 --- a/custom_zulip_files/puppet/stdlib/spec/unit/puppet/parser/functions/reverse_spec.rb +++ /dev/null @@ -1,19 +0,0 @@ -#! /usr/bin/env ruby -S rspec -require 'spec_helper' - -describe "the reverse function" do - let(:scope) { PuppetlabsSpec::PuppetInternals.scope } - - it "should exist" do - Puppet::Parser::Functions.function("reverse").should == "function_reverse" - end - - it "should raise a ParseError if there is less than 1 arguments" do - lambda { scope.function_reverse([]) }.should( raise_error(Puppet::ParseError)) - end - - it "should reverse a string" do - result = scope.function_reverse(["asdfghijkl"]) - result.should(eq('lkjihgfdsa')) - end -end diff --git a/custom_zulip_files/puppet/stdlib/spec/unit/puppet/parser/functions/rstrip_spec.rb b/custom_zulip_files/puppet/stdlib/spec/unit/puppet/parser/functions/rstrip_spec.rb deleted file mode 100644 index d90de1d..0000000 --- a/custom_zulip_files/puppet/stdlib/spec/unit/puppet/parser/functions/rstrip_spec.rb +++ /dev/null @@ -1,24 +0,0 @@ -#! /usr/bin/env ruby -S rspec -require 'spec_helper' - -describe "the rstrip function" do - let(:scope) { PuppetlabsSpec::PuppetInternals.scope } - - it "should exist" do - Puppet::Parser::Functions.function("rstrip").should == "function_rstrip" - end - - it "should raise a ParseError if there is less than 1 arguments" do - lambda { scope.function_rstrip([]) }.should( raise_error(Puppet::ParseError)) - end - - it "should rstrip a string" do - result = scope.function_rstrip(["asdf "]) - result.should(eq('asdf')) - end - - it "should rstrip each element in an array" do - result = scope.function_rstrip([["a ","b ", "c "]]) - result.should(eq(['a','b','c'])) - end -end diff --git a/custom_zulip_files/puppet/stdlib/spec/unit/puppet/parser/functions/shuffle_spec.rb b/custom_zulip_files/puppet/stdlib/spec/unit/puppet/parser/functions/shuffle_spec.rb deleted file mode 100644 index 93346d5..0000000 --- a/custom_zulip_files/puppet/stdlib/spec/unit/puppet/parser/functions/shuffle_spec.rb +++ /dev/null @@ -1,24 +0,0 @@ -#! /usr/bin/env ruby -S rspec -require 'spec_helper' - -describe "the shuffle function" do - let(:scope) { PuppetlabsSpec::PuppetInternals.scope } - - it "should exist" do - Puppet::Parser::Functions.function("shuffle").should == "function_shuffle" - end - - it "should raise a ParseError if there is less than 1 arguments" do - lambda { scope.function_shuffle([]) }.should( raise_error(Puppet::ParseError)) - end - - it "should shuffle a string and the result should be the same size" do - result = scope.function_shuffle(["asdf"]) - result.size.should(eq(4)) - end - - it "should shuffle a string but the sorted contents should still be the same" do - result = scope.function_shuffle(["adfs"]) - result.split("").sort.join("").should(eq("adfs")) - end -end diff --git a/custom_zulip_files/puppet/stdlib/spec/unit/puppet/parser/functions/size_spec.rb b/custom_zulip_files/puppet/stdlib/spec/unit/puppet/parser/functions/size_spec.rb deleted file mode 100644 index b1c435a..0000000 --- a/custom_zulip_files/puppet/stdlib/spec/unit/puppet/parser/functions/size_spec.rb +++ /dev/null @@ -1,24 +0,0 @@ -#! /usr/bin/env ruby -S rspec -require 'spec_helper' - -describe "the size function" do - let(:scope) { PuppetlabsSpec::PuppetInternals.scope } - - it "should exist" do - Puppet::Parser::Functions.function("size").should == "function_size" - end - - it "should raise a ParseError if there is less than 1 arguments" do - lambda { scope.function_size([]) }.should( raise_error(Puppet::ParseError)) - end - - it "should return the size of a string" do - result = scope.function_size(["asdf"]) - result.should(eq(4)) - end - - it "should return the size of an array" do - result = scope.function_size([["a","b","c"]]) - result.should(eq(3)) - end -end diff --git a/custom_zulip_files/puppet/stdlib/spec/unit/puppet/parser/functions/sort_spec.rb b/custom_zulip_files/puppet/stdlib/spec/unit/puppet/parser/functions/sort_spec.rb deleted file mode 100644 index 3187a5a..0000000 --- a/custom_zulip_files/puppet/stdlib/spec/unit/puppet/parser/functions/sort_spec.rb +++ /dev/null @@ -1,24 +0,0 @@ -#! /usr/bin/env ruby -S rspec -require 'spec_helper' - -describe "the sort function" do - let(:scope) { PuppetlabsSpec::PuppetInternals.scope } - - it "should exist" do - Puppet::Parser::Functions.function("sort").should == "function_sort" - end - - it "should raise a ParseError if there is not 1 arguments" do - lambda { scope.function_sort(['','']) }.should( raise_error(Puppet::ParseError)) - end - - it "should sort an array" do - result = scope.function_sort([["a","c","b"]]) - result.should(eq(['a','b','c'])) - end - - it "should sort a string" do - result = scope.function_sort(["acb"]) - result.should(eq('abc')) - end -end diff --git a/custom_zulip_files/puppet/stdlib/spec/unit/puppet/parser/functions/squeeze_spec.rb b/custom_zulip_files/puppet/stdlib/spec/unit/puppet/parser/functions/squeeze_spec.rb deleted file mode 100644 index 60e5a30..0000000 --- a/custom_zulip_files/puppet/stdlib/spec/unit/puppet/parser/functions/squeeze_spec.rb +++ /dev/null @@ -1,24 +0,0 @@ -#! /usr/bin/env ruby -S rspec -require 'spec_helper' - -describe "the squeeze function" do - let(:scope) { PuppetlabsSpec::PuppetInternals.scope } - - it "should exist" do - Puppet::Parser::Functions.function("squeeze").should == "function_squeeze" - end - - it "should raise a ParseError if there is less than 2 arguments" do - lambda { scope.function_squeeze([]) }.should( raise_error(Puppet::ParseError)) - end - - it "should squeeze a string" do - result = scope.function_squeeze(["aaabbbbcccc"]) - result.should(eq('abc')) - end - - it "should squeeze all elements in an array" do - result = scope.function_squeeze([["aaabbbbcccc","dddfff"]]) - result.should(eq(['abc','df'])) - end -end diff --git a/custom_zulip_files/puppet/stdlib/spec/unit/puppet/parser/functions/str2bool_spec.rb b/custom_zulip_files/puppet/stdlib/spec/unit/puppet/parser/functions/str2bool_spec.rb deleted file mode 100644 index ef6350f..0000000 --- a/custom_zulip_files/puppet/stdlib/spec/unit/puppet/parser/functions/str2bool_spec.rb +++ /dev/null @@ -1,31 +0,0 @@ -#! /usr/bin/env ruby -S rspec -require 'spec_helper' - -describe "the str2bool function" do - let(:scope) { PuppetlabsSpec::PuppetInternals.scope } - - it "should exist" do - Puppet::Parser::Functions.function("str2bool").should == "function_str2bool" - end - - it "should raise a ParseError if there is less than 1 arguments" do - lambda { scope.function_str2bool([]) }.should( raise_error(Puppet::ParseError)) - end - - it "should convert string 'true' to true" do - result = scope.function_str2bool(["true"]) - result.should(eq(true)) - end - - it "should convert string 'undef' to false" do - result = scope.function_str2bool(["undef"]) - result.should(eq(false)) - end - - it "should return the boolean it was called with" do - result = scope.function_str2bool([true]) - result.should(eq(true)) - result = scope.function_str2bool([false]) - result.should(eq(false)) - end -end diff --git a/custom_zulip_files/puppet/stdlib/spec/unit/puppet/parser/functions/str2saltedsha512_spec.rb b/custom_zulip_files/puppet/stdlib/spec/unit/puppet/parser/functions/str2saltedsha512_spec.rb deleted file mode 100644 index df8fb8e..0000000 --- a/custom_zulip_files/puppet/stdlib/spec/unit/puppet/parser/functions/str2saltedsha512_spec.rb +++ /dev/null @@ -1,45 +0,0 @@ -#! /usr/bin/env ruby -S rspec -require 'spec_helper' - -describe "the str2saltedsha512 function" do - let(:scope) { PuppetlabsSpec::PuppetInternals.scope } - - it "should exist" do - Puppet::Parser::Functions.function("str2saltedsha512").should == "function_str2saltedsha512" - end - - it "should raise a ParseError if there is less than 1 argument" do - expect { scope.function_str2saltedsha512([]) }.to( raise_error(Puppet::ParseError) ) - end - - it "should raise a ParseError if there is more than 1 argument" do - expect { scope.function_str2saltedsha512(['foo', 'bar', 'baz']) }.to( raise_error(Puppet::ParseError) ) - end - - it "should return a salted-sha512 password hash 136 characters in length" do - result = scope.function_str2saltedsha512(["password"]) - result.length.should(eq(136)) - end - - it "should raise an error if you pass a non-string password" do - expect { scope.function_str2saltedsha512([1234]) }.to( raise_error(Puppet::ParseError) ) - end - - it "should generate a valid password" do - # Allow the function to generate a password based on the string 'password' - password_hash = scope.function_str2saltedsha512(["password"]) - - # Separate the Salt and Password from the Password Hash - salt = password_hash[0..7] - password = password_hash[8..-1] - - # Convert the Salt and Password from Hex to Binary Data - str_salt = Array(salt.lines).pack('H*') - str_password = Array(password.lines).pack('H*') - - # Combine the Binary Salt with 'password' and compare the end result - saltedpass = Digest::SHA512.digest(str_salt + 'password') - result = (str_salt + saltedpass).unpack('H*')[0] - result.should == password_hash - end -end diff --git a/custom_zulip_files/puppet/stdlib/spec/unit/puppet/parser/functions/strftime_spec.rb b/custom_zulip_files/puppet/stdlib/spec/unit/puppet/parser/functions/strftime_spec.rb deleted file mode 100644 index df42b6f..0000000 --- a/custom_zulip_files/puppet/stdlib/spec/unit/puppet/parser/functions/strftime_spec.rb +++ /dev/null @@ -1,29 +0,0 @@ -#! /usr/bin/env ruby -S rspec -require 'spec_helper' - -describe "the strftime function" do - let(:scope) { PuppetlabsSpec::PuppetInternals.scope } - - it "should exist" do - Puppet::Parser::Functions.function("strftime").should == "function_strftime" - end - - it "should raise a ParseError if there is less than 1 arguments" do - lambda { scope.function_strftime([]) }.should( raise_error(Puppet::ParseError)) - end - - it "using %s should be higher then when I wrote this test" do - result = scope.function_strftime(["%s"]) - result.to_i.should(be > 1311953157) - end - - it "using %s should be lower then 1.5 trillion" do - result = scope.function_strftime(["%s"]) - result.to_i.should(be < 1500000000) - end - - it "should return a date when given %Y-%m-%d" do - result = scope.function_strftime(["%Y-%m-%d"]) - result.should =~ /^\d{4}-\d{2}-\d{2}$/ - end -end diff --git a/custom_zulip_files/puppet/stdlib/spec/unit/puppet/parser/functions/strip_spec.rb b/custom_zulip_files/puppet/stdlib/spec/unit/puppet/parser/functions/strip_spec.rb deleted file mode 100644 index fccdd26..0000000 --- a/custom_zulip_files/puppet/stdlib/spec/unit/puppet/parser/functions/strip_spec.rb +++ /dev/null @@ -1,18 +0,0 @@ -#! /usr/bin/env ruby -S rspec -require 'spec_helper' - -describe "the strip function" do - let(:scope) { PuppetlabsSpec::PuppetInternals.scope } - it "should exist" do - Puppet::Parser::Functions.function("strip").should == "function_strip" - end - - it "should raise a ParseError if there is less than 1 arguments" do - lambda { scope.function_strip([]) }.should( raise_error(Puppet::ParseError)) - end - - it "should strip a string" do - result = scope.function_strip([" ab cd "]) - result.should(eq('ab cd')) - end -end diff --git a/custom_zulip_files/puppet/stdlib/spec/unit/puppet/parser/functions/suffix_spec.rb b/custom_zulip_files/puppet/stdlib/spec/unit/puppet/parser/functions/suffix_spec.rb deleted file mode 100644 index c28f719..0000000 --- a/custom_zulip_files/puppet/stdlib/spec/unit/puppet/parser/functions/suffix_spec.rb +++ /dev/null @@ -1,19 +0,0 @@ -#! /usr/bin/env ruby -S rspec -require 'spec_helper' - -describe "the suffix function" do - let(:scope) { PuppetlabsSpec::PuppetInternals.scope } - - it "should exist" do - Puppet::Parser::Functions.function("suffix").should == "function_suffix" - end - - it "should raise a ParseError if there is less than 1 arguments" do - lambda { scope.function_suffix([]) }.should( raise_error(Puppet::ParseError)) - end - - it "should return a suffixed array" do - result = scope.function_suffix([['a','b','c'], 'p']) - result.should(eq(['ap','bp','cp'])) - end -end diff --git a/custom_zulip_files/puppet/stdlib/spec/unit/puppet/parser/functions/swapcase_spec.rb b/custom_zulip_files/puppet/stdlib/spec/unit/puppet/parser/functions/swapcase_spec.rb deleted file mode 100644 index 808b415..0000000 --- a/custom_zulip_files/puppet/stdlib/spec/unit/puppet/parser/functions/swapcase_spec.rb +++ /dev/null @@ -1,19 +0,0 @@ -#! /usr/bin/env ruby -S rspec -require 'spec_helper' - -describe "the swapcase function" do - let(:scope) { PuppetlabsSpec::PuppetInternals.scope } - - it "should exist" do - Puppet::Parser::Functions.function("swapcase").should == "function_swapcase" - end - - it "should raise a ParseError if there is less than 1 arguments" do - lambda { scope.function_swapcase([]) }.should( raise_error(Puppet::ParseError)) - end - - it "should swapcase a string" do - result = scope.function_swapcase(["aaBBccDD"]) - result.should(eq('AAbbCCdd')) - end -end diff --git a/custom_zulip_files/puppet/stdlib/spec/unit/puppet/parser/functions/time_spec.rb b/custom_zulip_files/puppet/stdlib/spec/unit/puppet/parser/functions/time_spec.rb deleted file mode 100644 index e9fb76e..0000000 --- a/custom_zulip_files/puppet/stdlib/spec/unit/puppet/parser/functions/time_spec.rb +++ /dev/null @@ -1,29 +0,0 @@ -#! /usr/bin/env ruby -S rspec -require 'spec_helper' - -describe "the time function" do - let(:scope) { PuppetlabsSpec::PuppetInternals.scope } - - it "should exist" do - Puppet::Parser::Functions.function("time").should == "function_time" - end - - it "should raise a ParseError if there is more than 2 arguments" do - lambda { scope.function_time(['','']) }.should( raise_error(Puppet::ParseError)) - end - - it "should return a number" do - result = scope.function_time([]) - result.should be_an(Integer) - end - - it "should be higher then when I wrote this test" do - result = scope.function_time([]) - result.should(be > 1311953157) - end - - it "should be lower then 1.5 trillion" do - result = scope.function_time([]) - result.should(be < 1500000000) - end -end diff --git a/custom_zulip_files/puppet/stdlib/spec/unit/puppet/parser/functions/to_bytes_spec.rb b/custom_zulip_files/puppet/stdlib/spec/unit/puppet/parser/functions/to_bytes_spec.rb deleted file mode 100755 index d1ea4c8..0000000 --- a/custom_zulip_files/puppet/stdlib/spec/unit/puppet/parser/functions/to_bytes_spec.rb +++ /dev/null @@ -1,58 +0,0 @@ -#! /usr/bin/env ruby -S rspec - -require 'spec_helper' - -describe "the to_bytes function" do - let(:scope) { PuppetlabsSpec::PuppetInternals.scope } - - it "should exist" do - Puppet::Parser::Functions.function("to_bytes").should == "function_to_bytes" - end - - it "should raise a ParseError if there is less than 1 arguments" do - lambda { scope.function_to_bytes([]) }.should( raise_error(Puppet::ParseError)) - end - - it "should convert kB to B" do - result = scope.function_to_bytes(["4 kB"]) - result.should(eq(4096)) - end - - it "should work without B in unit" do - result = scope.function_to_bytes(["4 k"]) - result.should(eq(4096)) - end - - it "should work without a space before unit" do - result = scope.function_to_bytes(["4k"]) - result.should(eq(4096)) - end - - it "should work without a unit" do - result = scope.function_to_bytes(["5678"]) - result.should(eq(5678)) - end - - it "should convert fractions" do - result = scope.function_to_bytes(["1.5 kB"]) - result.should(eq(1536)) - end - - it "should convert scientific notation" do - result = scope.function_to_bytes(["1.5e2 B"]) - result.should(eq(150)) - end - - it "should do nothing with a positive number" do - result = scope.function_to_bytes([5678]) - result.should(eq(5678)) - end - - it "should should raise a ParseError if input isn't a number" do - lambda { scope.function_to_bytes(["foo"]) }.should( raise_error(Puppet::ParseError)) - end - - it "should should raise a ParseError if prefix is unknown" do - lambda { scope.function_to_bytes(["5 uB"]) }.should( raise_error(Puppet::ParseError)) - end -end diff --git a/custom_zulip_files/puppet/stdlib/spec/unit/puppet/parser/functions/type_spec.rb b/custom_zulip_files/puppet/stdlib/spec/unit/puppet/parser/functions/type_spec.rb deleted file mode 100644 index 8fec88f..0000000 --- a/custom_zulip_files/puppet/stdlib/spec/unit/puppet/parser/functions/type_spec.rb +++ /dev/null @@ -1,43 +0,0 @@ -#! /usr/bin/env ruby -S rspec -require 'spec_helper' - -describe "the type function" do - let(:scope) { PuppetlabsSpec::PuppetInternals.scope } - it "should exist" do - Puppet::Parser::Functions.function("type").should == "function_type" - end - - it "should raise a ParseError if there is less than 1 arguments" do - lambda { scope.function_type([]) }.should( raise_error(Puppet::ParseError)) - end - - it "should return string when given a string" do - result = scope.function_type(["aaabbbbcccc"]) - result.should(eq('string')) - end - - it "should return array when given an array" do - result = scope.function_type([["aaabbbbcccc","asdf"]]) - result.should(eq('array')) - end - - it "should return hash when given a hash" do - result = scope.function_type([{"a"=>1,"b"=>2}]) - result.should(eq('hash')) - end - - it "should return integer when given an integer" do - result = scope.function_type(["1"]) - result.should(eq('integer')) - end - - it "should return float when given a float" do - result = scope.function_type(["1.34"]) - result.should(eq('float')) - end - - it "should return boolean when given a boolean" do - result = scope.function_type([true]) - result.should(eq('boolean')) - end -end diff --git a/custom_zulip_files/puppet/stdlib/spec/unit/puppet/parser/functions/unique_spec.rb b/custom_zulip_files/puppet/stdlib/spec/unit/puppet/parser/functions/unique_spec.rb deleted file mode 100644 index 5d48d49..0000000 --- a/custom_zulip_files/puppet/stdlib/spec/unit/puppet/parser/functions/unique_spec.rb +++ /dev/null @@ -1,24 +0,0 @@ -#! /usr/bin/env ruby -S rspec -require 'spec_helper' - -describe "the unique function" do - let(:scope) { PuppetlabsSpec::PuppetInternals.scope } - - it "should exist" do - Puppet::Parser::Functions.function("unique").should == "function_unique" - end - - it "should raise a ParseError if there is less than 1 arguments" do - lambda { scope.function_unique([]) }.should( raise_error(Puppet::ParseError)) - end - - it "should remove duplicate elements in a string" do - result = scope.function_unique(["aabbc"]) - result.should(eq('abc')) - end - - it "should remove duplicate elements in an array" do - result = scope.function_unique([["a","a","b","b","c"]]) - result.should(eq(['a','b','c'])) - end -end diff --git a/custom_zulip_files/puppet/stdlib/spec/unit/puppet/parser/functions/upcase_spec.rb b/custom_zulip_files/puppet/stdlib/spec/unit/puppet/parser/functions/upcase_spec.rb deleted file mode 100644 index 5db5513..0000000 --- a/custom_zulip_files/puppet/stdlib/spec/unit/puppet/parser/functions/upcase_spec.rb +++ /dev/null @@ -1,24 +0,0 @@ -#! /usr/bin/env ruby -S rspec -require 'spec_helper' - -describe "the upcase function" do - let(:scope) { PuppetlabsSpec::PuppetInternals.scope } - - it "should exist" do - Puppet::Parser::Functions.function("upcase").should == "function_upcase" - end - - it "should raise a ParseError if there is less than 1 arguments" do - lambda { scope.function_upcase([]) }.should( raise_error(Puppet::ParseError)) - end - - it "should upcase a string" do - result = scope.function_upcase(["abc"]) - result.should(eq('ABC')) - end - - it "should do nothing if a string is already upcase" do - result = scope.function_upcase(["ABC"]) - result.should(eq('ABC')) - end -end diff --git a/custom_zulip_files/puppet/stdlib/spec/unit/puppet/parser/functions/uriescape_spec.rb b/custom_zulip_files/puppet/stdlib/spec/unit/puppet/parser/functions/uriescape_spec.rb deleted file mode 100644 index 371de46..0000000 --- a/custom_zulip_files/puppet/stdlib/spec/unit/puppet/parser/functions/uriescape_spec.rb +++ /dev/null @@ -1,24 +0,0 @@ -#! /usr/bin/env ruby -S rspec -require 'spec_helper' - -describe "the uriescape function" do - let(:scope) { PuppetlabsSpec::PuppetInternals.scope } - - it "should exist" do - Puppet::Parser::Functions.function("uriescape").should == "function_uriescape" - end - - it "should raise a ParseError if there is less than 1 arguments" do - lambda { scope.function_uriescape([]) }.should( raise_error(Puppet::ParseError)) - end - - it "should uriescape a string" do - result = scope.function_uriescape([":/?#[]@!$&'()*+,;= "]) - result.should(eq('%3A%2F%3F%23%5B%5D%40%21%24%26%27%28%29%2A%2B%2C%3B%3D%20')) - end - - it "should do nothing if a string is already safe" do - result = scope.function_uriescape(["ABCdef"]) - result.should(eq('ABCdef')) - end -end diff --git a/custom_zulip_files/puppet/stdlib/spec/unit/puppet/parser/functions/validate_absolute_path_spec.rb b/custom_zulip_files/puppet/stdlib/spec/unit/puppet/parser/functions/validate_absolute_path_spec.rb deleted file mode 100644 index 08aaf78..0000000 --- a/custom_zulip_files/puppet/stdlib/spec/unit/puppet/parser/functions/validate_absolute_path_spec.rb +++ /dev/null @@ -1,83 +0,0 @@ -require 'spec_helper' - -describe Puppet::Parser::Functions.function(:validate_absolute_path) do - let(:scope) { PuppetlabsSpec::PuppetInternals.scope } - - # The subject of these examples is the method itself. - subject do - # This makes sure the function is loaded within each test - function_name = Puppet::Parser::Functions.function(:validate_absolute_path) - scope.method(function_name) - end - - describe "Valid Paths" do - def self.valid_paths - %w{ - C:/ - C:\\ - C:\\WINDOWS\\System32 - C:/windows/system32 - X:/foo/bar - X:\\foo\\bar - /var/tmp - /var/lib/puppet - /var/opt/../lib/puppet - } - end - - context "Without Puppet::Util.absolute_path? (e.g. Puppet <= 2.6)" do - before :each do - # The intent here is to mock Puppet to behave like Puppet 2.6 does. - # Puppet 2.6 does not have the absolute_path? method. This is only a - # convenience test, stdlib should be run with the Puppet 2.6.x in the - # $LOAD_PATH in addition to 2.7.x and master. - Puppet::Util.expects(:respond_to?).with(:absolute_path?).returns(false) - end - valid_paths.each do |path| - it "validate_absolute_path(#{path.inspect}) should not fail" do - expect { subject.call [path] }.not_to raise_error Puppet::ParseError - end - end - end - - context "Puppet without mocking" do - valid_paths.each do |path| - it "validate_absolute_path(#{path.inspect}) should not fail" do - expect { subject.call [path] }.not_to raise_error Puppet::ParseError - end - end - end - end - - describe 'Invalid paths' do - context 'Garbage inputs' do - [ - nil, - [ nil ], - { 'foo' => 'bar' }, - { }, - '', - ].each do |path| - it "validate_absolute_path(#{path.inspect}) should fail" do - expect { subject.call [path] }.to raise_error Puppet::ParseError - end - end - end - - context 'Relative paths' do - %w{ - relative1 - . - .. - ./foo - ../foo - etc/puppetlabs/puppet - opt/puppet/bin - }.each do |path| - it "validate_absolute_path(#{path.inspect}) should fail" do - expect { subject.call [path] }.to raise_error Puppet::ParseError - end - end - end - end -end diff --git a/custom_zulip_files/puppet/stdlib/spec/unit/puppet/parser/functions/validate_array_spec.rb b/custom_zulip_files/puppet/stdlib/spec/unit/puppet/parser/functions/validate_array_spec.rb deleted file mode 100644 index 4b31cfd..0000000 --- a/custom_zulip_files/puppet/stdlib/spec/unit/puppet/parser/functions/validate_array_spec.rb +++ /dev/null @@ -1,38 +0,0 @@ -#! /usr/bin/env ruby -S rspec - -require 'spec_helper' - -describe Puppet::Parser::Functions.function(:validate_array) do - let(:scope) { PuppetlabsSpec::PuppetInternals.scope } - describe 'when calling validate_array from puppet' do - - %w{ true false }.each do |the_string| - it "should not compile when #{the_string} is a string" do - Puppet[:code] = "validate_array('#{the_string}')" - expect { scope.compiler.compile }.to raise_error(Puppet::ParseError, /is not an Array/) - end - - it "should not compile when #{the_string} is a bare word" do - Puppet[:code] = "validate_array(#{the_string})" - expect { scope.compiler.compile }.to raise_error(Puppet::ParseError, /is not an Array/) - end - end - - it "should compile when multiple array arguments are passed" do - Puppet[:code] = <<-'ENDofPUPPETcode' - $foo = [ ] - $bar = [ 'one', 'two' ] - validate_array($foo, $bar) - ENDofPUPPETcode - scope.compiler.compile - end - - it "should not compile when an undef variable is passed" do - Puppet[:code] = <<-'ENDofPUPPETcode' - $foo = undef - validate_array($foo) - ENDofPUPPETcode - expect { scope.compiler.compile }.to raise_error(Puppet::ParseError, /is not an Array/) - end - end -end diff --git a/custom_zulip_files/puppet/stdlib/spec/unit/puppet/parser/functions/validate_augeas_spec.rb b/custom_zulip_files/puppet/stdlib/spec/unit/puppet/parser/functions/validate_augeas_spec.rb deleted file mode 100644 index ab5c140..0000000 --- a/custom_zulip_files/puppet/stdlib/spec/unit/puppet/parser/functions/validate_augeas_spec.rb +++ /dev/null @@ -1,102 +0,0 @@ -require 'spec_helper' - -describe Puppet::Parser::Functions.function(:validate_augeas), :if => Puppet.features.augeas? do - let(:scope) { PuppetlabsSpec::PuppetInternals.scope } - - # The subject of these examplres is the method itself. - subject do - # This makes sure the function is loaded within each test - function_name = Puppet::Parser::Functions.function(:validate_augeas) - scope.method(function_name) - end - - context 'Using Puppet::Parser::Scope.new' do - - describe 'Garbage inputs' do - inputs = [ - [ nil ], - [ [ nil ] ], - [ { 'foo' => 'bar' } ], - [ { } ], - [ '' ], - [ "one", "one", "MSG to User", "4th arg" ], - ] - - inputs.each do |input| - it "validate_augeas(#{input.inspect}) should fail" do - expect { subject.call [input] }.to raise_error Puppet::ParseError - end - end - end - - describe 'Valid inputs' do - inputs = [ - [ "root:x:0:0:root:/root:/bin/bash\n", 'Passwd.lns' ], - [ "proc /proc proc nodev,noexec,nosuid 0 0\n", 'Fstab.lns'], - ] - - inputs.each do |input| - it "validate_augeas(#{input.inspect}) should not fail" do - expect { subject.call input }.not_to raise_error - end - end - end - - describe "Valid inputs which should raise an exception without a message" do - # The intent here is to make sure valid inputs raise exceptions when they - # don't specify an error message to display. This is the behvior in - # 2.2.x and prior. - inputs = [ - [ "root:x:0:0:root\n", 'Passwd.lns' ], - [ "127.0.1.1\n", 'Hosts.lns' ], - ] - - inputs.each do |input| - it "validate_augeas(#{input.inspect}) should fail" do - expect { subject.call input }.to raise_error /validate_augeas.*?matched less than it should/ - end - end - end - - describe "Nicer Error Messages" do - # The intent here is to make sure the function returns the 3rd argument - # in the exception thrown - inputs = [ - [ "root:x:0:0:root\n", 'Passwd.lns', [], 'Failed to validate passwd content' ], - [ "127.0.1.1\n", 'Hosts.lns', [], 'Wrong hosts content' ], - ] - - inputs.each do |input| - it "validate_augeas(#{input.inspect}) should fail" do - expect { subject.call input }.to raise_error /#{input[2]}/ - end - end - end - - describe "Passing simple unit tests" do - inputs = [ - [ "root:x:0:0:root:/root:/bin/bash\n", 'Passwd.lns', ['$file/foobar']], - [ "root:x:0:0:root:/root:/bin/bash\n", 'Passwd.lns', ['$file/root/shell[.="/bin/sh"]', 'foobar']], - ] - - inputs.each do |input| - it "validate_augeas(#{input.inspect}) should fail" do - expect { subject.call input }.not_to raise_error - end - end - end - - describe "Failing simple unit tests" do - inputs = [ - [ "foobar:x:0:0:root:/root:/bin/bash\n", 'Passwd.lns', ['$file/foobar']], - [ "root:x:0:0:root:/root:/bin/sh\n", 'Passwd.lns', ['$file/root/shell[.="/bin/sh"]', 'foobar']], - ] - - inputs.each do |input| - it "validate_augeas(#{input.inspect}) should fail" do - expect { subject.call input }.to raise_error /testing path/ - end - end - end - end -end diff --git a/custom_zulip_files/puppet/stdlib/spec/unit/puppet/parser/functions/validate_bool_spec.rb b/custom_zulip_files/puppet/stdlib/spec/unit/puppet/parser/functions/validate_bool_spec.rb deleted file mode 100644 index 261fb23..0000000 --- a/custom_zulip_files/puppet/stdlib/spec/unit/puppet/parser/functions/validate_bool_spec.rb +++ /dev/null @@ -1,51 +0,0 @@ -#! /usr/bin/env/ruby -S rspec - -require 'spec_helper' - -describe Puppet::Parser::Functions.function(:validate_bool) do - let(:scope) { PuppetlabsSpec::PuppetInternals.scope } - describe 'when calling validate_bool from puppet' do - - %w{ true false }.each do |the_string| - - it "should not compile when #{the_string} is a string" do - Puppet[:code] = "validate_bool('#{the_string}')" - expect { scope.compiler.compile }.to raise_error(Puppet::ParseError, /is not a boolean/) - end - - it "should compile when #{the_string} is a bare word" do - Puppet[:code] = "validate_bool(#{the_string})" - scope.compiler.compile - end - - end - - it "should not compile when an arbitrary string is passed" do - Puppet[:code] = 'validate_bool("jeff and dan are awesome")' - expect { scope.compiler.compile }.to raise_error(Puppet::ParseError, /is not a boolean/) - end - - it "should not compile when no arguments are passed" do - Puppet[:code] = 'validate_bool()' - expect { scope.compiler.compile }.to raise_error(Puppet::ParseError, /wrong number of arguments/) - end - - it "should compile when multiple boolean arguments are passed" do - Puppet[:code] = <<-'ENDofPUPPETcode' - $foo = true - $bar = false - validate_bool($foo, $bar, true, false) - ENDofPUPPETcode - scope.compiler.compile - end - - it "should compile when multiple boolean arguments are passed" do - Puppet[:code] = <<-'ENDofPUPPETcode' - $foo = true - $bar = false - validate_bool($foo, $bar, true, false, 'jeff') - ENDofPUPPETcode - expect { scope.compiler.compile }.to raise_error(Puppet::ParseError, /is not a boolean/) - end - end -end diff --git a/custom_zulip_files/puppet/stdlib/spec/unit/puppet/parser/functions/validate_cmd_spec.rb b/custom_zulip_files/puppet/stdlib/spec/unit/puppet/parser/functions/validate_cmd_spec.rb deleted file mode 100644 index 69ea7f4..0000000 --- a/custom_zulip_files/puppet/stdlib/spec/unit/puppet/parser/functions/validate_cmd_spec.rb +++ /dev/null @@ -1,81 +0,0 @@ -require 'spec_helper' - -describe Puppet::Parser::Functions.function(:validate_cmd) do - let(:scope) { PuppetlabsSpec::PuppetInternals.scope } - - # The subject of these examplres is the method itself. - subject do - # This makes sure the function is loaded within each test - function_name = Puppet::Parser::Functions.function(:validate_cmd) - scope.method(function_name) - end - - context 'Using Puppet::Parser::Scope.new' do - - describe 'Garbage inputs' do - inputs = [ - [ nil ], - [ [ nil ] ], - [ { 'foo' => 'bar' } ], - [ { } ], - [ '' ], - [ "one", "one", "MSG to User", "4th arg" ], - ] - - inputs.each do |input| - it "validate_cmd(#{input.inspect}) should fail" do - expect { subject.call [input] }.to raise_error Puppet::ParseError - end - end - end - - describe 'Valid inputs' do - inputs = [ - [ '/full/path/to/something', '/bin/echo' ], - [ '/full/path/to/something', '/bin/cat' ], - ] - - inputs.each do |input| - it "validate_cmd(#{input.inspect}) should not fail" do - expect { subject.call input }.not_to raise_error - end - end - end - - describe "Valid inputs which should raise an exception without a message" do - # The intent here is to make sure valid inputs raise exceptions when they - # don't specify an error message to display. This is the behvior in - # 2.2.x and prior. - inputs = [ - [ "hello", "/bin/false" ], - ] - - inputs.each do |input| - it "validate_cmd(#{input.inspect}) should fail" do - expect { subject.call input }.to raise_error /validate_cmd.*?failed to validate content with command/ - end - end - end - - describe "Nicer Error Messages" do - # The intent here is to make sure the function returns the 3rd argument - # in the exception thrown - inputs = [ - [ "hello", [ "bye", "later", "adios" ], "MSG to User" ], - [ "greetings", "salutations", "Error, greetings does not match salutations" ], - ] - - inputs.each do |input| - it "validate_cmd(#{input.inspect}) should fail" do - expect { subject.call input }.to raise_error /#{input[2]}/ - end - end - end - - describe "Test output message" do - it "validate_cmd('whatever', 'kthnksbye') should fail" do - expect { subject.call ['whatever', 'kthnksbye'] }.to raise_error /kthnksbye.* returned 1/ - end - end - end -end diff --git a/custom_zulip_files/puppet/stdlib/spec/unit/puppet/parser/functions/validate_hash_spec.rb b/custom_zulip_files/puppet/stdlib/spec/unit/puppet/parser/functions/validate_hash_spec.rb deleted file mode 100644 index a0c35c2..0000000 --- a/custom_zulip_files/puppet/stdlib/spec/unit/puppet/parser/functions/validate_hash_spec.rb +++ /dev/null @@ -1,43 +0,0 @@ -#! /usr/bin/env ruby -S rspec - -require 'spec_helper' - -describe Puppet::Parser::Functions.function(:validate_hash) do - let(:scope) { PuppetlabsSpec::PuppetInternals.scope } - - describe 'when calling validate_hash from puppet' do - - %w{ true false }.each do |the_string| - - it "should not compile when #{the_string} is a string" do - Puppet[:code] = "validate_hash('#{the_string}')" - expect { scope.compiler.compile }.to raise_error(Puppet::ParseError, /is not a Hash/) - end - - it "should not compile when #{the_string} is a bare word" do - Puppet[:code] = "validate_hash(#{the_string})" - expect { scope.compiler.compile }.to raise_error(Puppet::ParseError, /is not a Hash/) - end - - end - - it "should compile when multiple hash arguments are passed" do - Puppet[:code] = <<-'ENDofPUPPETcode' - $foo = {} - $bar = { 'one' => 'two' } - validate_hash($foo, $bar) - ENDofPUPPETcode - scope.compiler.compile - end - - it "should not compile when an undef variable is passed" do - Puppet[:code] = <<-'ENDofPUPPETcode' - $foo = undef - validate_hash($foo) - ENDofPUPPETcode - expect { scope.compiler.compile }.to raise_error(Puppet::ParseError, /is not a Hash/) - end - - end - -end diff --git a/custom_zulip_files/puppet/stdlib/spec/unit/puppet/parser/functions/validate_re_spec.rb b/custom_zulip_files/puppet/stdlib/spec/unit/puppet/parser/functions/validate_re_spec.rb deleted file mode 100644 index d189efb..0000000 --- a/custom_zulip_files/puppet/stdlib/spec/unit/puppet/parser/functions/validate_re_spec.rb +++ /dev/null @@ -1,76 +0,0 @@ -require 'spec_helper' - -describe Puppet::Parser::Functions.function(:validate_re) do - let(:scope) { PuppetlabsSpec::PuppetInternals.scope } - - # The subject of these examplres is the method itself. - subject do - # This makes sure the function is loaded within each test - function_name = Puppet::Parser::Functions.function(:validate_re) - scope.method(function_name) - end - - context 'Using Puppet::Parser::Scope.new' do - - describe 'Garbage inputs' do - inputs = [ - [ nil ], - [ [ nil ] ], - [ { 'foo' => 'bar' } ], - [ { } ], - [ '' ], - [ "one", "one", "MSG to User", "4th arg" ], - ] - - inputs.each do |input| - it "validate_re(#{input.inspect}) should fail" do - expect { subject.call [input] }.to raise_error Puppet::ParseError - end - end - end - - describe 'Valid inputs' do - inputs = [ - [ '/full/path/to/something', '^/full' ], - [ '/full/path/to/something', 'full' ], - [ '/full/path/to/something', ['full', 'absent'] ], - [ '/full/path/to/something', ['full', 'absent'], 'Message to the user' ], - ] - - inputs.each do |input| - it "validate_re(#{input.inspect}) should not fail" do - expect { subject.call input }.not_to raise_error - end - end - end - describe "Valid inputs which should raise an exception without a message" do - # The intent here is to make sure valid inputs raise exceptions when they - # don't specify an error message to display. This is the behvior in - # 2.2.x and prior. - inputs = [ - [ "hello", [ "bye", "later", "adios" ] ], - [ "greetings", "salutations" ], - ] - - inputs.each do |input| - it "validate_re(#{input.inspect}) should fail" do - expect { subject.call input }.to raise_error /validate_re.*?does not match/ - end - end - end - describe "Nicer Error Messages" do - # The intent here is to make sure the function returns the 3rd argument - # in the exception thrown - inputs = [ - [ "hello", [ "bye", "later", "adios" ], "MSG to User" ], - [ "greetings", "salutations", "Error, greetings does not match salutations" ], - ] - - inputs.each do |input| - it "validate_re(#{input.inspect}) should fail" do - expect { subject.call input }.to raise_error /#{input[2]}/ - end - end - end - end -end diff --git a/custom_zulip_files/puppet/stdlib/spec/unit/puppet/parser/functions/validate_slength_spec.rb b/custom_zulip_files/puppet/stdlib/spec/unit/puppet/parser/functions/validate_slength_spec.rb deleted file mode 100755 index eccf908..0000000 --- a/custom_zulip_files/puppet/stdlib/spec/unit/puppet/parser/functions/validate_slength_spec.rb +++ /dev/null @@ -1,48 +0,0 @@ -#! /usr/bin/env ruby -S rspec - -require 'spec_helper' - -describe "the validate_slength function" do - let(:scope) { PuppetlabsSpec::PuppetInternals.scope } - - it "should exist" do - Puppet::Parser::Functions.function("validate_slength").should == "function_validate_slength" - end - - it "should raise a ParseError if there is less than 2 arguments" do - expect { scope.function_validate_slength([]) }.to(raise_error(Puppet::ParseError)) - expect { scope.function_validate_slength(["asdf"]) }.to(raise_error(Puppet::ParseError)) - end - - it "should raise a ParseError if argument 2 doesn't convert to a fixnum" do - expect { scope.function_validate_slength(["moo",["2"]]) }.to(raise_error(Puppet::ParseError, /Couldn't convert whatever you passed/)) - end - - it "should raise a ParseError if argument 2 converted, but to 0, e.g. a string" do - expect { scope.function_validate_slength(["moo","monkey"]) }.to(raise_error(Puppet::ParseError, /please pass a positive number as max_length/)) - end - - it "should raise a ParseError if argument 2 converted, but to 0" do - expect { scope.function_validate_slength(["moo","0"]) }.to(raise_error(Puppet::ParseError, /please pass a positive number as max_length/)) - end - - it "should fail if string greater then size" do - expect { scope.function_validate_slength(["test", 2]) }.to(raise_error(Puppet::ParseError, /It should have been less than or equal to/)) - end - - it "should fail if you pass an array of something other than strings" do - expect { scope.function_validate_slength([["moo",["moo"],Hash.new["moo" => 7]], 7]) }.to(raise_error(Puppet::ParseError, /is not a string, it's a/)) - end - - it "should fail if you pass something other than a string or array" do - expect { scope.function_validate_slength([Hash.new["moo" => "7"],6]) }.to(raise_error(Puppet::ParseError), /please pass a string, or an array of strings/) - end - - it "should not fail if string is smaller or equal to size" do - expect { scope.function_validate_slength(["test", 5]) }.to_not(raise_error(Puppet::ParseError)) - end - - it "should not fail if array of string is are all smaller or equal to size" do - expect { scope.function_validate_slength([["moo","foo","bar"], 5]) }.to_not(raise_error(Puppet::ParseError)) - end -end diff --git a/custom_zulip_files/puppet/stdlib/spec/unit/puppet/parser/functions/validate_string_spec.rb b/custom_zulip_files/puppet/stdlib/spec/unit/puppet/parser/functions/validate_string_spec.rb deleted file mode 100644 index 3b4fb3e..0000000 --- a/custom_zulip_files/puppet/stdlib/spec/unit/puppet/parser/functions/validate_string_spec.rb +++ /dev/null @@ -1,60 +0,0 @@ -#! /usr/bin/env ruby -S rspec - -require 'spec_helper' - -describe Puppet::Parser::Functions.function(:validate_string) do - let(:scope) { PuppetlabsSpec::PuppetInternals.scope } - - describe 'when calling validate_string from puppet' do - - %w{ foo bar baz }.each do |the_string| - - it "should compile when #{the_string} is a string" do - Puppet[:code] = "validate_string('#{the_string}')" - scope.compiler.compile - end - - it "should compile when #{the_string} is a bare word" do - Puppet[:code] = "validate_string(#{the_string})" - scope.compiler.compile - end - - end - - %w{ true false }.each do |the_string| - it "should compile when #{the_string} is a string" do - Puppet[:code] = "validate_string('#{the_string}')" - scope.compiler.compile - end - - it "should not compile when #{the_string} is a bare word" do - Puppet[:code] = "validate_string(#{the_string})" - expect { scope.compiler.compile }.to raise_error(Puppet::ParseError, /is not a string/) - end - end - - it "should compile when multiple string arguments are passed" do - Puppet[:code] = <<-'ENDofPUPPETcode' - $foo = '' - $bar = 'two' - validate_string($foo, $bar) - ENDofPUPPETcode - scope.compiler.compile - end - - it "should compile when an explicitly undef variable is passed (NOTE THIS MAY NOT BE DESIRABLE)" do - Puppet[:code] = <<-'ENDofPUPPETcode' - $foo = undef - validate_string($foo) - ENDofPUPPETcode - scope.compiler.compile - end - - it "should compile when an undefined variable is passed (NOTE THIS MAY NOT BE DESIRABLE)" do - Puppet[:code] = <<-'ENDofPUPPETcode' - validate_string($foobarbazishouldnotexist) - ENDofPUPPETcode - scope.compiler.compile - end - end -end diff --git a/custom_zulip_files/puppet/stdlib/spec/unit/puppet/parser/functions/values_at_spec.rb b/custom_zulip_files/puppet/stdlib/spec/unit/puppet/parser/functions/values_at_spec.rb deleted file mode 100644 index 08e95a5..0000000 --- a/custom_zulip_files/puppet/stdlib/spec/unit/puppet/parser/functions/values_at_spec.rb +++ /dev/null @@ -1,38 +0,0 @@ -#! /usr/bin/env ruby -S rspec -require 'spec_helper' - -describe "the values_at function" do - let(:scope) { PuppetlabsSpec::PuppetInternals.scope } - - it "should exist" do - Puppet::Parser::Functions.function("values_at").should == "function_values_at" - end - - it "should raise a ParseError if there is less than 1 arguments" do - lambda { scope.function_values_at([]) }.should( raise_error(Puppet::ParseError)) - end - - it "should raise a ParseError if you try to use a range where stop is greater then start" do - lambda { scope.function_values_at([['a','b'],["3-1"]]) }.should( raise_error(Puppet::ParseError)) - end - - it "should return a value at from an array" do - result = scope.function_values_at([['a','b','c'],"1"]) - result.should(eq(['b'])) - end - - it "should return a value at from an array when passed a range" do - result = scope.function_values_at([['a','b','c'],"0-1"]) - result.should(eq(['a','b'])) - end - - it "should return chosen values from an array when passed number of indexes" do - result = scope.function_values_at([['a','b','c'],["0","2"]]) - result.should(eq(['a','c'])) - end - - it "should return chosen values from an array when passed ranges and multiple indexes" do - result = scope.function_values_at([['a','b','c','d','e','f','g'],["0","2","4-5"]]) - result.should(eq(['a','c','e','f'])) - end -end diff --git a/custom_zulip_files/puppet/stdlib/spec/unit/puppet/parser/functions/values_spec.rb b/custom_zulip_files/puppet/stdlib/spec/unit/puppet/parser/functions/values_spec.rb deleted file mode 100644 index 14ae417..0000000 --- a/custom_zulip_files/puppet/stdlib/spec/unit/puppet/parser/functions/values_spec.rb +++ /dev/null @@ -1,31 +0,0 @@ -#! /usr/bin/env ruby -S rspec -require 'spec_helper' - -describe "the values function" do - let(:scope) { PuppetlabsSpec::PuppetInternals.scope } - - it "should exist" do - Puppet::Parser::Functions.function("values").should == "function_values" - end - - it "should raise a ParseError if there is less than 1 arguments" do - lambda { scope.function_values([]) }.should( raise_error(Puppet::ParseError)) - end - - it "should return values from a hash" do - result = scope.function_values([{'a'=>'1','b'=>'2','c'=>'3'}]) - # =~ is the RSpec::Matchers::MatchArray matcher. - # A.K.A. "array with same elements" (multiset) matching - result.should =~ %w{ 1 2 3 } - end - - it "should return a multiset" do - result = scope.function_values([{'a'=>'1','b'=>'3','c'=>'3'}]) - result.should =~ %w{ 1 3 3 } - result.should_not =~ %w{ 1 3 } - end - - it "should raise a ParseError unless a Hash is provided" do - lambda { scope.function_values([['a','b','c']]) }.should( raise_error(Puppet::ParseError)) - end -end diff --git a/custom_zulip_files/puppet/stdlib/spec/unit/puppet/parser/functions/zip_spec.rb b/custom_zulip_files/puppet/stdlib/spec/unit/puppet/parser/functions/zip_spec.rb deleted file mode 100644 index f45ab17..0000000 --- a/custom_zulip_files/puppet/stdlib/spec/unit/puppet/parser/functions/zip_spec.rb +++ /dev/null @@ -1,15 +0,0 @@ -#! /usr/bin/env ruby -S rspec -require 'spec_helper' - -describe "the zip function" do - let(:scope) { PuppetlabsSpec::PuppetInternals.scope } - - it "should raise a ParseError if there is less than 1 arguments" do - lambda { scope.function_zip([]) }.should( raise_error(Puppet::ParseError)) - end - - it "should be able to zip an array" do - result = scope.function_zip([['1','2','3'],['4','5','6']]) - result.should(eq([["1", "4"], ["2", "5"], ["3", "6"]])) - end -end diff --git a/custom_zulip_files/puppet/stdlib/spec/unit/puppet/provider/file_line/ruby_spec.rb b/custom_zulip_files/puppet/stdlib/spec/unit/puppet/provider/file_line/ruby_spec.rb deleted file mode 100644 index 7857d39..0000000 --- a/custom_zulip_files/puppet/stdlib/spec/unit/puppet/provider/file_line/ruby_spec.rb +++ /dev/null @@ -1,127 +0,0 @@ -require 'puppet' -require 'tempfile' -provider_class = Puppet::Type.type(:file_line).provider(:ruby) -describe provider_class do - context "when adding" do - before :each do - # TODO: these should be ported over to use the PuppetLabs spec_helper - # file fixtures once the following pull request has been merged: - # https://github.com/puppetlabs/puppetlabs-stdlib/pull/73/files - tmp = Tempfile.new('tmp') - @tmpfile = tmp.path - tmp.close! - @resource = Puppet::Type::File_line.new( - {:name => 'foo', :path => @tmpfile, :line => 'foo'} - ) - @provider = provider_class.new(@resource) - end - it 'should detect if the line exists in the file' do - File.open(@tmpfile, 'w') do |fh| - fh.write('foo') - end - @provider.exists?.should be_true - end - it 'should detect if the line does not exist in the file' do - File.open(@tmpfile, 'w') do |fh| - fh.write('foo1') - end - @provider.exists?.should be_nil - end - it 'should append to an existing file when creating' do - @provider.create - File.read(@tmpfile).chomp.should == 'foo' - end - end - - context "when matching" do - before :each do - # TODO: these should be ported over to use the PuppetLabs spec_helper - # file fixtures once the following pull request has been merged: - # https://github.com/puppetlabs/puppetlabs-stdlib/pull/73/files - tmp = Tempfile.new('tmp') - @tmpfile = tmp.path - tmp.close! - @resource = Puppet::Type::File_line.new( - { - :name => 'foo', - :path => @tmpfile, - :line => 'foo = bar', - :match => '^foo\s*=.*$', - } - ) - @provider = provider_class.new(@resource) - end - - it 'should raise an error if more than one line matches, and should not have modified the file' do - File.open(@tmpfile, 'w') do |fh| - fh.write("foo1\nfoo=blah\nfoo2\nfoo=baz") - end - @provider.exists?.should be_nil - expect { @provider.create }.to raise_error(Puppet::Error, /More than one line.*matches/) - File.read(@tmpfile).should eql("foo1\nfoo=blah\nfoo2\nfoo=baz") - end - - it 'should replace a line that matches' do - File.open(@tmpfile, 'w') do |fh| - fh.write("foo1\nfoo=blah\nfoo2") - end - @provider.exists?.should be_nil - @provider.create - File.read(@tmpfile).chomp.should eql("foo1\nfoo = bar\nfoo2") - end - it 'should add a new line if no lines match' do - File.open(@tmpfile, 'w') do |fh| - fh.write("foo1\nfoo2") - end - @provider.exists?.should be_nil - @provider.create - File.read(@tmpfile).should eql("foo1\nfoo2\nfoo = bar\n") - end - it 'should do nothing if the exact line already exists' do - File.open(@tmpfile, 'w') do |fh| - fh.write("foo1\nfoo = bar\nfoo2") - end - @provider.exists?.should be_true - @provider.create - File.read(@tmpfile).chomp.should eql("foo1\nfoo = bar\nfoo2") - end - end - - context "when removing" do - before :each do - # TODO: these should be ported over to use the PuppetLabs spec_helper - # file fixtures once the following pull request has been merged: - # https://github.com/puppetlabs/puppetlabs-stdlib/pull/73/files - tmp = Tempfile.new('tmp') - @tmpfile = tmp.path - tmp.close! - @resource = Puppet::Type::File_line.new( - {:name => 'foo', :path => @tmpfile, :line => 'foo', :ensure => 'absent' } - ) - @provider = provider_class.new(@resource) - end - it 'should remove the line if it exists' do - File.open(@tmpfile, 'w') do |fh| - fh.write("foo1\nfoo\nfoo2") - end - @provider.destroy - File.read(@tmpfile).should eql("foo1\nfoo2") - end - - it 'should remove the line without touching the last new line' do - File.open(@tmpfile, 'w') do |fh| - fh.write("foo1\nfoo\nfoo2\n") - end - @provider.destroy - File.read(@tmpfile).should eql("foo1\nfoo2\n") - end - - it 'should remove any occurence of the line' do - File.open(@tmpfile, 'w') do |fh| - fh.write("foo1\nfoo\nfoo2\nfoo\nfoo") - end - @provider.destroy - File.read(@tmpfile).should eql("foo1\nfoo2\n") - end - end -end diff --git a/custom_zulip_files/puppet/stdlib/spec/unit/puppet/type/anchor_spec.rb b/custom_zulip_files/puppet/stdlib/spec/unit/puppet/type/anchor_spec.rb deleted file mode 100644 index 2030b83..0000000 --- a/custom_zulip_files/puppet/stdlib/spec/unit/puppet/type/anchor_spec.rb +++ /dev/null @@ -1,11 +0,0 @@ -#!/usr/bin/env ruby - -require 'puppet' - -anchor = Puppet::Type.type(:anchor).new(:name => "ntp::begin") - -describe anchor do - it "should stringify normally" do - anchor.to_s.should == "Anchor[ntp::begin]" - end -end diff --git a/custom_zulip_files/puppet/stdlib/spec/unit/puppet/type/file_line_spec.rb b/custom_zulip_files/puppet/stdlib/spec/unit/puppet/type/file_line_spec.rb deleted file mode 100644 index edc64bd..0000000 --- a/custom_zulip_files/puppet/stdlib/spec/unit/puppet/type/file_line_spec.rb +++ /dev/null @@ -1,69 +0,0 @@ -require 'puppet' -require 'tempfile' -describe Puppet::Type.type(:file_line) do - let :file_line do - Puppet::Type.type(:file_line).new(:name => 'foo', :line => 'line', :path => '/tmp/path') - end - it 'should accept a line and path' do - file_line[:line] = 'my_line' - file_line[:line].should == 'my_line' - file_line[:path] = '/my/path' - file_line[:path].should == '/my/path' - end - it 'should accept a match regex' do - file_line[:match] = '^foo.*$' - file_line[:match].should == '^foo.*$' - end - it 'should not accept a match regex that does not match the specified line' do - expect { - Puppet::Type.type(:file_line).new( - :name => 'foo', - :path => '/my/path', - :line => 'foo=bar', - :match => '^bar=blah$' - )}.to raise_error(Puppet::Error, /the value must be a regex that matches/) - end - it 'should accept a match regex that does match the specified line' do - expect { - Puppet::Type.type(:file_line).new( - :name => 'foo', - :path => '/my/path', - :line => 'foo=bar', - :match => '^\s*foo=.*$' - )}.not_to raise_error - end - it 'should accept posix filenames' do - file_line[:path] = '/tmp/path' - file_line[:path].should == '/tmp/path' - end - it 'should not accept unqualified path' do - expect { file_line[:path] = 'file' }.to raise_error(Puppet::Error, /File paths must be fully qualified/) - end - it 'should require that a line is specified' do - expect { Puppet::Type.type(:file_line).new(:name => 'foo', :path => '/tmp/file') }.to raise_error(Puppet::Error, /Both line and path are required attributes/) - end - it 'should require that a file is specified' do - expect { Puppet::Type.type(:file_line).new(:name => 'foo', :line => 'path') }.to raise_error(Puppet::Error, /Both line and path are required attributes/) - end - it 'should default to ensure => present' do - file_line[:ensure].should eq :present - end - - it "should autorequire the file it manages" do - catalog = Puppet::Resource::Catalog.new - file = Puppet::Type.type(:file).new(:name => "/tmp/path") - catalog.add_resource file - catalog.add_resource file_line - - relationship = file_line.autorequire.find do |rel| - (rel.source.to_s == "File[/tmp/path]") and (rel.target.to_s == file_line.to_s) - end - relationship.should be_a Puppet::Relationship - end - - it "should not autorequire the file it manages if it is not managed" do - catalog = Puppet::Resource::Catalog.new - catalog.add_resource file_line - file_line.autorequire.should be_empty - end -end diff --git a/custom_zulip_files/puppet/stdlib/spec/watchr.rb b/custom_zulip_files/puppet/stdlib/spec/watchr.rb deleted file mode 100644 index 885ef1d..0000000 --- a/custom_zulip_files/puppet/stdlib/spec/watchr.rb +++ /dev/null @@ -1,86 +0,0 @@ -ENV['FOG_MOCK'] ||= 'true' -ENV['AUTOTEST'] = 'true' -ENV['WATCHR'] = '1' - -system 'clear' - -def growl(message) - growlnotify = `which growlnotify`.chomp - title = "Watchr Test Results" - image = case message - when /(\d+)\s+?(failure|error)/i - ($1.to_i == 0) ? "~/.watchr_images/passed.png" : "~/.watchr_images/failed.png" - else - '~/.watchr_images/unknown.png' - end - options = "-w -n Watchr --image '#{File.expand_path(image)}' -m '#{message}' '#{title}'" - system %(#{growlnotify} #{options} &) -end - -def run(cmd) - puts(cmd) - `#{cmd}` -end - -def run_spec_test(file) - if File.exist? file - result = run "rspec --format p --color #{file}" - growl result.split("\n").last - puts result - else - puts "FIXME: No test #{file} [#{Time.now}]" - end -end - -def filter_rspec(data) - data.split("\n").find_all do |l| - l =~ /^(\d+)\s+exampl\w+.*?(\d+).*?failur\w+.*?(\d+).*?pending/ - end.join("\n") -end - -def run_all_tests - system('clear') - files = Dir.glob("spec/**/*_spec.rb").join(" ") - result = run "rspec #{files}" - growl_results = filter_rspec result - growl growl_results - puts result - puts "GROWL: #{growl_results}" -end - -# Ctrl-\ -Signal.trap 'QUIT' do - puts " --- Running all tests ---\n\n" - run_all_tests -end - -@interrupted = false - -# Ctrl-C -Signal.trap 'INT' do - if @interrupted then - @wants_to_quit = true - abort("\n") - else - puts "Interrupt a second time to quit" - @interrupted = true - Kernel.sleep 1.5 - # raise Interrupt, nil # let the run loop catch it - run_suite - end -end - -def file2spec(file) - result = file.sub('lib/puppet/', 'spec/unit/puppet/').gsub(/\.rb$/, '_spec.rb') - result = file.sub('lib/facter/', 'spec/unit/facter/').gsub(/\.rb$/, '_spec.rb') -end - - -watch( 'spec/.*_spec\.rb' ) do |md| - #run_spec_test(md[0]) - run_all_tests -end -watch( 'lib/.*\.rb' ) do |md| - # run_spec_test(file2spec(md[0])) - run_all_tests -end diff --git a/custom_zulip_files/puppet/stdlib/tests/file_line.pp b/custom_zulip_files/puppet/stdlib/tests/file_line.pp deleted file mode 100644 index eea693e..0000000 --- a/custom_zulip_files/puppet/stdlib/tests/file_line.pp +++ /dev/null @@ -1,9 +0,0 @@ -# This is a simple smoke test -# of the file_line resource type. -file { '/tmp/dansfile': - ensure => present -}-> -file_line { 'dans_line': - line => 'dan is awesome', - path => '/tmp/dansfile', -} diff --git a/custom_zulip_files/puppet/stdlib/tests/has_interface_with.pp b/custom_zulip_files/puppet/stdlib/tests/has_interface_with.pp deleted file mode 100644 index e1f1353..0000000 --- a/custom_zulip_files/puppet/stdlib/tests/has_interface_with.pp +++ /dev/null @@ -1,10 +0,0 @@ -include stdlib -info('has_interface_with(\'lo\'):', has_interface_with('lo')) -info('has_interface_with(\'loX\'):', has_interface_with('loX')) -info('has_interface_with(\'ipaddress\', \'127.0.0.1\'):', has_interface_with('ipaddress', '127.0.0.1')) -info('has_interface_with(\'ipaddress\', \'127.0.0.100\'):', has_interface_with('ipaddress', '127.0.0.100')) -info('has_interface_with(\'network\', \'127.0.0.0\'):', has_interface_with('network', '127.0.0.0')) -info('has_interface_with(\'network\', \'128.0.0.0\'):', has_interface_with('network', '128.0.0.0')) -info('has_interface_with(\'netmask\', \'255.0.0.0\'):', has_interface_with('netmask', '255.0.0.0')) -info('has_interface_with(\'netmask\', \'256.0.0.0\'):', has_interface_with('netmask', '256.0.0.0')) - diff --git a/custom_zulip_files/puppet/stdlib/tests/has_ip_address.pp b/custom_zulip_files/puppet/stdlib/tests/has_ip_address.pp deleted file mode 100644 index 8429a88..0000000 --- a/custom_zulip_files/puppet/stdlib/tests/has_ip_address.pp +++ /dev/null @@ -1,3 +0,0 @@ -include stdlib -info('has_ip_address(\'192.168.1.256\'):', has_ip_address('192.168.1.256')) -info('has_ip_address(\'127.0.0.1\'):', has_ip_address('127.0.0.1')) diff --git a/custom_zulip_files/puppet/stdlib/tests/has_ip_network.pp b/custom_zulip_files/puppet/stdlib/tests/has_ip_network.pp deleted file mode 100644 index a15d8c0..0000000 --- a/custom_zulip_files/puppet/stdlib/tests/has_ip_network.pp +++ /dev/null @@ -1,4 +0,0 @@ -include stdlib -info('has_ip_network(\'127.0.0.0\'):', has_ip_network('127.0.0.0')) -info('has_ip_network(\'128.0.0.0\'):', has_ip_network('128.0.0.0')) - diff --git a/custom_zulip_files/puppet/stdlib/tests/init.pp b/custom_zulip_files/puppet/stdlib/tests/init.pp deleted file mode 100644 index 9675d83..0000000 --- a/custom_zulip_files/puppet/stdlib/tests/init.pp +++ /dev/null @@ -1 +0,0 @@ -include stdlib diff --git a/custom_zulip_files/puppet/zulip/files/apache/ports.conf b/custom_zulip_files/puppet/zulip/files/apache/ports.conf deleted file mode 100644 index 1ef4fe6..0000000 --- a/custom_zulip_files/puppet/zulip/files/apache/ports.conf +++ /dev/null @@ -1,2 +0,0 @@ -# This file is empty since we want nginx to serve ports 80 and 443 on -# this system. diff --git a/custom_zulip_files/puppet/zulip/files/apache/sites/zulip-sso.example b/custom_zulip_files/puppet/zulip/files/apache/sites/zulip-sso.example deleted file mode 100644 index 91515b4..0000000 --- a/custom_zulip_files/puppet/zulip/files/apache/sites/zulip-sso.example +++ /dev/null @@ -1,49 +0,0 @@ -# Copyright © 2013 Zulip, Inc. All rights reserved. - -# Copy, modify, and enable this site if you need to use an Apache httpd module -# for user authentication. - -# Requests to /accounts/login/sso/ will be passed unchanged by the primary -# Zulip web server to Apache. Once a request is authenticated, the REMOTE_USER -# environment variable should be set by your authentication module. - -# The config below will then invoke the Zulip web app under Apache, which will -# detect the presence of the variable, log the user in, and then redirect back -# to the app (served by the primary web server). You should configure your -# authentication module below. - -NameVirtualHost 127.0.0.1:8888 -Listen 127.0.0.1:8888 - - - # As an example, we've configured this service to use HTTP basic auth. - # Insert the configuration for your SSO authentication module here: - - AuthType basic - AuthName "zulip.example.com" - AuthUserFile /home/zulip/zpasswd - Require valid-user - - - ServerAdmin webmaster@localhost - - ServerSignature Off - - # You shouldn't need to edit anything below this line. - - SSLEngine On - SSLCertificateFile /etc/ssl/certs/zulip.combined-chain.crt - SSLCertificateKeyFile /etc/ssl/private/zulip.key - - WSGIScriptAlias / /home/zulip/deployments/current/zproject/wsgi.py - WSGIDaemonProcess zulip threads=5 user=zulip python-path=/home/zulip/deployments/current/ - WSGIProcessGroup zulip - - ErrorLog ${APACHE_LOG_DIR}/zulip_auth_error.log - - # Possible values include: debug, info, notice, warn, error, crit, - # alert, emerg. - LogLevel warn - - CustomLog ${APACHE_LOG_DIR}/zulip_auth_access.log combined - diff --git a/custom_zulip_files/puppet/zulip/files/cron.d/email-mirror b/custom_zulip_files/puppet/zulip/files/cron.d/email-mirror deleted file mode 100644 index c20bce2..0000000 --- a/custom_zulip_files/puppet/zulip/files/cron.d/email-mirror +++ /dev/null @@ -1,3 +0,0 @@ -MAILTO=root - -* * * * * zulip cd /home/zulip/deployments/current && python manage.py email-mirror diff --git a/custom_zulip_files/puppet/zulip/files/cron.d/rabbitmq-numconsumers b/custom_zulip_files/puppet/zulip/files/cron.d/rabbitmq-numconsumers deleted file mode 100644 index 92967b8..0000000 --- a/custom_zulip_files/puppet/zulip/files/cron.d/rabbitmq-numconsumers +++ /dev/null @@ -1,16 +0,0 @@ -SHELL=/bin/bash -PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin -USER=root - -* * * * * root /home/zulip/deployments/current/bin/write-rabbitmq-consumers-state-file notify_tornado -* * * * * root /home/zulip/deployments/current/bin/write-rabbitmq-consumers-state-file user_activity -* * * * * root /home/zulip/deployments/current/bin/write-rabbitmq-consumers-state-file user_activity_interval -* * * * * root /home/zulip/deployments/current/bin/write-rabbitmq-consumers-state-file user_presence -* * * * * root /home/zulip/deployments/current/bin/write-rabbitmq-consumers-state-file invites -* * * * * root /home/zulip/deployments/current/bin/write-rabbitmq-consumers-state-file signups -* * * * * root /home/zulip/deployments/current/bin/write-rabbitmq-consumers-state-file message_sender -* * * * * root /home/zulip/deployments/current/bin/write-rabbitmq-consumers-state-file feedback_messages -* * * * * root /home/zulip/deployments/current/bin/write-rabbitmq-consumers-state-file error_reports -* * * * * root /home/zulip/deployments/current/bin/write-rabbitmq-consumers-state-file digest_emails -* * * * * root /home/zulip/deployments/current/bin/write-rabbitmq-consumers-state-file email_mirror -* * * * * root /home/zulip/deployments/current/bin/write-rabbitmq-consumers-state-file missedmessage_mobile_notifications diff --git a/custom_zulip_files/puppet/zulip/files/cron.d/rabbitmq-queuesize b/custom_zulip_files/puppet/zulip/files/cron.d/rabbitmq-queuesize deleted file mode 100644 index 8d37135..0000000 --- a/custom_zulip_files/puppet/zulip/files/cron.d/rabbitmq-queuesize +++ /dev/null @@ -1,25 +0,0 @@ -# Edit this file to introduce tasks to be run by cron. -# -# Each task to run has to be defined through a single line -# indicating with different fields when the task will be run -# and what command to run for the task -# -# To define the time you can provide concrete values for -# minute (m), hour (h), day of month (dom), month (mon), -# and day of week (dow) or use '*' in these fields (for 'any').# -# Notice that tasks will be started based on the cron's system -# daemon's notion of time and timezones. -# -# Output of the crontab jobs (including errors) is sent through -# email to the user the crontab file belongs to (unless redirected). -# -# For example, you can run a backup of all your user accounts -# at 5 a.m every week with: -# 0 5 * * 1 tar -zcf /var/backups/home.tgz /home/ -# -# For more information see the manual pages of crontab(5) and cron(8) -# -# m h dom mon dow command -SHELL=/bin/bash - -* * * * * root /home/zulip/deployments/current/bots/check-rabbitmq-queue &> /var/lib/nagios_state/check-rabbitmq-results-tmp; mv /var/lib/nagios_state/check-rabbitmq-results-tmp /var/lib/nagios_state/check-rabbitmq-results diff --git a/custom_zulip_files/puppet/zulip/files/cron.d/restart-zulip b/custom_zulip_files/puppet/zulip/files/cron.d/restart-zulip deleted file mode 100644 index f21147e..0000000 --- a/custom_zulip_files/puppet/zulip/files/cron.d/restart-zulip +++ /dev/null @@ -1,5 +0,0 @@ -SHELL=/bin/bash -PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin -USER=zulip - -0 6 * * 7 zulip supervisorctl restart all diff --git a/custom_zulip_files/puppet/zulip/files/cron.d/send-digest-emails b/custom_zulip_files/puppet/zulip/files/cron.d/send-digest-emails deleted file mode 100644 index ed86294..0000000 --- a/custom_zulip_files/puppet/zulip/files/cron.d/send-digest-emails +++ /dev/null @@ -1,4 +0,0 @@ -MAILTO=root - -# Send digest emails once a day. Time is in UTC. -0 18 * * * zulip cd /home/zulip/deployments/current && python2.7 manage.py enqueue_digest_emails diff --git a/custom_zulip_files/puppet/zulip/files/limits.conf b/custom_zulip_files/puppet/zulip/files/limits.conf deleted file mode 100644 index c515877..0000000 --- a/custom_zulip_files/puppet/zulip/files/limits.conf +++ /dev/null @@ -1,60 +0,0 @@ -# /etc/security/limits.conf -# -#Each line describes a limit for a user in the form: -# -# -# -#Where: -# can be: -# - an user name -# - a group name, with @group syntax -# - the wildcard *, for default entry -# - the wildcard %, can be also used with %group syntax, -# for maxlogin limit -# - NOTE: group and wildcard limits are not applied to root. -# To apply a limit to the root user, must be -# the literal username root. -# -# can have the two values: -# - "soft" for enforcing the soft limits -# - "hard" for enforcing hard limits -# -# can be one of the following: -# - core - limits the core file size (KB) -# - data - max data size (KB) -# - fsize - maximum filesize (KB) -# - memlock - max locked-in-memory address space (KB) -# - nofile - max number of open files -# - rss - max resident set size (KB) -# - stack - max stack size (KB) -# - cpu - max CPU time (MIN) -# - nproc - max number of processes -# - as - address space limit (KB) -# - maxlogins - max number of logins for this user -# - maxsyslogins - max number of logins on the system -# - priority - the priority to run user process with -# - locks - max number of file locks the user can hold -# - sigpending - max number of pending signals -# - msgqueue - max memory used by POSIX message queues (bytes) -# - nice - max nice priority allowed to raise to values: [-20, 19] -# - rtprio - max realtime priority -# - chroot - change root to directory (Debian-specific) -# -# -# - -#* soft core 0 -#root hard core 100000 -#* hard rss 10000 -#@student hard nproc 20 -#@faculty soft nproc 20 -#@faculty hard nproc 50 -#ftp hard nproc 0 -#ftp - chroot /ftp -#@student - maxlogins 4 -zulip soft nofile 40000 -zulip hard nofile 50000 -root soft nofile 40000 -root hard nofile 50000 - -# End of file diff --git a/custom_zulip_files/puppet/zulip/files/memcached.conf b/custom_zulip_files/puppet/zulip/files/memcached.conf deleted file mode 100644 index 21e2eaa..0000000 --- a/custom_zulip_files/puppet/zulip/files/memcached.conf +++ /dev/null @@ -1,47 +0,0 @@ -# memcached default config file -# 2003 - Jay Bonci -# This configuration file is read by the start-memcached script provided as -# part of the Debian GNU/Linux distribution. - -# Run memcached as a daemon. This command is implied, and is not needed for the -# daemon to run. See the README.Debian that comes with this package for more -# information. --d - -# Log memcached's output to /var/log/memcached -logfile /var/log/memcached.log - -# Be verbose -# -v - -# Be even more verbose (print client commands as well) -# -vv - -# Start with a cap of 64 megs of memory. It's reasonable, and the daemon default -# Note that the daemon will grow to this size, but does not start out holding this much -# memory --m 512 - -# Default connection port is 11211 --p 11211 - -# Run the daemon as root. The start-memcached will default to running as root if no -# -u command is present in this config file --u nobody - -# Specify which IP address to listen on. The default is to listen on all IP addresses -# This parameter is one of the only security measures that memcached has, so make sure -# it's listening on a firewalled interface. --l 127.0.0.1 - -# Limit the number of simultaneous incoming connections. The daemon default is 1024 -# -c 1024 - -# Lock down all paged memory. Consult with the README and homepage before you do this -# -k - -# Return error when memory is exhausted (rather than removing items) -# -M - -# Maximize core file limit -# -r diff --git a/custom_zulip_files/puppet/zulip/files/nginx/fastcgi_params b/custom_zulip_files/puppet/zulip/files/nginx/fastcgi_params deleted file mode 100644 index 998d590..0000000 --- a/custom_zulip_files/puppet/zulip/files/nginx/fastcgi_params +++ /dev/null @@ -1,25 +0,0 @@ -fastcgi_param QUERY_STRING $query_string; -fastcgi_param REQUEST_METHOD $request_method; -fastcgi_param CONTENT_TYPE $content_type; -fastcgi_param CONTENT_LENGTH $content_length; - -fastcgi_param SCRIPT_FILENAME $request_filename; -fastcgi_param SCRIPT_NAME $fastcgi_script_name; -fastcgi_param REQUEST_URI $uri; -fastcgi_param DOCUMENT_URI $document_uri; -fastcgi_param DOCUMENT_ROOT $document_root; -fastcgi_param SERVER_PROTOCOL $server_protocol; - -fastcgi_param GATEWAY_INTERFACE CGI/1.1; -fastcgi_param SERVER_SOFTWARE nginx/$nginx_version; - -fastcgi_param REMOTE_ADDR $remote_addr; -fastcgi_param REMOTE_PORT $remote_port; -fastcgi_param SERVER_ADDR $server_addr; -fastcgi_param SERVER_PORT $server_port; -fastcgi_param SERVER_NAME $server_name; - -fastcgi_param HTTPS $https; - -# PHP only, required if PHP was built with --enable-force-cgi-redirect -fastcgi_param REDIRECT_STATUS 200; diff --git a/custom_zulip_files/puppet/zulip/files/nginx/nginx.conf b/custom_zulip_files/puppet/zulip/files/nginx/nginx.conf deleted file mode 100644 index 1be9297..0000000 --- a/custom_zulip_files/puppet/zulip/files/nginx/nginx.conf +++ /dev/null @@ -1,57 +0,0 @@ -user zulip; - -worker_processes auto; -pid /var/run/nginx.pid; - -worker_rlimit_nofile 40000; -events { - worker_connections 40000; - - use epoll; - - multi_accept on; -} - -http { - sendfile on; - tcp_nopush on; - tcp_nodelay on; - keepalive_timeout 65; - types_hash_max_size 2048; - client_max_body_size 25m; - - include /etc/nginx/mime.types; - default_type application/octet-stream; - - access_log /var/log/nginx/access.log; - error_log /var/log/nginx/error.log; - - reset_timedout_connection on; - - gzip on; - gzip_disable "msie6"; - gzip_proxied any; - gzip_types - audio/ogg - application/json - application/octet-stream - application/xml - application/x-javascript - image/png - text/css - text/plain; - gzip_vary on; - - # Select a Connection header for sockjs reverse-proxying - map $http_upgrade $connection_upgrade { - default upgrade; - '' close; - } - # These are the official ciphers as of 2014-10-14 - ssl_protocols TLSv1 TLSv1.1 TLSv1.2; - ssl_ciphers EECDH+AES128:RSA+AES128:EECDH+AES256:RSA+AES256:EECDH+3DES:RSA+3DES:EECDH+RC4:RSA+RC4:!MD5; - - - include /etc/nginx/conf.d/*.conf; - include /etc/nginx/sites-enabled/*; -} diff --git a/custom_zulip_files/puppet/zulip/files/nginx/sites-available/zulip-enterprise b/custom_zulip_files/puppet/zulip/files/nginx/sites-available/zulip-enterprise deleted file mode 100644 index b2f3e3a..0000000 --- a/custom_zulip_files/puppet/zulip/files/nginx/sites-available/zulip-enterprise +++ /dev/null @@ -1,32 +0,0 @@ -server { - listen 80; - return 301 https://$host$request_uri; -} - -include /etc/nginx/zulip-include/upstreams; - -server { - listen 443; - - ssl on; - ssl_certificate /etc/ssl/certs/zulip.combined-chain.crt; - ssl_certificate_key /etc/ssl/private/zulip.key; - - location /user_uploads { - add_header X-Content-Type-Options nosniff; - include /etc/nginx/zulip-include/uploads.types; - alias /home/zulip/uploads/files; - } - - location /user_avatars { - add_header X-Content-Type-Options nosniff; - include /etc/nginx/zulip-include/uploads.types; - alias /home/zulip/uploads/avatars; - } - - location /local-static { - alias /home/zulip/local-static; - } - - include /etc/nginx/zulip-include/app; -} diff --git a/custom_zulip_files/puppet/zulip/files/nginx/zulip-include-app.d/external-sso.conf b/custom_zulip_files/puppet/zulip/files/nginx/zulip-include-app.d/external-sso.conf deleted file mode 100644 index da22cf7..0000000 --- a/custom_zulip_files/puppet/zulip/files/nginx/zulip-include-app.d/external-sso.conf +++ /dev/null @@ -1,8 +0,0 @@ -# Use this when you have a server listening on localhost that is serving Zulip -# with some sort of authentication middleware installed. The proxied-to server -# should pass REMOTE_USER to /accounts/login/sso/ once it has satisfactorily -# identified the user. -location /accounts/login/sso/ { - proxy_pass https://localhost_sso; - include /etc/nginx/zulip-include/proxy; -} diff --git a/custom_zulip_files/puppet/zulip/files/nginx/zulip-include-common/location-sockjs b/custom_zulip_files/puppet/zulip/files/nginx/zulip-include-common/location-sockjs deleted file mode 100644 index ce2852d..0000000 --- a/custom_zulip_files/puppet/zulip/files/nginx/zulip-include-common/location-sockjs +++ /dev/null @@ -1,7 +0,0 @@ -# Longpolling version needed for xhr streaming support -include /etc/nginx/zulip-include/proxy_longpolling; - -proxy_set_header Upgrade $http_upgrade; -# This should override the Connection setting in zulip-include/proxy -proxy_set_header Connection $connection_upgrade; -proxy_set_header X-Real-IP $remote_addr; diff --git a/custom_zulip_files/puppet/zulip/files/nginx/zulip-include-common/proxy b/custom_zulip_files/puppet/zulip/files/nginx/zulip-include-common/proxy deleted file mode 100644 index 017a169..0000000 --- a/custom_zulip_files/puppet/zulip/files/nginx/zulip-include-common/proxy +++ /dev/null @@ -1,8 +0,0 @@ -proxy_http_version 1.1; -# Clearing the Connection header is required for keepalives from the load balancer -# http://nginx.org/en/docs/http/ngx_http_upstream_module.html#keepalive -proxy_set_header Connection ""; -proxy_set_header Host $host; -proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; -proxy_next_upstream off; -proxy_redirect off; diff --git a/custom_zulip_files/puppet/zulip/files/nginx/zulip-include-common/proxy_longpolling b/custom_zulip_files/puppet/zulip/files/nginx/zulip-include-common/proxy_longpolling deleted file mode 100644 index 427dacf..0000000 --- a/custom_zulip_files/puppet/zulip/files/nginx/zulip-include-common/proxy_longpolling +++ /dev/null @@ -1,3 +0,0 @@ -include /etc/nginx/zulip-include/proxy; -proxy_buffering off; -proxy_read_timeout 1200; diff --git a/custom_zulip_files/puppet/zulip/files/nginx/zulip-include-frontend/app b/custom_zulip_files/puppet/zulip/files/nginx/zulip-include-frontend/app deleted file mode 100644 index 93ce736..0000000 --- a/custom_zulip_files/puppet/zulip/files/nginx/zulip-include-frontend/app +++ /dev/null @@ -1,79 +0,0 @@ -access_log /var/log/nginx/access.log; -error_log /var/log/nginx/error.log; - -# Enable HSTS: tell browsers to always use HTTPS -add_header Strict-Transport-Security max-age=15768000; - -# Serve a custom error page when the app is down -error_page 502 503 504 /static/html/5xx.html; - -# Serve static files directly -location /static/ { - alias /home/zulip/prod-static/; - error_page 404 /static/html/404.html; -} - -# Send longpoll requests to Tornado -location ~ /json/get_events|/json/events { - proxy_pass http://tornado; - include /etc/nginx/zulip-include/proxy_longpolling; - - proxy_set_header X-Real-IP $remote_addr; -} - -# Send longpoll requests to Tornado -location /api/v1/events { - - add_header Access-Control-Allow-Origin *; - add_header Access-Control-Allow-Headers Authorization; - add_header Access-Control-Allow-Methods 'GET, POST'; - - if ($request_method = 'OPTIONS') { - add_header Access-Control-Allow-Origin *; - add_header Access-Control-Allow-Headers Authorization; - add_header Access-Control-Allow-Methods 'GET, POST'; - add_header 'Content-Type' 'text/plain charset=UTF-8'; - add_header 'Content-Length' 0; - return 204; - } - - proxy_pass http://tornado; - include /etc/nginx/zulip-include/proxy_longpolling; - - proxy_set_header X-Real-IP $remote_addr; -} - - -# Send sockjs requests to Tornado -location /sockjs { - proxy_pass http://tornado; - include /etc/nginx/zulip-include/location-sockjs; -} - -# Send everything else to Django via FastCGI -location / { - include fastcgi_params; - fastcgi_pass django; - fastcgi_split_path_info ^()(.*)$; - # Second number set to `getconf PAGESIZE` - fastcgi_buffers 1024 4k; - fastcgi_max_temp_file_size 0; - fastcgi_next_upstream off; -} - -location /api/ { - add_header Access-Control-Allow-Origin *; - add_header Access-Control-Allow-Headers Authorization; - add_header Access-Control-Allow-Methods 'GET, POST'; - - include fastcgi_params; - fastcgi_pass django; - fastcgi_split_path_info ^()(.*)$; - # Second number set to `getconf PAGESIZE` - fastcgi_buffers 1024 4k; - fastcgi_max_temp_file_size 0; - fastcgi_next_upstream off; - -} - -include /etc/nginx/zulip-include/app.d/*.conf; diff --git a/custom_zulip_files/puppet/zulip/files/nginx/zulip-include-frontend/uploads.types b/custom_zulip_files/puppet/zulip/files/nginx/zulip-include-frontend/uploads.types deleted file mode 100644 index 20ba343..0000000 --- a/custom_zulip_files/puppet/zulip/files/nginx/zulip-include-frontend/uploads.types +++ /dev/null @@ -1,22 +0,0 @@ - -types { - text/plain txt; - - image/gif gif; - image/jpeg jpeg jpg; - image/png png; - image/tiff tif tiff; - image/webp webp; - - video/3gpp 3gpp 3gp; - video/mp4 mp4; - video/mpeg mpeg mpg; - video/quicktime mov; - video/webm webm; - video/x-flv flv; - video/x-m4v m4v; - video/x-mng mng; - video/x-ms-asf asx asf; - video/x-ms-wmv wmv; - video/x-msvideo avi; -} diff --git a/custom_zulip_files/puppet/zulip/files/nginx/zulip-include-frontend/upstreams b/custom_zulip_files/puppet/zulip/files/nginx/zulip-include-frontend/upstreams deleted file mode 100644 index ebe9681..0000000 --- a/custom_zulip_files/puppet/zulip/files/nginx/zulip-include-frontend/upstreams +++ /dev/null @@ -1,12 +0,0 @@ -upstream django { - server unix:/home/zulip/deployments/fastcgi-socket; -} - -upstream tornado { - server localhost:9993; - keepalive 10000; -} - -upstream localhost_sso { - server localhost:8888; -} diff --git a/custom_zulip_files/puppet/zulip/files/postfix/master.cf b/custom_zulip_files/puppet/zulip/files/postfix/master.cf deleted file mode 100644 index 6eca9ff..0000000 --- a/custom_zulip_files/puppet/zulip/files/postfix/master.cf +++ /dev/null @@ -1,114 +0,0 @@ -# -# Postfix master process configuration file. For details on the format -# of the file, see the master(5) manual page (command: "man 5 master"). -# -# Do not forget to execute "postfix reload" after editing this file. -# -# ========================================================================== -# service type private unpriv chroot wakeup maxproc command + args -# (yes) (yes) (yes) (never) (100) -# ========================================================================== -smtp inet n - - - - smtpd -#smtp inet n - - - 1 postscreen -#smtpd pass - - - - - smtpd -#dnsblog unix - - - - 0 dnsblog -#tlsproxy unix - - - - 0 tlsproxy -#submission inet n - - - - smtpd -# -o syslog_name=postfix/submission -# -o smtpd_tls_security_level=encrypt -# -o smtpd_sasl_auth_enable=yes -# -o smtpd_client_restrictions=permit_sasl_authenticated,reject -# -o milter_macro_daemon_name=ORIGINATING -#smtps inet n - - - - smtpd -# -o syslog_name=postfix/smtps -# -o smtpd_tls_wrappermode=yes -# -o smtpd_sasl_auth_enable=yes -# -o smtpd_client_restrictions=permit_sasl_authenticated,reject -# -o milter_macro_daemon_name=ORIGINATING -#628 inet n - - - - qmqpd -pickup fifo n - - 60 1 pickup -cleanup unix n - - - 0 cleanup -qmgr fifo n - n 300 1 qmgr -#qmgr fifo n - n 300 1 oqmgr -tlsmgr unix - - - 1000? 1 tlsmgr -rewrite unix - - - - - trivial-rewrite -bounce unix - - - - 0 bounce -defer unix - - - - 0 bounce -trace unix - - - - 0 bounce -verify unix - - - - 1 verify -flush unix n - - 1000? 0 flush -proxymap unix - - n - - proxymap -proxywrite unix - - n - 1 proxymap -smtp unix - - - - - smtp -relay unix - - - - - smtp -# -o smtp_helo_timeout=5 -o smtp_connect_timeout=5 -showq unix n - - - - showq -error unix - - - - - error -retry unix - - - - - error -discard unix - - - - - discard -local unix - n n - - local -virtual unix - n n - - virtual -lmtp unix - - - - - lmtp -anvil unix - - - - 1 anvil -scache unix - - - - 1 scache -# -# ==================================================================== -# Interfaces to non-Postfix software. Be sure to examine the manual -# pages of the non-Postfix software to find out what options it wants. -# -# Many of the following services use the Postfix pipe(8) delivery -# agent. See the pipe(8) man page for information about ${recipient} -# and other message envelope options. -# ==================================================================== -# -# maildrop. See the Postfix MAILDROP_README file for details. -# Also specify in main.cf: maildrop_destination_recipient_limit=1 -# -maildrop unix - n n - - pipe - flags=DRhu user=vmail argv=/usr/bin/maildrop -d ${recipient} -# -# ==================================================================== -# -# Recent Cyrus versions can use the existing "lmtp" master.cf entry. -# -# Specify in cyrus.conf: -# lmtp cmd="lmtpd -a" listen="localhost:lmtp" proto=tcp4 -# -# Specify in main.cf one or more of the following: -# mailbox_transport = lmtp:inet:localhost -# virtual_transport = lmtp:inet:localhost -# -# ==================================================================== -# -# Cyrus 2.1.5 (Amos Gouaux) -# Also specify in main.cf: cyrus_destination_recipient_limit=1 -# -#cyrus unix - n n - - pipe -# user=cyrus argv=/cyrus/bin/deliver -e -r ${sender} -m ${extension} ${user} -# -# ==================================================================== -# Old example of delivery via Cyrus. -# -#old-cyrus unix - n n - - pipe -# flags=R user=cyrus argv=/cyrus/bin/deliver -e -m ${extension} ${user} -# -# ==================================================================== -# -# See the Postfix UUCP_README file for configuration details. -# -uucp unix - n n - - pipe - flags=Fqhu user=uucp argv=uux -r -n -z -a$sender - $nexthop!rmail ($recipient) -# -# Other external delivery methods. -# -ifmail unix - n n - - pipe - flags=F user=ftn argv=/usr/lib/ifmail/ifmail -r $nexthop ($recipient) -bsmtp unix - n n - - pipe - flags=Fq. user=bsmtp argv=/usr/lib/bsmtp/bsmtp -t$nexthop -f$sender $recipient -scalemail-backend unix - n n - 2 pipe - flags=R user=scalemail argv=/usr/lib/scalemail/bin/scalemail-store ${nexthop} ${user} ${extension} -mailman unix - n n - - pipe - flags=FR user=list argv=/usr/lib/mailman/bin/postfix-to-mailman.py - ${nexthop} ${user} -zulip unix - n n - - pipe - flags= user=zulip argv=/home/zulip/deployments/current/manage.py email-mirror ${original_recipient} diff --git a/custom_zulip_files/puppet/zulip/files/postfix/transport b/custom_zulip_files/puppet/zulip/files/postfix/transport deleted file mode 100644 index b3848c3..0000000 --- a/custom_zulip_files/puppet/zulip/files/postfix/transport +++ /dev/null @@ -1 +0,0 @@ -zulip@localhost zulip: diff --git a/custom_zulip_files/puppet/zulip/files/postfix/virtual b/custom_zulip_files/puppet/zulip/files/postfix/virtual deleted file mode 100644 index 7502594..0000000 --- a/custom_zulip_files/puppet/zulip/files/postfix/virtual +++ /dev/null @@ -1,2 +0,0 @@ -/.*\+.*@.*/ zulip@localhost -/^mm.*/ zulip@localhost diff --git a/custom_zulip_files/puppet/zulip/files/postgresql/process_fts_updates b/custom_zulip_files/puppet/zulip/files/postgresql/process_fts_updates deleted file mode 100755 index 836ba3b..0000000 --- a/custom_zulip_files/puppet/zulip/files/postgresql/process_fts_updates +++ /dev/null @@ -1,85 +0,0 @@ -#!/usr/bin/env python2.7 -# Processes updates to postgres Full Text Search for new/edited messages. -# -# Zulip manages its postgres full-text search as follows. When the -# content of a message is modified, a postgres trigger logs the -# message ID to the `fts_update_log` table. In the background, this -# program processes `fts_update_log`, updating the postgres full-text -# search column search_tsvector in the main zerver_message. -import psycopg2 -import psycopg2.extensions -import select -import time -import logging -import sys -import os - -def update_fts_columns(cursor): - cursor.execute("SELECT id, message_id FROM fts_update_log;") - ids = [] - for (id, message_id) in cursor.fetchall(): - cursor.execute("UPDATE zerver_message SET " - "search_tsvector = to_tsvector('zulip.english_us_search', " - "subject || rendered_content) " - "WHERE id = %s", (message_id,)) - ids.append(id) - cursor.execute("DELETE FROM fts_update_log WHERE id = ANY(%s)", (ids,)) - - -def am_master(cursor): - cursor.execute("SELECT pg_is_in_recovery()") - return not cursor.fetchall()[0][0] - -logging.basicConfig(format="%(asctime)s %(levelname)s: %(message)s") -logger = logging.getLogger("process_fts_updates") -logger.setLevel(logging.DEBUG) - -logger.info("process_fts_updates starting") - -# Path to the root of the Zulip codebase in production -sys.path.insert(0, '/home/zulip/deployments/current') -# Path to the root of the Zulip codebase in development -sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), "../../../.."))) -try: - os.environ['DJANGO_SETTINGS_MODULE'] = 'zproject.settings' - from django.conf import settings - remote_postgres_host = settings.REMOTE_POSTGRES_HOST -except ImportError as e: - # process_fts_updates also supports running locally on a remote - # postgres server; in that case, one can just connect to localhost - remote_postgres_host = '' - -if remote_postgres_host != '': - postgres_password = '' - if settings.DATABASES['default']['PASSWORD'] is not None: - postgres_password = "password='%s'" % settings.DATABASES['default']['PASSWORD'] - if settings.REMOTE_POSTGRES_SSLMODE != '': - postgres_sslmode = settings.REMOTE_POSTGRES_SSLMODE - else: - postgres_sslmode = 'verify-full' - conn = psycopg2.connect("user=zulip %s host='%s' dbname=zulip connect_timeout=600 sslmode='%s'" % (postgres_password, remote_postgres_host, postgres_sslmode)) -else: - conn = psycopg2.connect("user=zulip") -cursor = conn.cursor() - -conn.set_isolation_level(psycopg2.extensions.ISOLATION_LEVEL_AUTOCOMMIT) - -first_check = True -while not am_master(cursor): - if first_check: - first_check = False - logger.info("In recovery; sleeping") - time.sleep(5) - -logger.info("Not in recovery; listening for FTS updates") - -cursor.execute("LISTEN fts_update_log;") -update_fts_columns(cursor) - -# TODO: If we go back into recovery, we should stop processing updates -while True: - if select.select([conn], [], [], 30) != ([], [], []): - conn.poll() - while conn.notifies: - conn.notifies.pop() - update_fts_columns(cursor) diff --git a/custom_zulip_files/puppet/zulip/files/postgresql/zulip_english.stop b/custom_zulip_files/puppet/zulip/files/postgresql/zulip_english.stop deleted file mode 100644 index 1afc9ba..0000000 --- a/custom_zulip_files/puppet/zulip/files/postgresql/zulip_english.stop +++ /dev/null @@ -1,149 +0,0 @@ -i -me -my -myself -we -our -ours -ourselves -you -your -yours -yourself -yourselves -he -him -his -himself -she -her -hers -herself -it -its -itself -they -them -their -theirs -themselves -what -which -who -whom -this -that -these -those -am -is -are -was -were -be -been -being -have -has -had -having -do -does -did -doing -a -an -the -and -but -if -or -because -as -until -while -of -at -by -for -with -about -against -between -into -through -during -before -after -above -below -to -from -up -down -in -out -on -off -over -under -again -further -then -once -here -there -when -where -why -how -all -any -both -each -few -more -most -other -some -such -no -nor -not -only -own -same -so -than -too -very -s -t -can -will -just -don -should -now -b -c -d -e -f -g -h -j -k -l -m -n -o -p -q -r -u -v -w -x -y -z diff --git a/custom_zulip_files/puppet/zulip/files/rabbitmq/rabbitmq-server b/custom_zulip_files/puppet/zulip/files/rabbitmq/rabbitmq-server deleted file mode 100644 index a1c281b..0000000 --- a/custom_zulip_files/puppet/zulip/files/rabbitmq/rabbitmq-server +++ /dev/null @@ -1,11 +0,0 @@ -# This file is sourced by /etc/init.d/rabbitmq-server. Its primary -# reason for existing is to allow adjustment of system limits for the -# rabbitmq-server process. -# -# Maximum number of open file handles. This will need to be increased -# to handle many simultaneous connections. Refer to the system -# documentation for ulimit (in man bash) for more information. -# -#ulimit -n 1024 - -export ERL_EPMD_ADDRESS=127.0.0.1 diff --git a/custom_zulip_files/puppet/zulip/files/rabbitmq/rabbitmq.config b/custom_zulip_files/puppet/zulip/files/rabbitmq/rabbitmq.config deleted file mode 100644 index 07c3a5d..0000000 --- a/custom_zulip_files/puppet/zulip/files/rabbitmq/rabbitmq.config +++ /dev/null @@ -1,4 +0,0 @@ -[{kernel, [{inet_dist_use_interface, {127,0,0,1}}]}, - {rabbit, [{tcp_listeners, [{"127.0.0.1", 5672}]}]}, - {rabbitmq_mochiweb, [{listeners, [{mgmt, [{ip, "127.0.0.1"}, - {port, 55672}]}]}]}]. diff --git a/custom_zulip_files/puppet/zulip/files/redis/redis.conf b/custom_zulip_files/puppet/zulip/files/redis/redis.conf deleted file mode 100644 index c4a4603..0000000 --- a/custom_zulip_files/puppet/zulip/files/redis/redis.conf +++ /dev/null @@ -1,710 +0,0 @@ -# Redis configuration file example - -# Note on units: when memory size is needed, it is possible to specify -# it in the usual form of 1k 5GB 4M and so forth: -# -# 1k => 1000 bytes -# 1kb => 1024 bytes -# 1m => 1000000 bytes -# 1mb => 1024*1024 bytes -# 1g => 1000000000 bytes -# 1gb => 1024*1024*1024 bytes -# -# units are case insensitive so 1GB 1Gb 1gB are all the same. - -################################## INCLUDES ################################### - -# Include one or more other config files here. This is useful if you -# have a standard template that goes to all Redis server but also need -# to customize a few per-server settings. Include files can include -# other files, so use this wisely. -# -# Notice option "include" won't be rewritten by command "CONFIG REWRITE" -# from admin or Redis Sentinel. Since Redis always uses the last processed -# line as value of a configuration directive, you'd better put includes -# at the beginning of this file to avoid overwriting config change at runtime. -# -# If instead you are interested in using includes to override configuration -# options, it is better to use include as the last line. -# -# include /path/to/local.conf -# include /path/to/other.conf - -################################ GENERAL ##################################### - -# By default Redis does not run as a daemon. Use 'yes' if you need it. -# Note that Redis will write a pid file in /var/run/redis.pid when daemonized. -daemonize yes - -# When running daemonized, Redis writes a pid file in /var/run/redis.pid by -# default. You can specify a custom pid file location here. -pidfile /var/run/redis/redis-server.pid - -# Accept connections on the specified port, default is 6379. -# If port 0 is specified Redis will not listen on a TCP socket. -port 6379 - -# By default Redis listens for connections from all the network interfaces -# available on the server. It is possible to listen to just one or multiple -# interfaces using the "bind" configuration directive, followed by one or -# more IP addresses. -# -# Examples: -# -# bind 192.168.1.100 10.0.0.1 -bind 127.0.0.1 - -# Specify the path for the unix socket that will be used to listen for -# incoming connections. There is no default, so Redis will not listen -# on a unix socket when not specified. -# -# unixsocket /var/run/redis/redis.sock -# unixsocketperm 755 - -# Close the connection after a client is idle for N seconds (0 to disable) -timeout 0 - -# TCP keepalive. -# -# If non-zero, use SO_KEEPALIVE to send TCP ACKs to clients in absence -# of communication. This is useful for two reasons: -# -# 1) Detect dead peers. -# 2) Take the connection alive from the point of view of network -# equipment in the middle. -# -# On Linux, the specified value (in seconds) is the period used to send ACKs. -# Note that to close the connection the double of the time is needed. -# On other kernels the period depends on the kernel configuration. -# -# A reasonable value for this option is 60 seconds. -tcp-keepalive 0 - -# Specify the server verbosity level. -# This can be one of: -# debug (a lot of information, useful for development/testing) -# verbose (many rarely useful info, but not a mess like the debug level) -# notice (moderately verbose, what you want in production probably) -# warning (only very important / critical messages are logged) -loglevel notice - -# Specify the log file name. Also the empty string can be used to force -# Redis to log on the standard output. Note that if you use standard -# output for logging but daemonize, logs will be sent to /dev/null -logfile /var/log/redis/redis-server.log - -# To enable logging to the system logger, just set 'syslog-enabled' to yes, -# and optionally update the other syslog parameters to suit your needs. -# syslog-enabled no - -# Specify the syslog identity. -# syslog-ident redis - -# Specify the syslog facility. Must be USER or between LOCAL0-LOCAL7. -# syslog-facility local0 - -# Set the number of databases. The default database is DB 0, you can select -# a different one on a per-connection basis using SELECT where -# dbid is a number between 0 and 'databases'-1 -databases 16 - -################################ SNAPSHOTTING ################################ -# -# Save the DB on disk: -# -# save -# -# Will save the DB if both the given number of seconds and the given -# number of write operations against the DB occurred. -# -# In the example below the behaviour will be to save: -# after 900 sec (15 min) if at least 1 key changed -# after 300 sec (5 min) if at least 10 keys changed -# after 60 sec if at least 10000 keys changed -# -# Note: you can disable saving at all commenting all the "save" lines. -# -# It is also possible to remove all the previously configured save -# points by adding a save directive with a single empty string argument -# like in the following example: -# -# save "" - -save 900 1 -save 300 10 -save 60 10000 - -# By default Redis will stop accepting writes if RDB snapshots are enabled -# (at least one save point) and the latest background save failed. -# This will make the user aware (in a hard way) that data is not persisting -# on disk properly, otherwise chances are that no one will notice and some -# disaster will happen. -# -# If the background saving process will start working again Redis will -# automatically allow writes again. -# -# However if you have setup your proper monitoring of the Redis server -# and persistence, you may want to disable this feature so that Redis will -# continue to work as usual even if there are problems with disk, -# permissions, and so forth. -stop-writes-on-bgsave-error yes - -# Compress string objects using LZF when dump .rdb databases? -# For default that's set to 'yes' as it's almost always a win. -# If you want to save some CPU in the saving child set it to 'no' but -# the dataset will likely be bigger if you have compressible values or keys. -rdbcompression yes - -# Since version 5 of RDB a CRC64 checksum is placed at the end of the file. -# This makes the format more resistant to corruption but there is a performance -# hit to pay (around 10%) when saving and loading RDB files, so you can disable it -# for maximum performances. -# -# RDB files created with checksum disabled have a checksum of zero that will -# tell the loading code to skip the check. -rdbchecksum yes - -# The filename where to dump the DB -dbfilename dump.rdb - -# The working directory. -# -# The DB will be written inside this directory, with the filename specified -# above using the 'dbfilename' configuration directive. -# -# The Append Only File will also be created inside this directory. -# -# Note that you must specify a directory here, not a file name. -dir /var/lib/redis - -################################# REPLICATION ################################# - -# Master-Slave replication. Use slaveof to make a Redis instance a copy of -# another Redis server. Note that the configuration is local to the slave -# so for example it is possible to configure the slave to save the DB with a -# different interval, or to listen to another port, and so on. -# -# slaveof - -# If the master is password protected (using the "requirepass" configuration -# directive below) it is possible to tell the slave to authenticate before -# starting the replication synchronization process, otherwise the master will -# refuse the slave request. -# -# masterauth - -# When a slave loses its connection with the master, or when the replication -# is still in progress, the slave can act in two different ways: -# -# 1) if slave-serve-stale-data is set to 'yes' (the default) the slave will -# still reply to client requests, possibly with out of date data, or the -# data set may just be empty if this is the first synchronization. -# -# 2) if slave-serve-stale-data is set to 'no' the slave will reply with -# an error "SYNC with master in progress" to all the kind of commands -# but to INFO and SLAVEOF. -# -slave-serve-stale-data yes - -# You can configure a slave instance to accept writes or not. Writing against -# a slave instance may be useful to store some ephemeral data (because data -# written on a slave will be easily deleted after resync with the master) but -# may also cause problems if clients are writing to it because of a -# misconfiguration. -# -# Since Redis 2.6 by default slaves are read-only. -# -# Note: read only slaves are not designed to be exposed to untrusted clients -# on the internet. It's just a protection layer against misuse of the instance. -# Still a read only slave exports by default all the administrative commands -# such as CONFIG, DEBUG, and so forth. To a limited extent you can improve -# security of read only slaves using 'rename-command' to shadow all the -# administrative / dangerous commands. -slave-read-only yes - -# Slaves send PINGs to server in a predefined interval. It's possible to change -# this interval with the repl_ping_slave_period option. The default value is 10 -# seconds. -# -# repl-ping-slave-period 10 - -# The following option sets the replication timeout for: -# -# 1) Bulk transfer I/O during SYNC, from the point of view of slave. -# 2) Master timeout from the point of view of slaves (data, pings). -# 3) Slave timeout from the point of view of masters (REPLCONF ACK pings). -# -# It is important to make sure that this value is greater than the value -# specified for repl-ping-slave-period otherwise a timeout will be detected -# every time there is low traffic between the master and the slave. -# -# repl-timeout 60 - -# Disable TCP_NODELAY on the slave socket after SYNC? -# -# If you select "yes" Redis will use a smaller number of TCP packets and -# less bandwidth to send data to slaves. But this can add a delay for -# the data to appear on the slave side, up to 40 milliseconds with -# Linux kernels using a default configuration. -# -# If you select "no" the delay for data to appear on the slave side will -# be reduced but more bandwidth will be used for replication. -# -# By default we optimize for low latency, but in very high traffic conditions -# or when the master and slaves are many hops away, turning this to "yes" may -# be a good idea. -repl-disable-tcp-nodelay no - -# Set the replication backlog size. The backlog is a buffer that accumulates -# slave data when slaves are disconnected for some time, so that when a slave -# wants to reconnect again, often a full resync is not needed, but a partial -# resync is enough, just passing the portion of data the slave missed while -# disconnected. -# -# The biggest the replication backlog, the longer the time the slave can be -# disconnected and later be able to perform a partial resynchronization. -# -# The backlog is only allocated once there is at least a slave connected. -# -# repl-backlog-size 1mb - -# After a master has no longer connected slaves for some time, the backlog -# will be freed. The following option configures the amount of seconds that -# need to elapse, starting from the time the last slave disconnected, for -# the backlog buffer to be freed. -# -# A value of 0 means to never release the backlog. -# -# repl-backlog-ttl 3600 - -# The slave priority is an integer number published by Redis in the INFO output. -# It is used by Redis Sentinel in order to select a slave to promote into a -# master if the master is no longer working correctly. -# -# A slave with a low priority number is considered better for promotion, so -# for instance if there are three slaves with priority 10, 100, 25 Sentinel will -# pick the one with priority 10, that is the lowest. -# -# However a special priority of 0 marks the slave as not able to perform the -# role of master, so a slave with priority of 0 will never be selected by -# Redis Sentinel for promotion. -# -# By default the priority is 100. -slave-priority 100 - -# It is possible for a master to stop accepting writes if there are less than -# N slaves connected, having a lag less or equal than M seconds. -# -# The N slaves need to be in "online" state. -# -# The lag in seconds, that must be <= the specified value, is calculated from -# the last ping received from the slave, that is usually sent every second. -# -# This option does not GUARANTEES that N replicas will accept the write, but -# will limit the window of exposure for lost writes in case not enough slaves -# are available, to the specified number of seconds. -# -# For example to require at least 3 slaves with a lag <= 10 seconds use: -# -# min-slaves-to-write 3 -# min-slaves-max-lag 10 -# -# Setting one or the other to 0 disables the feature. -# -# By default min-slaves-to-write is set to 0 (feature disabled) and -# min-slaves-max-lag is set to 10. - -################################## SECURITY ################################### - -# Require clients to issue AUTH before processing any other -# commands. This might be useful in environments in which you do not trust -# others with access to the host running redis-server. -# -# This should stay commented out for backward compatibility and because most -# people do not need auth (e.g. they run their own servers). -# -# Warning: since Redis is pretty fast an outside user can try up to -# 150k passwords per second against a good box. This means that you should -# use a very strong password otherwise it will be very easy to break. -# -# requirepass foobared - -# Command renaming. -# -# It is possible to change the name of dangerous commands in a shared -# environment. For instance the CONFIG command may be renamed into something -# hard to guess so that it will still be available for internal-use tools -# but not available for general clients. -# -# Example: -# -# rename-command CONFIG b840fc02d524045429941cc15f59e41cb7be6c52 -# -# It is also possible to completely kill a command by renaming it into -# an empty string: -# -# rename-command CONFIG "" -# -# Please note that changing the name of commands that are logged into the -# AOF file or transmitted to slaves may cause problems. - -################################### LIMITS #################################### - -# Set the max number of connected clients at the same time. By default -# this limit is set to 10000 clients, however if the Redis server is not -# able to configure the process file limit to allow for the specified limit -# the max number of allowed clients is set to the current file limit -# minus 32 (as Redis reserves a few file descriptors for internal uses). -# -# Once the limit is reached Redis will close all the new connections sending -# an error 'max number of clients reached'. -# -# maxclients 10000 - -# Don't use more memory than the specified amount of bytes. -# When the memory limit is reached Redis will try to remove keys -# according to the eviction policy selected (see maxmemory-policy). -# -# If Redis can't remove keys according to the policy, or if the policy is -# set to 'noeviction', Redis will start to reply with errors to commands -# that would use more memory, like SET, LPUSH, and so on, and will continue -# to reply to read-only commands like GET. -# -# This option is usually useful when using Redis as an LRU cache, or to set -# a hard memory limit for an instance (using the 'noeviction' policy). -# -# WARNING: If you have slaves attached to an instance with maxmemory on, -# the size of the output buffers needed to feed the slaves are subtracted -# from the used memory count, so that network problems / resyncs will -# not trigger a loop where keys are evicted, and in turn the output -# buffer of slaves is full with DELs of keys evicted triggering the deletion -# of more keys, and so forth until the database is completely emptied. -# -# In short... if you have slaves attached it is suggested that you set a lower -# limit for maxmemory so that there is some free RAM on the system for slave -# output buffers (but this is not needed if the policy is 'noeviction'). -# -# maxmemory - -# MAXMEMORY POLICY: how Redis will select what to remove when maxmemory -# is reached. You can select among five behaviors: -# -# volatile-lru -> remove the key with an expire set using an LRU algorithm -# allkeys-lru -> remove any key accordingly to the LRU algorithm -# volatile-random -> remove a random key with an expire set -# allkeys-random -> remove a random key, any key -# volatile-ttl -> remove the key with the nearest expire time (minor TTL) -# noeviction -> don't expire at all, just return an error on write operations -# -# Note: with any of the above policies, Redis will return an error on write -# operations, when there are not suitable keys for eviction. -# -# At the date of writing this commands are: set setnx setex append -# incr decr rpush lpush rpushx lpushx linsert lset rpoplpush sadd -# sinter sinterstore sunion sunionstore sdiff sdiffstore zadd zincrby -# zunionstore zinterstore hset hsetnx hmset hincrby incrby decrby -# getset mset msetnx exec sort -# -# The default is: -# -# maxmemory-policy volatile-lru - -# LRU and minimal TTL algorithms are not precise algorithms but approximated -# algorithms (in order to save memory), so you can select as well the sample -# size to check. For instance for default Redis will check three keys and -# pick the one that was used less recently, you can change the sample size -# using the following configuration directive. -# -# maxmemory-samples 3 - -############################## APPEND ONLY MODE ############################### - -# By default Redis asynchronously dumps the dataset on disk. This mode is -# good enough in many applications, but an issue with the Redis process or -# a power outage may result into a few minutes of writes lost (depending on -# the configured save points). -# -# The Append Only File is an alternative persistence mode that provides -# much better durability. For instance using the default data fsync policy -# (see later in the config file) Redis can lose just one second of writes in a -# dramatic event like a server power outage, or a single write if something -# wrong with the Redis process itself happens, but the operating system is -# still running correctly. -# -# AOF and RDB persistence can be enabled at the same time without problems. -# If the AOF is enabled on startup Redis will load the AOF, that is the file -# with the better durability guarantees. -# -# Please check http://redis.io/topics/persistence for more information. - -appendonly no - -# The name of the append only file (default: "appendonly.aof") - -appendfilename "appendonly.aof" - -# The fsync() call tells the Operating System to actually write data on disk -# instead to wait for more data in the output buffer. Some OS will really flush -# data on disk, some other OS will just try to do it ASAP. -# -# Redis supports three different modes: -# -# no: don't fsync, just let the OS flush the data when it wants. Faster. -# always: fsync after every write to the append only log . Slow, Safest. -# everysec: fsync only one time every second. Compromise. -# -# The default is "everysec", as that's usually the right compromise between -# speed and data safety. It's up to you to understand if you can relax this to -# "no" that will let the operating system flush the output buffer when -# it wants, for better performances (but if you can live with the idea of -# some data loss consider the default persistence mode that's snapshotting), -# or on the contrary, use "always" that's very slow but a bit safer than -# everysec. -# -# More details please check the following article: -# http://antirez.com/post/redis-persistence-demystified.html -# -# If unsure, use "everysec". - -# appendfsync always -appendfsync everysec -# appendfsync no - -# When the AOF fsync policy is set to always or everysec, and a background -# saving process (a background save or AOF log background rewriting) is -# performing a lot of I/O against the disk, in some Linux configurations -# Redis may block too long on the fsync() call. Note that there is no fix for -# this currently, as even performing fsync in a different thread will block -# our synchronous write(2) call. -# -# In order to mitigate this problem it's possible to use the following option -# that will prevent fsync() from being called in the main process while a -# BGSAVE or BGREWRITEAOF is in progress. -# -# This means that while another child is saving, the durability of Redis is -# the same as "appendfsync none". In practical terms, this means that it is -# possible to lose up to 30 seconds of log in the worst scenario (with the -# default Linux settings). -# -# If you have latency problems turn this to "yes". Otherwise leave it as -# "no" that is the safest pick from the point of view of durability. - -no-appendfsync-on-rewrite no - -# Automatic rewrite of the append only file. -# Redis is able to automatically rewrite the log file implicitly calling -# BGREWRITEAOF when the AOF log size grows by the specified percentage. -# -# This is how it works: Redis remembers the size of the AOF file after the -# latest rewrite (if no rewrite has happened since the restart, the size of -# the AOF at startup is used). -# -# This base size is compared to the current size. If the current size is -# bigger than the specified percentage, the rewrite is triggered. Also -# you need to specify a minimal size for the AOF file to be rewritten, this -# is useful to avoid rewriting the AOF file even if the percentage increase -# is reached but it is still pretty small. -# -# Specify a percentage of zero in order to disable the automatic AOF -# rewrite feature. - -auto-aof-rewrite-percentage 100 -auto-aof-rewrite-min-size 64mb - -################################ LUA SCRIPTING ############################### - -# Max execution time of a Lua script in milliseconds. -# -# If the maximum execution time is reached Redis will log that a script is -# still in execution after the maximum allowed time and will start to -# reply to queries with an error. -# -# When a long running script exceed the maximum execution time only the -# SCRIPT KILL and SHUTDOWN NOSAVE commands are available. The first can be -# used to stop a script that did not yet called write commands. The second -# is the only way to shut down the server in the case a write commands was -# already issue by the script but the user don't want to wait for the natural -# termination of the script. -# -# Set it to 0 or a negative value for unlimited execution without warnings. -lua-time-limit 5000 - -################################## SLOW LOG ################################### - -# The Redis Slow Log is a system to log queries that exceeded a specified -# execution time. The execution time does not include the I/O operations -# like talking with the client, sending the reply and so forth, -# but just the time needed to actually execute the command (this is the only -# stage of command execution where the thread is blocked and can not serve -# other requests in the meantime). -# -# You can configure the slow log with two parameters: one tells Redis -# what is the execution time, in microseconds, to exceed in order for the -# command to get logged, and the other parameter is the length of the -# slow log. When a new command is logged the oldest one is removed from the -# queue of logged commands. - -# The following time is expressed in microseconds, so 1000000 is equivalent -# to one second. Note that a negative number disables the slow log, while -# a value of zero forces the logging of every command. -slowlog-log-slower-than 10000 - -# There is no limit to this length. Just be aware that it will consume memory. -# You can reclaim memory used by the slow log with SLOWLOG RESET. -slowlog-max-len 128 - -############################# Event notification ############################## - -# Redis can notify Pub/Sub clients about events happening in the key space. -# This feature is documented at http://redis.io/topics/keyspace-events -# -# For instance if keyspace events notification is enabled, and a client -# performs a DEL operation on key "foo" stored in the Database 0, two -# messages will be published via Pub/Sub: -# -# PUBLISH __keyspace@0__:foo del -# PUBLISH __keyevent@0__:del foo -# -# It is possible to select the events that Redis will notify among a set -# of classes. Every class is identified by a single character: -# -# K Keyspace events, published with __keyspace@__ prefix. -# E Keyevent events, published with __keyevent@__ prefix. -# g Generic commands (non-type specific) like DEL, EXPIRE, RENAME, ... -# $ String commands -# l List commands -# s Set commands -# h Hash commands -# z Sorted set commands -# x Expired events (events generated every time a key expires) -# e Evicted events (events generated when a key is evicted for maxmemory) -# A Alias for g$lshzxe, so that the "AKE" string means all the events. -# -# The "notify-keyspace-events" takes as argument a string that is composed -# by zero or multiple characters. The empty string means that notifications -# are disabled at all. -# -# Example: to enable list and generic events, from the point of view of the -# event name, use: -# -# notify-keyspace-events Elg -# -# Example 2: to get the stream of the expired keys subscribing to channel -# name __keyevent@0__:expired use: -# -# notify-keyspace-events Ex -# -# By default all notifications are disabled because most users don't need -# this feature and the feature has some overhead. Note that if you don't -# specify at least one of K or E, no events will be delivered. -notify-keyspace-events "" - -############################### ADVANCED CONFIG ############################### - -# Hashes are encoded using a memory efficient data structure when they have a -# small number of entries, and the biggest entry does not exceed a given -# threshold. These thresholds can be configured using the following directives. -hash-max-ziplist-entries 512 -hash-max-ziplist-value 64 - -# Similarly to hashes, small lists are also encoded in a special way in order -# to save a lot of space. The special representation is only used when -# you are under the following limits: -list-max-ziplist-entries 512 -list-max-ziplist-value 64 - -# Sets have a special encoding in just one case: when a set is composed -# of just strings that happens to be integers in radix 10 in the range -# of 64 bit signed integers. -# The following configuration setting sets the limit in the size of the -# set in order to use this special memory saving encoding. -set-max-intset-entries 512 - -# Similarly to hashes and lists, sorted sets are also specially encoded in -# order to save a lot of space. This encoding is only used when the length and -# elements of a sorted set are below the following limits: -zset-max-ziplist-entries 128 -zset-max-ziplist-value 64 - -# Active rehashing uses 1 millisecond every 100 milliseconds of CPU time in -# order to help rehashing the main Redis hash table (the one mapping top-level -# keys to values). The hash table implementation Redis uses (see dict.c) -# performs a lazy rehashing: the more operation you run into a hash table -# that is rehashing, the more rehashing "steps" are performed, so if the -# server is idle the rehashing is never complete and some more memory is used -# by the hash table. -# -# The default is to use this millisecond 10 times every second in order to -# active rehashing the main dictionaries, freeing memory when possible. -# -# If unsure: -# use "activerehashing no" if you have hard latency requirements and it is -# not a good thing in your environment that Redis can reply form time to time -# to queries with 2 milliseconds delay. -# -# use "activerehashing yes" if you don't have such hard requirements but -# want to free memory asap when possible. -activerehashing yes - -# The client output buffer limits can be used to force disconnection of clients -# that are not reading data from the server fast enough for some reason (a -# common reason is that a Pub/Sub client can't consume messages as fast as the -# publisher can produce them). -# -# The limit can be set differently for the three different classes of clients: -# -# normal -> normal clients -# slave -> slave clients and MONITOR clients -# pubsub -> clients subscribed to at least one pubsub channel or pattern -# -# The syntax of every client-output-buffer-limit directive is the following: -# -# client-output-buffer-limit -# -# A client is immediately disconnected once the hard limit is reached, or if -# the soft limit is reached and remains reached for the specified number of -# seconds (continuously). -# So for instance if the hard limit is 32 megabytes and the soft limit is -# 16 megabytes / 10 seconds, the client will get disconnected immediately -# if the size of the output buffers reach 32 megabytes, but will also get -# disconnected if the client reaches 16 megabytes and continuously overcomes -# the limit for 10 seconds. -# -# By default normal clients are not limited because they don't receive data -# without asking (in a push way), but just after a request, so only -# asynchronous clients may create a scenario where data is requested faster -# than it can read. -# -# Instead there is a default limit for pubsub and slave clients, since -# subscribers and slaves receive data in a push fashion. -# -# Both the hard or the soft limit can be disabled by setting them to zero. -client-output-buffer-limit normal 0 0 0 -client-output-buffer-limit slave 256mb 64mb 60 -client-output-buffer-limit pubsub 32mb 8mb 60 - -# Redis calls an internal function to perform many background tasks, like -# closing connections of clients in timeout, purging expired keys that are -# never requested, and so forth. -# -# Not all tasks are performed with the same frequency, but Redis checks for -# tasks to perform accordingly to the specified "hz" value. -# -# By default "hz" is set to 10. Raising the value will use more CPU when -# Redis is idle, but at the same time will make Redis more responsive when -# there are many keys expiring at the same time, and timeouts may be -# handled with more precision. -# -# The range is between 1 and 500, however a value over 100 is usually not -# a good idea. Most users should use the default of 10 and raise this up to -# 100 only in environments where very low latency is required. -hz 10 - -# When a child rewrites the AOF file, if the following option is enabled -# the file will be fsync-ed every 32 MB of data generated. This is useful -# in order to commit the file to the disk more incrementally and avoid -# big latency spikes. -aof-rewrite-incremental-fsync yes - -# Zulip-specific configuration: disable saving to disk. -save "" diff --git a/custom_zulip_files/puppet/zulip/files/supervisor/conf.d/zulip.conf b/custom_zulip_files/puppet/zulip/files/supervisor/conf.d/zulip.conf deleted file mode 100644 index 827030d..0000000 --- a/custom_zulip_files/puppet/zulip/files/supervisor/conf.d/zulip.conf +++ /dev/null @@ -1,280 +0,0 @@ -; Supervisor config file. -; on Debian squeeze, place me in /etc/supervisor/conf.d/zulip.conf -; -; For more information on the config file, please see: -; http://supervisord.org/configuration.html -; -; Note: shell expansion ("~" or "$HOME") is not supported. Environment -; variables can be expanded using this syntax: "%(ENV_HOME)s". - -[fcgi-program:zulip-django] -command=python2.7 /home/zulip/deployments/current/manage.py runfcgi daemonize=False maxchildren=20 ; the program (relative uses PATH, can take args) -;process_name=%(program_name)s ; process_name expr (default %(program_name)s) -;numprocs=1 ; number of processes copies to start (def 1) -;directory=/tmp ; directory to cwd to before exec (def no cwd) -;umask=022 ; umask for process (default None) -priority=100 ; the relative start priority (default 999) -autostart=true ; start at supervisord start (default: true) -autorestart=true ; whether/when to restart (default: unexpected) -;startsecs=1 ; number of secs prog must stay running (def. 1) -;startretries=3 ; max # of serial start failures (default 3) -;exitcodes=0,2 ; 'expected' exit codes for process (default 0,2) -stopsignal=HUP ; signal used to kill process (default TERM) -stopwaitsecs=30 ; max num secs to wait b4 SIGKILL (default 10) -;stopasgroup=false ; send stop signal to the UNIX process group (default false) -;killasgroup=false ; SIGKILL the UNIX process group (def false) -user=zulip ; setuid to this UNIX account to run the program -redirect_stderr=true ; redirect proc stderr to stdout (default false) -stdout_logfile=/var/log/zulip/django.log ; stdout log path, NONE for none; default AUTO -stdout_logfile_maxbytes=1GB ; max # logfile bytes b4 rotation (default 50MB) -stdout_logfile_backups=10 ; # of stdout logfile backups (default 10) -;stdout_capture_maxbytes=1MB ; number of bytes in 'capturemode' (default 0) -;stdout_events_enabled=false ; emit events on stdout writes (default false) -;stderr_logfile=/var/log/zulip/app.err ; stderr log path, NONE for none; default AUTO -;stderr_logfile_maxbytes=1MB ; max # logfile bytes b4 rotation (default 50MB) -;stderr_logfile_backups=10 ; # of stderr logfile backups (default 10) -;stderr_capture_maxbytes=1MB ; number of bytes in 'capturemode' (default 0) -;stderr_events_enabled=false ; emit events on stderr writes (default false) -;environment=A=1,B=2 ; process environment additions (def no adds) -;serverurl=AUTO ; override serverurl computation (childutils) -directory=/home/zulip/deployments/current/ -socket=unix:///home/zulip/deployments/fastcgi-socket -socket_owner=zulip:zulip -socket_mode=0700 - -[program:zulip-tornado] -command=python2.7 /home/zulip/deployments/current/manage.py runtornado localhost:9993 -priority=200 ; the relative start priority (default 999) -autostart=true ; start at supervisord start (default: true) -autorestart=true ; whether/when to restart (default: unexpected) -stopsignal=TERM ; signal used to kill process (default TERM) -stopwaitsecs=30 ; max num secs to wait b4 SIGKILL (default 10) -user=zulip ; setuid to this UNIX account to run the program -redirect_stderr=true ; redirect proc stderr to stdout (default false) -stdout_logfile=/var/log/zulip/tornado.log ; stdout log path, NONE for none; default AUTO -stdout_logfile_maxbytes=1GB ; max # logfile bytes b4 rotation (default 50MB) -stdout_logfile_backups=10 ; # of stdout logfile backups (default 10) -directory=/home/zulip/deployments/current/ - -[program:zulip-events-user-activity] -command=python2.7 /home/zulip/deployments/current/manage.py process_queue user_activity -priority=300 ; the relative start priority (default 999) -autostart=true ; start at supervisord start (default: true) -autorestart=true ; whether/when to restart (default: unexpected) -stopsignal=TERM ; signal used to kill process (default TERM) -stopwaitsecs=30 ; max num secs to wait b4 SIGKILL (default 10) -user=zulip ; setuid to this UNIX account to run the program -redirect_stderr=true ; redirect proc stderr to stdout (default false) -stdout_logfile=/var/log/zulip/events-user-activity.log ; stdout log path, NONE for none; default AUTO -stdout_logfile_maxbytes=1GB ; max # logfile bytes b4 rotation (default 50MB) -stdout_logfile_backups=10 ; # of stdout logfile backups (default 10) -directory=/home/zulip/deployments/current/ - -[program:zulip-events-user-activity-interval] -command=python2.7 /home/zulip/deployments/current/manage.py process_queue user_activity_interval -priority=300 ; the relative start priority (default 999) -autostart=true ; start at supervisord start (default: true) -autorestart=true ; whether/when to restart (default: unexpected) -stopsignal=TERM ; signal used to kill process (default TERM) -stopwaitsecs=30 ; max num secs to wait b4 SIGKILL (default 10) -user=zulip ; setuid to this UNIX account to run the program -redirect_stderr=true ; redirect proc stderr to stdout (default false) -stdout_logfile=/var/log/zulip/events-user-activity-interval.log ; stdout log path, NONE for none; default AUTO -stdout_logfile_maxbytes=1GB ; max # logfile bytes b4 rotation (default 50MB) -stdout_logfile_backups=10 ; # of stdout logfile backups (default 10) -directory=/home/zulip/deployments/current/ - -[program:zulip-events-user-presence] -command=python2.7 /home/zulip/deployments/current/manage.py process_queue user_presence -priority=300 ; the relative start priority (default 999) -autostart=true ; start at supervisord start (default: true) -autorestart=true ; whether/when to restart (default: unexpected) -stopsignal=TERM ; signal used to kill process (default TERM) -stopwaitsecs=30 ; max num secs to wait b4 SIGKILL (default 10) -user=zulip ; setuid to this UNIX account to run the program -redirect_stderr=true ; redirect proc stderr to stdout (default false) -stdout_logfile=/var/log/zulip/events-user-presence.log ; stdout log path, NONE for none; default AUTO -stdout_logfile_maxbytes=1GB ; max # logfile bytes b4 rotation (default 50MB) -stdout_logfile_backups=10 ; # of stdout logfile backups (default 10) -directory=/home/zulip/deployments/current/ - -[program:zulip-events-signups] -command=python2.7 /home/zulip/deployments/current/manage.py process_queue signups -priority=400 ; the relative start priority (default 999) -autostart=true ; start at supervisord start (default: true) -autorestart=true ; whether/when to restart (default: unexpected) -stopsignal=TERM ; signal used to kill process (default TERM) -stopwaitsecs=30 ; max num secs to wait b4 SIGKILL (default 10) -user=zulip ; setuid to this UNIX account to run the program -redirect_stderr=true ; redirect proc stderr to stdout (default false) -stdout_logfile=/var/log/zulip/events-signups.log ; stdout log path, NONE for none; default AUTO -stdout_logfile_maxbytes=1GB ; max # logfile bytes b4 rotation (default 50MB) -stdout_logfile_backups=10 ; # of stdout logfile backups (default 10) -directory=/home/zulip/deployments/current/ - -[program:zulip-events-confirmation-emails] -command=python2.7 /home/zulip/deployments/current/manage.py process_queue invites -priority=500 ; the relative start priority (default 999) -autostart=true ; start at supervisord start (default: true) -autorestart=true ; whether/when to restart (default: unexpected) -stopsignal=TERM ; signal used to kill process (default TERM) -stopwaitsecs=30 ; max num secs to wait b4 SIGKILL (default 10) -user=zulip ; setuid to this UNIX account to run the program -redirect_stderr=true ; redirect proc stderr to stdout (default false) -stdout_logfile=/var/log/zulip/events-confirmation-emails.log ; stdout log path, NONE for none; default AUTO -stdout_logfile_maxbytes=1GB ; max # logfile bytes b4 rotation (default 50MB) -stdout_logfile_backups=10 ; # of stdout logfile backups (default 10) -directory=/home/zulip/deployments/current/ - -[program:zulip-events-missedmessage_reminders] -command=python2.7 /home/zulip/deployments/current/manage.py process_queue missedmessage_emails -priority=600 ; the relative start priority (default 999) -autostart=true ; start at supervisord start (default: true) -autorestart=true ; whether/when to restart (default: unexpected) -stopsignal=TERM ; signal used to kill process (default TERM) -stopwaitsecs=30 ; max num secs to wait b4 SIGKILL (default 10) -user=zulip ; setuid to this UNIX account to run the program -redirect_stderr=true ; redirect proc stderr to stdout (default false) -stdout_logfile=/var/log/zulip/events-missedmessage_reminders.log ; stdout log path, NONE for none; default AUTO -stdout_logfile_maxbytes=1GB ; max # logfile bytes b4 rotation (default 50MB) -stdout_logfile_backups=10 ; # of stdout logfile backups (default 10) -directory=/home/zulip/deployments/current/ - -[program:zulip-events-missedmessage_mobile_notifications] -command=python2.7 /home/zulip/deployments/current/manage.py process_queue missedmessage_mobile_notifications -priority=600 ; the relative start priority (default 999) -autostart=true ; start at supervisord start (default: true) -autorestart=true ; whether/when to restart (default: unexpected) -stopsignal=TERM ; signal used to kill process (default TERM) -stopwaitsecs=30 ; max num secs to wait b4 SIGKILL (default 10) -user=zulip ; setuid to this UNIX account to run the program -redirect_stderr=true ; redirect proc stderr to stdout (default false) -stdout_logfile=/var/log/zulip/events-missedmessage_mobile_notifications.log ; stdout log path, NONE for none; default AUTO -stdout_logfile_maxbytes=1GB ; max # logfile bytes b4 rotation (default 50MB) -stdout_logfile_backups=10 ; # of stdout logfile backups (default 10) -directory=/home/zulip/deployments/current/ - -[program:zulip-events-slowqueries] -command=python2.7 /home/zulip/deployments/current/manage.py process_queue slow_queries -priority=600 ; the relative start priority (default 999) -autostart=true ; start at supervisord start (default: true) -autorestart=true ; whether/when to restart (default: unexpected) -stopsignal=TERM ; signal used to kill process (default TERM) -stopwaitsecs=30 ; max num secs to wait b4 SIGKILL (default 10) -user=zulip ; setuid to this UNIX account to run the program -redirect_stderr=true ; redirect proc stderr to stdout (default false) -stdout_logfile=/var/log/zulip/events-slow_queries.log ; stdout log path, NONE for none; default AUTO -stdout_logfile_maxbytes=1GB ; max # logfile bytes b4 rotation (default 50MB) -stdout_logfile_backups=10 ; # of stdout logfile backups (default 10) -directory=/home/zulip/deployments/current/ - -[program:zulip-events-message_sender] -command=python2.7 /home/zulip/deployments/current/manage.py process_queue message_sender %(process_num)s -process_name=%(program_name)s-%(process_num)s -priority=350 ; the relative start priority (default 999) -autostart=true ; start at supervisord start (default: true) -autorestart=true ; whether/when to restart (default: unexpected) -stopsignal=TERM ; signal used to kill process (default TERM) -stopwaitsecs=30 ; max num secs to wait b4 SIGKILL (default 10) -user=zulip ; setuid to this UNIX account to run the program -redirect_stderr=true ; redirect proc stderr to stdout (default false) -stdout_logfile=/var/log/zulip/events-message_sender.log ; stdout log path, NONE for none; default AUTO -stdout_logfile_maxbytes=1GB ; max # logfile bytes b4 rotation (default 50MB) -stdout_logfile_backups=10 ; # of stdout logfile backups (default 10) -directory=/home/zulip/deployments/current/ -numprocs=5 - -[program:zulip-events-feedback_messages] -command=python2.7 /home/zulip/deployments/current/manage.py process_queue feedback_messages -priority=600 ; the relative start priority (default 999) -autostart=true ; start at supervisord start (default: true) -autorestart=true ; whether/when to restart (default: unexpected) -stopsignal=TERM ; signal used to kill process (default TERM) -stopwaitsecs=30 ; max num secs to wait b4 SIGKILL (default 10) -user=zulip ; setuid to this UNIX account to run the program -redirect_stderr=true ; redirect proc stderr to stdout (default false) -stdout_logfile=/var/log/zulip/events-feedback_messages.log ; stdout log path, NONE for none; default AUTO -stdout_logfile_maxbytes=1GB ; max # logfile bytes b4 rotation (default 50MB) -stdout_logfile_backups=10 ; # of stdout logfile backups (default 10) -directory=/home/zulip/deployments/current/ - -[program:zulip-events-error_reports] -command=python2.7 /home/zulip/deployments/current/manage.py process_queue error_reports -priority=600 ; the relative start priority (default 999) -autostart=true ; start at supervisord start (default: true) -autorestart=true ; whether/when to restart (default: unexpected) -stopsignal=TERM ; signal used to kill process (default TERM) -stopwaitsecs=30 ; max num secs to wait b4 SIGKILL (default 10) -user=zulip ; setuid to this UNIX account to run the program -redirect_stderr=true ; redirect proc stderr to stdout (default false) -stdout_logfile=/var/log/zulip/events-error_reports.log ; stdout log path, NONE for none; default AUTO -stdout_logfile_maxbytes=1GB ; max # logfile bytes b4 rotation (default 50MB) -stdout_logfile_backups=10 ; # of stdout logfile backups (default 10) -directory=/home/zulip/deployments/current/ - -[program:zulip-events-digest_emails] -command=python2.7 /home/zulip/deployments/current/manage.py process_queue digest_emails -priority=600 ; the relative start priority (default 999) -autostart=true ; start at supervisord start (default: true) -autorestart=true ; whether/when to restart (default: unexpected) -stopsignal=TERM ; signal used to kill process (default TERM) -stopwaitsecs=30 ; max num secs to wait b4 SIGKILL (default 10) -user=zulip ; setuid to this UNIX account to run the program -redirect_stderr=true ; redirect proc stderr to stdout (default false) -stdout_logfile=/var/log/zulip/events-digest_emails.log ; stdout log path, NONE for none; default AUTO -stdout_logfile_maxbytes=1GB ; max # logfile bytes b4 rotation (default 50MB) -stdout_logfile_backups=10 ; # of stdout logfile backups (default 10) -directory=/home/zulip/deployments/current/ - -[program:zulip-events-email_mirror] -command=python2.7 /home/zulip/deployments/current/manage.py process_queue email_mirror -priority=600 ; the relative start priority (default 999) -autostart=true ; start at supervisord start (default: true) -autorestart=true ; whether/when to restart (default: unexpected) -stopsignal=TERM ; signal used to kill process (default TERM) -stopwaitsecs=30 ; max num secs to wait b4 SIGKILL (default 10) -user=zulip ; setuid to this UNIX account to run the program -redirect_stderr=true ; redirect proc stderr to stdout (default false) -stdout_logfile=/var/log/zulip/events-email_mirror.log ; stdout log path, NONE for none; default AUTO -stdout_logfile_maxbytes=1GB ; max # logfile bytes b4 rotation (default 50MB) -stdout_logfile_backups=10 ; # of stdout logfile backups (default 10) -directory=/home/zulip/deployments/current/ - -[program:zulip-deliver-enqueued-emails] -command=python2.7 /home/zulip/deployments/current/manage.py deliver_email -priority=600 ; the relative start priority (default 999) -autostart=true ; start at supervisord start (default: true) -autorestart=true ; whether/when to restart (default: unexpected) -stopsignal=TERM ; signal used to kill process (default TERM) -stopwaitsecs=30 ; max num secs to wait b4 SIGKILL (default 10) -user=zulip ; setuid to this UNIX account to run the program -redirect_stderr=true ; redirect proc stderr to stdout (default false) -stdout_logfile=/var/log/zulip/events-deliver_enqueued_emails.log ; stdout log path, NONE for none; default AUTO -stdout_logfile_maxbytes=1GB ; max # logfile bytes b4 rotation (default 50MB) -stdout_logfile_backups=10 ; # of stdout logfile backups (default 10) -directory=/home/zulip/deployments/current/ - - -; The below sample group section shows all possible group values, -; create one or more 'real' group: sections to create "heterogeneous" -; process groups. - -[group:zulip-workers] -; each refers to 'x' in [program:x] definitions -programs=zulip-events-user-activity,zulip-events-user-activity-interval,zulip-events-user-presence,zulip-events-signups,zulip-events-confirmation-emails,zulip-events-missedmessage_reminders,zulip-events-slowqueries,zulip-events-feedback_messages,zulip-events-digest_emails,zulip-events-error_reports,zulip-deliver-enqueued-emails,zulip-events-missedmessage_mobile_notifications,zulip-events-email_mirror - -[group:zulip-senders] -programs=zulip-events-message_sender - -; The [include] section can just contain the "files" setting. This -; setting can list multiple files (separated by whitespace or -; newlines). It can also contain wildcards. The filenames are -; interpreted as relative to this file. Included files *cannot* -; include files themselves. - -;[include] -;files = relative/directory/*.ini - -;enable server restarts without requiring superuser access. This assumes that this is the only service being controlled by supervisord on this machine. -[unix_http_server] -chown=zulip:zulip diff --git a/custom_zulip_files/puppet/zulip/files/supervisor/conf.d/zulip_db.conf b/custom_zulip_files/puppet/zulip/files/supervisor/conf.d/zulip_db.conf deleted file mode 100644 index 677b9b0..0000000 --- a/custom_zulip_files/puppet/zulip/files/supervisor/conf.d/zulip_db.conf +++ /dev/null @@ -1,10 +0,0 @@ -[program:process-fts-updates] -command=/usr/local/bin/process_fts_updates -priority=600 ; the relative start priority (default 999) -autostart=true ; start at supervisord start (default: true) -autorestart=true ; whether/when to restart (default: unexpected) -stopsignal=TERM ; signal used to kill process (default TERM) -stopwaitsecs=30 ; max num secs to wait b4 SIGKILL (default 10) -user=zulip ; setuid to this UNIX account to run the program -redirect_stderr=true ; redirect proc stderr to stdout (default false) -stdout_logfile=/var/log/zulip/fts-updates.log ; stdout log path, NONE for none; default AUTO diff --git a/custom_zulip_files/puppet/zulip/files/supervisor/supervisord.conf b/custom_zulip_files/puppet/zulip/files/supervisor/supervisord.conf deleted file mode 100644 index c097365..0000000 --- a/custom_zulip_files/puppet/zulip/files/supervisor/supervisord.conf +++ /dev/null @@ -1,30 +0,0 @@ -; supervisor config file - -[unix_http_server] -file=/var/run/supervisor.sock ; (the path to the socket file) -chmod=0700 ; socket file mode (default 0700) -chown=zulip - -[supervisord] -logfile=/var/log/supervisor/supervisord.log ; (main log file;default $CWD/supervisord.log) -pidfile=/var/run/supervisord.pid ; (supervisord pidfile;default supervisord.pid) -childlogdir=/var/log/supervisor ; ('AUTO' child log dir, default $TEMP) -minfds=40000 ; file descriptor limit for children - -; the below section must remain in the config file for RPC -; (supervisorctl/web interface) to work, additional interfaces may be -; added by defining them in separate rpcinterface: sections -[rpcinterface:supervisor] -supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface - -[supervisorctl] -serverurl=unix:///var/run/supervisor.sock ; use a unix:// URL for a unix socket - -; The [include] section can just contain the "files" setting. This -; setting can list multiple files (separated by whitespace or -; newlines). It can also contain wildcards. The filenames are -; interpreted as relative to this file. Included files *cannot* -; include files themselves. - -[include] -files = /etc/supervisor/conf.d/*.conf diff --git a/custom_zulip_files/puppet/zulip/lib/puppet/type/apache2mod.rb b/custom_zulip_files/puppet/zulip/lib/puppet/type/apache2mod.rb deleted file mode 100644 index 7aa1504..0000000 --- a/custom_zulip_files/puppet/zulip/lib/puppet/type/apache2mod.rb +++ /dev/null @@ -1,21 +0,0 @@ -Puppet::Type.newtype(:apache2mod) do - ensurable - newparam(:name) do - desc "The name of the module to enable" - isnamevar - end -end - -Puppet::Type.type(:apache2mod).provide(:apache2mod) do - def exists? - File.exists?("/etc/apache2/mods-enabled/" + resource[:name] + ".load") - end - - def create - system("a2enmod #{@resource[:name]}") - end - - def destroy - system("a2dismod #{@resource[:name]}") - end -end diff --git a/custom_zulip_files/puppet/zulip/lib/puppet/type/apache2site.rb b/custom_zulip_files/puppet/zulip/lib/puppet/type/apache2site.rb deleted file mode 100644 index 103e504..0000000 --- a/custom_zulip_files/puppet/zulip/lib/puppet/type/apache2site.rb +++ /dev/null @@ -1,21 +0,0 @@ -Puppet::Type.newtype(:apache2site) do - ensurable - newparam(:name) do - desc "The name of the site to enable" - isnamevar - end -end - -Puppet::Type.type(:apache2site).provide(:apache2site) do - def exists? - File.exists?("/etc/apache2/sites-enabled/" + resource[:name]) - end - - def create - system("a2ensite #{@resource[:name]}") - end - - def destroy - system("a2ensite #{@resource[:name]}") - end -end diff --git a/custom_zulip_files/puppet/zulip/lib/puppet/type/chroot.rb b/custom_zulip_files/puppet/zulip/lib/puppet/type/chroot.rb deleted file mode 100644 index cd7f500..0000000 --- a/custom_zulip_files/puppet/zulip/lib/puppet/type/chroot.rb +++ /dev/null @@ -1,31 +0,0 @@ -Puppet::Type.newtype(:chroot) do - ensurable - newparam(:release) do - desc "The name of the release" - isnamevar - end - newparam(:distro) do - desc "The name of the Linux distribution (Debian, Ubuntu)" - end -end - -Puppet::Type.type(:chroot).provide(:chroot) do - def exists? - File.exists?("/var/lib/schroot/chroots/" + resource[:release] + "-amd64") - end - - def create - if @resource[:distro] == "ubuntu" - mirror = "http://mirror.cc.columbia.edu/pub/linux/ubuntu/archive/" - else - mirror = "http://mirror.cc.columbia.edu/debian" - end - ["amd64", "i386"].each { |x| - system("mk-sbuild #{@resource[:release]} --arch=#{x} --debootstrap-mirror=#{mirror} --distro=#{@resource[:distro]}") - } - end - - def destroy - system("rm -rf /var/lib/schroot/chroots/#{@resource[:release]}-*") - end -end diff --git a/custom_zulip_files/puppet/zulip/manifests/apache_sso.pp b/custom_zulip_files/puppet/zulip/manifests/apache_sso.pp deleted file mode 100644 index ab32067..0000000 --- a/custom_zulip_files/puppet/zulip/manifests/apache_sso.pp +++ /dev/null @@ -1,30 +0,0 @@ -class zulip::apache_sso { - include zulip::localhost_sso - - $apache_packages = [ "apache2", "libapache2-mod-wsgi", ] - package { $apache_packages: ensure => "installed" } - - apache2mod { [ "headers", "proxy", "proxy_http", "rewrite", "ssl", ]: - ensure => present, - require => Package['apache2'], - } - - file { "/etc/apache2/ports.conf": - require => Package[apache2], - ensure => file, - owner => "root", - group => "root", - mode => 640, - source => "puppet:///modules/zulip/apache/ports.conf", - } - - file { "/etc/apache2/sites-available/": - recurse => true, - require => Package[apache2], - owner => "root", - group => "root", - mode => 640, - source => "puppet:///modules/zulip/apache/sites/", - } - -} diff --git a/custom_zulip_files/puppet/zulip/manifests/app_frontend.pp b/custom_zulip_files/puppet/zulip/manifests/app_frontend.pp deleted file mode 100644 index ffaaf72..0000000 --- a/custom_zulip_files/puppet/zulip/manifests/app_frontend.pp +++ /dev/null @@ -1,38 +0,0 @@ -# Default configuration for a Zulip app frontend -class zulip::app_frontend { - include zulip::app_frontend_base - - file { "/etc/nginx/sites-available/zulip-enterprise": - require => Package["nginx-full"], - ensure => file, - owner => "root", - group => "root", - mode => 644, - source => "puppet:///modules/zulip/nginx/sites-available/zulip-enterprise", - notify => Service["nginx"], - } - file { '/etc/nginx/sites-enabled/zulip-enterprise': - require => Package["nginx-full"], - ensure => 'link', - target => '/etc/nginx/sites-available/zulip-enterprise', - notify => Service["nginx"], - } - - # Trigger daily digest e-mails - file { "/etc/cron.d/send-digest-emails": - ensure => file, - owner => "root", - group => "root", - mode => 644, - source => "puppet:///modules/zulip/cron.d/send-digest-emails", - } - - # Restart the server regularly to avoid potential memory leak problems. - file { "/etc/cron.d/restart-zulip": - ensure => file, - owner => "root", - group => "root", - mode => 644, - source => "puppet:///modules/zulip/cron.d/restart-zulip", - } -} diff --git a/custom_zulip_files/puppet/zulip/manifests/app_frontend_base.pp b/custom_zulip_files/puppet/zulip/manifests/app_frontend_base.pp deleted file mode 100644 index 16741a3..0000000 --- a/custom_zulip_files/puppet/zulip/manifests/app_frontend_base.pp +++ /dev/null @@ -1,145 +0,0 @@ -# Minimal configuration to run a Zulip application server. -# Default nginx configuration is included in extension app_frontend.pp. -class zulip::app_frontend_base { - include zulip::nginx - include zulip::supervisor - - $web_packages = [ # Needed for memcached usage - "python-pylibmc", - # Fast JSON parser - "python-ujson", - # Django dependencies - "python-django", - "python-django-guardian", - "python-django-pipeline", - "python-django-bitfield", - # Needed for mock objects in decorators - "python-mock", - # Tornado dependencies - "python-tornado", - "python-sockjs-tornado", - # Needed for our fastcgi setup - "python-flup", - # Needed for markdown processing - "python-markdown", - "python-pygments", - # Used for Hesiod lookups, etc. - "python-dns", - # Needed to access our database - "postgresql-client-${zulip::base::postgres_version}", - "python-psycopg2", - # Needed for building complex DB queries - "python-sqlalchemy", - # Needed for integrations - "python-twitter", - "python-defusedxml", - # Needed for the email mirror - "python-twisted", - "python-html2text", - # Needed to access rabbitmq - "python-pika", - # Needed for timezone work - "python-tz", - # Needed to parse source maps for error reporting - "python-sourcemap", - # Needed for redis - "python-redis", - # Needed for S3 file uploads - "python-boto", - # Needed to send email - "python-mandrill", - # Needed to generate diffs for edits - "python-diff-match-patch", - # Needed for iOS - "python-apns-client", - # Needed for Android push - "python-gcm-client", - # Needed for avatar image resizing - "python-imaging", - # Needed for LDAP support - "python-django-auth-ldap", - # Needed for Google Apps mobile auth - "python-googleapi", - # Needed for JWT-based auth - "python-pyjwt", - ] - define safepackage ( $ensure = present ) { - if !defined(Package[$title]) { - package { $title: ensure => $ensure } - } - } - safepackage { $web_packages: ensure => "installed" } - - file { "/etc/nginx/zulip-include/app": - require => Package["nginx-full"], - owner => "root", - group => "root", - mode => 644, - source => "puppet:///modules/zulip/nginx/zulip-include-frontend/app", - notify => Service["nginx"], - } - file { "/etc/nginx/zulip-include/upstreams": - require => Package["nginx-full"], - owner => "root", - group => "root", - mode => 644, - source => "puppet:///modules/zulip/nginx/zulip-include-frontend/upstreams", - notify => Service["nginx"], - } - file { "/etc/nginx/zulip-include/uploads.types": - require => Package["nginx-full"], - owner => "root", - group => "root", - mode => 644, - source => "puppet:///modules/zulip/nginx/zulip-include-frontend/uploads.types", - notify => Service["nginx"], - } - file { "/etc/nginx/zulip-include/app.d/": - ensure => directory, - owner => "root", - group => "root", - mode => 755, - } - file { "/etc/supervisor/conf.d/zulip.conf": - require => Package[supervisor], - ensure => file, - owner => "root", - group => "root", - mode => 644, - source => "puppet:///modules/zulip/supervisor/conf.d/zulip.conf", - notify => Service["supervisor"], - } - file { "/home/zulip/tornado": - ensure => directory, - owner => "zulip", - group => "zulip", - mode => 755, - } - file { '/home/zulip/logs': - ensure => 'directory', - owner => 'zulip', - group => 'zulip', - } - file { '/home/zulip/prod-static': - ensure => 'directory', - owner => 'zulip', - group => 'zulip', - } - file { '/home/zulip/deployments': - ensure => 'directory', - owner => 'zulip', - group => 'zulip', - } - file { "/etc/cron.d/email-mirror": - ensure => absent, - } - file { "/usr/lib/nagios/plugins/zulip_app_frontend": - require => Package[nagios-plugins-basic], - recurse => true, - purge => true, - owner => "root", - group => "root", - mode => 755, - source => "puppet:///modules/zulip/nagios_plugins/zulip_app_frontend", - } -} diff --git a/custom_zulip_files/puppet/zulip/manifests/apt_repository.pp b/custom_zulip_files/puppet/zulip/manifests/apt_repository.pp deleted file mode 100644 index 7d4810b..0000000 --- a/custom_zulip_files/puppet/zulip/manifests/apt_repository.pp +++ /dev/null @@ -1,12 +0,0 @@ -# This depends on zulip::base having already been evaluated -class zulip::apt_repository { - apt::source {'zulip': - location => 'http://ppa.launchpad.net/tabbott/zulip/ubuntu', - release => $zulip::base::release_name, - repos => 'main', - key => '84C2BE60E50E336456E4749CE84240474E26AE47', - key_source => 'https://zulip.com/dist/keys/zulip.asc', - pin => '995', - include_src => true, - } -} diff --git a/custom_zulip_files/puppet/zulip/manifests/base.pp b/custom_zulip_files/puppet/zulip/manifests/base.pp deleted file mode 100644 index 85f1f59..0000000 --- a/custom_zulip_files/puppet/zulip/manifests/base.pp +++ /dev/null @@ -1,96 +0,0 @@ -class zulip::base { - include apt - $base_packages = [ # Accurate time is essential - "ntp", - # Dependencies of our API - "python-requests", - "python-simplejson", - "python-typing", - # For development/debugging convenience - "ipython", - # Used in scripts - "netcat", - # Nagios plugins; needed to ensure /var/lib/nagios_plugins exists - "nagios-plugins-basic", - ] - package { $base_packages: ensure => "installed" } - - $release_name = $operatingsystemrelease ? { - # Debian releases - /7.[0-9]*/ => 'wheezy', - /8.[0-9]*/ => 'jessie', - # Ubuntu releases - '12.04' => 'precise', - '14.04' => 'trusty', - '15.04' => 'vivid', - '15.10' => 'wily', - } - - $postgres_version = $release_name ? { - 'wheezy' => '9.1', - 'jessie' => '9.4', - 'precise' => '9.1', - 'trusty' => '9.3', - 'vivid' => '9.4', - 'wily' => '9.4', - } - - group { 'zulip': - ensure => present, - } - - user { 'zulip': - ensure => present, - require => Group['zulip'], - gid => 'zulip', - shell => '/bin/bash', - home => '/home/zulip', - managehome => true, - } - - file { '/etc/zulip': - ensure => 'directory', - mode => 644, - owner => 'zulip', - group => 'zulip', - } - - file { '/etc/security/limits.conf': - ensure => file, - mode => 640, - owner => "root", - group => "root", - source => 'puppet:///modules/zulip/limits.conf', - } - - # This directory is written to by cron jobs for reading by Nagios - file { '/var/lib/nagios_state/': - ensure => directory, - group => 'zulip', - mode => 774, - } - - file { '/var/log/zulip': - ensure => 'directory', - owner => 'zulip', - group => 'zulip', - mode => 640, - } - - file { '/var/log/zulip/queue_error': - ensure => 'directory', - owner => 'zulip', - group => 'zulip', - mode => 640, - } - - file { "/usr/lib/nagios/plugins/zulip_base": - require => Package[nagios-plugins-basic], - recurse => true, - purge => true, - owner => "root", - group => "root", - mode => 755, - source => "puppet:///modules/zulip/nagios_plugins/zulip_base", - } -} diff --git a/custom_zulip_files/puppet/zulip/manifests/camo.pp b/custom_zulip_files/puppet/zulip/manifests/camo.pp deleted file mode 100644 index 8f6a17f..0000000 --- a/custom_zulip_files/puppet/zulip/manifests/camo.pp +++ /dev/null @@ -1,11 +0,0 @@ -class zulip::camo { - $camo_packages = [# Needed for camo - "nodejs", - "camo", - ] - package { $camo_packages: ensure => "installed" } - - # The configuration file is generated at install time -} - - diff --git a/custom_zulip_files/puppet/zulip/manifests/dockervoyager.pp b/custom_zulip_files/puppet/zulip/manifests/dockervoyager.pp index 597c149..1193bc7 100644 --- a/custom_zulip_files/puppet/zulip/manifests/dockervoyager.pp +++ b/custom_zulip_files/puppet/zulip/manifests/dockervoyager.pp @@ -33,4 +33,5 @@ class zulip::dockervoyager { mode => 644, source => "puppet:///modules/zulip/supervisor/conf.d/nginx.conf", } + include zulip::localhost_camo } diff --git a/custom_zulip_files/puppet/zulip/manifests/localhost_sso.pp b/custom_zulip_files/puppet/zulip/manifests/localhost_sso.pp deleted file mode 100644 index 726c40c..0000000 --- a/custom_zulip_files/puppet/zulip/manifests/localhost_sso.pp +++ /dev/null @@ -1,11 +0,0 @@ -class zulip::localhost_sso { - file { "/etc/nginx/zulip-include/app.d/external-sso.conf": - require => Package["nginx-full"], - ensure => file, - owner => "root", - group => "root", - mode => 644, - notify => Service["nginx"], - source => "puppet:///modules/zulip/nginx/zulip-include-app.d/external-sso.conf", - } -} diff --git a/custom_zulip_files/puppet/zulip/manifests/memcached.pp b/custom_zulip_files/puppet/zulip/manifests/memcached.pp deleted file mode 100644 index cc3abf9..0000000 --- a/custom_zulip_files/puppet/zulip/manifests/memcached.pp +++ /dev/null @@ -1,17 +0,0 @@ -class zulip::memcached { - $memcached_packages = ["memcached"] - package { $memcached_packages: ensure => "installed" } - - file { "/etc/memcached.conf": - require => Package[memcached], - ensure => file, - owner => "root", - group => "root", - mode => 644, - source => "puppet:///modules/zulip/memcached.conf", - } - service { 'memcached': - ensure => running, - subscribe => File['/etc/memcached.conf'], - } -} diff --git a/custom_zulip_files/puppet/zulip/manifests/nginx.pp b/custom_zulip_files/puppet/zulip/manifests/nginx.pp deleted file mode 100644 index ec93c2e..0000000 --- a/custom_zulip_files/puppet/zulip/manifests/nginx.pp +++ /dev/null @@ -1,53 +0,0 @@ -class zulip::nginx { - $web_packages = [# Needed to run nginx with the modules we use - "nginx-full", - ] - package { $web_packages: ensure => "installed" } - - file { "/etc/nginx/zulip-include/": - require => Package["nginx-full"], - recurse => true, - owner => "root", - group => "root", - mode => 644, - source => "puppet:///modules/zulip/nginx/zulip-include-common/", - notify => Service["nginx"], - } - - file { "/etc/nginx/nginx.conf": - require => Package["nginx-full"], - ensure => file, - owner => "root", - group => "root", - mode => 644, - notify => Service["nginx"], - source => "puppet:///modules/zulip/nginx/nginx.conf", - } - - file { "/etc/nginx/fastcgi_params": - require => Package["nginx-full"], - ensure => file, - owner => "root", - group => "root", - mode => 644, - notify => Service["nginx"], - source => "puppet:///modules/zulip/nginx/fastcgi_params", - } - - file { "/etc/nginx/sites-enabled/default": - notify => Service["nginx"], - ensure => absent, - } - - file { '/var/log/nginx': - ensure => "directory", - owner => "zulip", - group => "adm", - mode => 650 - } - - service { 'nginx': - ensure => running, - } -} - diff --git a/custom_zulip_files/puppet/zulip/manifests/postfix_localmail.pp b/custom_zulip_files/puppet/zulip/manifests/postfix_localmail.pp deleted file mode 100644 index 125d9c5..0000000 --- a/custom_zulip_files/puppet/zulip/manifests/postfix_localmail.pp +++ /dev/null @@ -1,76 +0,0 @@ -class zulip::postfix_localmail { - $postfix_packages = [ "postfix", ] - - if $fqdn == '' { - fail("Your system does not have a fully-qualified domain name defined. See hostname(1).") - } - package { $postfix_packages: - ensure => "installed", - require => File['/etc/mailname'], - } - - service { 'postfix': - } - - file {'/etc/mailname': - ensure => file, - mode => 0644, - owner => root, - group => root, - content => "${fqdn}", - } - - file {'/etc/postfix/main.cf': - ensure => file, - mode => 0644, - owner => root, - group => root, - content => template('zulip/postfix/main.cf.erb'), - require => Package[postfix], - notify => Service['postfix'], - } - file {'/etc/postfix/master.cf': - ensure => file, - mode => 0644, - owner => root, - group => root, - source => "puppet:///modules/zulip/postfix/master.cf", - require => Package[postfix], - notify => Service['postfix'], - } - - file {'/etc/postfix/virtual': - ensure => file, - mode => 0644, - owner => root, - group => root, - source => "puppet:///modules/zulip/postfix/virtual", - require => Package[postfix], - } - exec {'postmap /etc/postfix/virtual': - subscribe => File['/etc/postfix/virtual'], - refreshonly => true, - require => [ - File['/etc/postfix/main.cf'], - Package[postfix], - ], - } - - file {'/etc/postfix/transport': - ensure => file, - mode => 0644, - owner => root, - group => root, - source => "puppet:///modules/zulip/postfix/transport", - require => Package[postfix], - } - exec {'postmap /etc/postfix/transport': - subscribe => File['/etc/postfix/transport'], - refreshonly => true, - require => [ - File['/etc/postfix/main.cf'], - Package[postfix], - ], - } - -} diff --git a/custom_zulip_files/puppet/zulip/manifests/postgres_appdb_base.pp b/custom_zulip_files/puppet/zulip/manifests/postgres_appdb_base.pp deleted file mode 100644 index 437ddf8..0000000 --- a/custom_zulip_files/puppet/zulip/manifests/postgres_appdb_base.pp +++ /dev/null @@ -1,69 +0,0 @@ -# Minimal shared configuration needed to run a Zulip postgres database. -class zulip::postgres_appdb_base { - include zulip::postgres_common - include zulip::supervisor - - $appdb_packages = [# Needed to run process_fts_updates - "python-psycopg2", - # Needed for our full text search system - "postgresql-${zulip::base::postgres_version}-tsearch-extras", - ] - define safepackage ( $ensure = present ) { - if !defined(Package[$title]) { - package { $title: ensure => $ensure } - } - } - safepackage { $appdb_packages: ensure => "installed" } - - # We bundle a bunch of other sysctl parameters into 40-postgresql.conf - file { '/etc/sysctl.d/30-postgresql-shm.conf': - ensure => absent, - } - - file { "/usr/local/bin/process_fts_updates": - ensure => file, - owner => "root", - group => "root", - mode => 755, - source => "puppet:///modules/zulip/postgresql/process_fts_updates", - } - - file { "/etc/supervisor/conf.d/zulip_db.conf": - require => Package[supervisor], - ensure => file, - owner => "root", - group => "root", - mode => 644, - source => "puppet:///modules/zulip/supervisor/conf.d/zulip_db.conf", - notify => Service[supervisor], - } - - file { "/usr/share/postgresql/${zulip::base::postgres_version}/tsearch_data/en_us.dict": - require => Package["postgresql-${zulip::base::postgres_version}"], - ensure => 'link', - target => '/var/cache/postgresql/dicts/en_us.dict', - } - file { "/usr/share/postgresql/${zulip::base::postgres_version}/tsearch_data/en_us.affix": - require => Package["postgresql-${zulip::base::postgres_version}"], - ensure => 'link', - target => '/var/cache/postgresql/dicts/en_us.affix', - } - file { "/usr/share/postgresql/${zulip::base::postgres_version}/tsearch_data/zulip_english.stop": - require => Package["postgresql-${zulip::base::postgres_version}"], - ensure => file, - owner => "root", - group => "root", - mode => 644, - source => "puppet:///modules/zulip/postgresql/zulip_english.stop", - } - file { "/usr/lib/nagios/plugins/zulip_postgres_appdb": - require => Package[nagios-plugins-basic], - recurse => true, - purge => true, - owner => "root", - group => "root", - mode => 755, - source => "puppet:///modules/zulip/nagios_plugins/zulip_postgres_appdb", - } - -} diff --git a/custom_zulip_files/puppet/zulip/manifests/postgres_appdb_tuned.pp b/custom_zulip_files/puppet/zulip/manifests/postgres_appdb_tuned.pp deleted file mode 100644 index c991f5d..0000000 --- a/custom_zulip_files/puppet/zulip/manifests/postgres_appdb_tuned.pp +++ /dev/null @@ -1,55 +0,0 @@ -# postgres_appdb_tuned extends postgres_appdb_base by automatically -# generating tuned database configuration. -class zulip::postgres_appdb_tuned { - include zulip::postgres_appdb_base - - file { "/etc/postgresql/${zulip::base::postgres_version}/main/postgresql.conf.template": - require => Package["postgresql-${zulip::base::postgres_version}"], - ensure => file, - owner => "postgres", - group => "postgres", - mode => 644, - content => template("zulip/postgresql/postgresql.conf.template.erb"), - } - - # We can't use the built-in $memorysize fact because it's a string with human-readable units - $total_memory = regsubst(file('/proc/meminfo'), '^.*MemTotal:\s*(\d+) kB.*$', '\1', 'M') * 1024 - $half_memory = $total_memory / 2 - $half_memory_pages = $half_memory / 4096 - - file {'/etc/sysctl.d/40-postgresql.conf': - ensure => file, - owner => 'root', - group => 'root', - mode => 644, - content => -"kernel.shmall = $half_memory_pages -kernel.shmmax = $half_memory - -# These are the defaults on newer kernels -vm.dirty_ratio = 10 -vm.dirty_background_ratio = 5 -" - } - - exec { "sysctl_p": - command => "/sbin/sysctl -p /etc/sysctl.d/40-postgresql.conf", - subscribe => File['/etc/sysctl.d/40-postgresql.conf'], - refreshonly => true, - } - - exec { 'pgtune': - require => Package["pgtune"], - # Let Postgres use half the memory on the machine - command => "pgtune -T Web -M $half_memory -i /etc/postgresql/${zulip::base::postgres_version}/main/postgresql.conf.template -o /etc/postgresql/${zulip::base::postgres_version}/main/postgresql.conf", - refreshonly => true, - subscribe => File["/etc/postgresql/${zulip::base::postgres_version}/main/postgresql.conf.template"] - } - - exec { "pg_ctlcluster ${zulip::base::postgres_version} main restart": - require => Exec["sysctl_p"], - refreshonly => true, - subscribe => [ Exec['pgtune'], File['/etc/sysctl.d/40-postgresql.conf'] ] - } - -} diff --git a/custom_zulip_files/puppet/zulip/manifests/postgres_common.pp b/custom_zulip_files/puppet/zulip/manifests/postgres_common.pp deleted file mode 100644 index 087c5f2..0000000 --- a/custom_zulip_files/puppet/zulip/manifests/postgres_common.pp +++ /dev/null @@ -1,35 +0,0 @@ -class zulip::postgres_common { - $postgres_packages = [# The database itself - "postgresql-${zulip::base::postgres_version}", - # tools for database setup - "pgtune", - # tools for database monitoring - "ptop", - # Python modules used in our monitoring/worker threads - "python-gevent", - "python-tz", - "python-dateutil", - # our dictionary - "hunspell-en-us", - ] - define safepackage ( $ensure = present ) { - if !defined(Package[$title]) { - package { $title: ensure => $ensure } - } - } - safepackage { $postgres_packages: ensure => "installed" } - - exec { "disable_logrotate": - command => "/usr/bin/dpkg-divert --rename --divert /etc/logrotate.d/postgresql-common.disabled --add /etc/logrotate.d/postgresql-common", - creates => '/etc/logrotate.d/postgresql-common.disabled', - } - file { "/usr/lib/nagios/plugins/zulip_postgres_common": - require => Package[nagios-plugins-basic], - recurse => true, - purge => true, - owner => "root", - group => "root", - mode => 755, - source => "puppet:///modules/zulip/nagios_plugins/zulip_postgres_common", - } -} diff --git a/custom_zulip_files/puppet/zulip/manifests/rabbit.pp b/custom_zulip_files/puppet/zulip/manifests/rabbit.pp deleted file mode 100644 index eeac6f3..0000000 --- a/custom_zulip_files/puppet/zulip/manifests/rabbit.pp +++ /dev/null @@ -1,60 +0,0 @@ -class zulip::rabbit { - $rabbit_packages = [# Needed to run rabbitmq - "erlang-base", - "rabbitmq-server", - ] - package { $rabbit_packages: ensure => "installed" } - - file { "/etc/cron.d/rabbitmq-queuesize": - require => Package[rabbitmq-server], - ensure => file, - owner => "root", - group => "root", - mode => 644, - source => "puppet:///modules/zulip/cron.d/rabbitmq-queuesize", - } - file { "/etc/cron.d/rabbitmq-numconsumers": - require => Package[rabbitmq-server], - ensure => file, - owner => "root", - group => "root", - mode => 644, - source => "puppet:///modules/zulip/cron.d/rabbitmq-numconsumers", - } - - file { "/etc/default/rabbitmq-server": - require => Package[rabbitmq-server], - ensure => file, - owner => "root", - group => "root", - mode => 644, - source => "puppet:///modules/zulip/rabbitmq/rabbitmq-server", - } - - file { "/etc/rabbitmq/rabbitmq.config": - require => Package[rabbitmq-server], - ensure => file, - owner => "root", - group => "root", - mode => 644, - source => "puppet:///modules/zulip/rabbitmq/rabbitmq.config", - } - - # epmd doesn't have an init script. This won't leak epmd processes - # because epmd checks if one is already running and exits if so. - # - # TODO: Ideally we'd still check if it's already running to keep the - # puppet log for what is being changed clean - exec { "epmd": - command => "epmd -daemon", - require => Package[erlang-base], - path => "/usr/bin/:/bin/", - } - - service { "rabbitmq-server": - ensure => running, - require => Exec["epmd"], - } - - # TODO: Should also call exactly once "configure-rabbitmq" -} diff --git a/custom_zulip_files/puppet/zulip/manifests/redis.pp b/custom_zulip_files/puppet/zulip/manifests/redis.pp deleted file mode 100644 index 48401f4..0000000 --- a/custom_zulip_files/puppet/zulip/manifests/redis.pp +++ /dev/null @@ -1,21 +0,0 @@ -class zulip::redis { - $redis_packages = [ # The server itself - "redis-server", - ] - - package { $redis_packages: ensure => "installed" } - - file { "/etc/redis/redis.conf": - require => Package[redis-server], - ensure => file, - owner => "root", - group => "root", - mode => 644, - source => "puppet:///modules/zulip/redis/redis.conf", - } - - service { 'redis-server': - ensure => running, - subscribe => File['/etc/redis/redis.conf'], - } -} diff --git a/custom_zulip_files/puppet/zulip/manifests/supervisor.pp b/custom_zulip_files/puppet/zulip/manifests/supervisor.pp deleted file mode 100644 index 00a1756..0000000 --- a/custom_zulip_files/puppet/zulip/manifests/supervisor.pp +++ /dev/null @@ -1,37 +0,0 @@ -class zulip::supervisor { - $supervisor_packages = [# Needed to run supervisor - "supervisor", - ] - package { $supervisor_packages: ensure => "installed" } - - service { "supervisor": - ensure => running, - require => [File["/var/log/zulip"], - Package["supervisor"], - ], - - hasstatus => true, - status => "supervisorctl status", - - # The "restart" option in the init script does not work. We could - # tell Puppet to fall back to stop/start, which does work, but the - # better option is to tell supervisord to reread its config via - # supervisorctl and then to "update". You need to do both -- - # after a "reread", supervisor won't actually take actual based on - # the changed configuration until you do an "update" (I assume - # this is so you can check if your config file parses without - # doing anything, but it's really confusing) - hasrestart => true, - restart => "bash -c 'supervisorctl reread && supervisorctl update'" - } - - file { "/etc/supervisor/supervisord.conf": - require => Package[supervisor], - ensure => file, - owner => "root", - group => "root", - mode => 644, - source => "puppet:///modules/zulip/supervisor/supervisord.conf", - notify => Service["supervisor"], - } -} diff --git a/custom_zulip_files/puppet/zulip/manifests/voyager.pp b/custom_zulip_files/puppet/zulip/manifests/voyager.pp deleted file mode 100644 index 5b96975..0000000 --- a/custom_zulip_files/puppet/zulip/manifests/voyager.pp +++ /dev/null @@ -1,20 +0,0 @@ -# This class includes all the modules you need to run an entire Zulip -# installation on a single server. If desired, you can split up the -# different components of a Zulip installation on different servers by -# using the modules below on different machines (the module list is -# stored in `puppet_classes` in /etc/zulip/zulip.conf). In general, -# every machine should have `zulip::base` and `zulip::apt_repository` -# included, but the various service modules can be arranged on -# different machines or the same machine as desired (corresponding -# configuration in /etc/zulip/settings.py for how to find the various -# services is also required to make this work). -class zulip::voyager { - include zulip::base - # zulip::apt_repository must come after zulip::base - include zulip::apt_repository - include zulip::app_frontend - include zulip::postgres_appdb_tuned - include zulip::memcached - include zulip::rabbit - include zulip::redis -} diff --git a/custom_zulip_files/puppet/zulip/templates/postfix/main.cf.erb b/custom_zulip_files/puppet/zulip/templates/postfix/main.cf.erb deleted file mode 100644 index 953fc8f..0000000 --- a/custom_zulip_files/puppet/zulip/templates/postfix/main.cf.erb +++ /dev/null @@ -1,38 +0,0 @@ -# This file is managed by puppet; local changes will be overridden. - -smtpd_banner = $myhostname ESMTP $mail_name (Zulip Voyager) -biff = no - -# appending .domain is the MUA's job. -append_dot_mydomain = no - -readme_directory = no - -# TLS parameters -smtpd_tls_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem -smtpd_tls_key_file=/etc/ssl/private/ssl-cert-snakeoil.key -smtpd_use_tls=yes -smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache -smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache - -myhostname = <%= @fqdn %> -alias_maps = hash:/etc/aliases -alias_database = hash:/etc/aliases -transport_maps = hash:/etc/postfix/transport -myorigin = /etc/mailname -mydestination = localhost, <%= @fqdn %> -relayhost = -mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128 -mailbox_size_limit = 0 -recipient_delimiter = + -inet_interfaces = all -inet_protocols = all - -# This enables us to do a catchall -virtual_alias_maps = regexp:/etc/postfix/virtual - -# Needed to accept mail with percents without trying to interpret as -# percent-style routing. -allow_percent_hack = no -allow_untrusted_routing = yes -strict_rfc821_envelopes = no diff --git a/custom_zulip_files/puppet/zulip/templates/postgresql/postgresql.conf.template.erb b/custom_zulip_files/puppet/zulip/templates/postgresql/postgresql.conf.template.erb deleted file mode 100644 index 531461c..0000000 --- a/custom_zulip_files/puppet/zulip/templates/postgresql/postgresql.conf.template.erb +++ /dev/null @@ -1,577 +0,0 @@ -# ----------------------------- -# PostgreSQL configuration file -# ----------------------------- -# -# This file consists of lines of the form: -# -# name = value -# -# (The "=" is optional.) Whitespace may be used. Comments are introduced with -# "#" anywhere on a line. The complete list of parameter names and allowed -# values can be found in the PostgreSQL documentation. -# -# The commented-out settings shown in this file represent the default values. -# Re-commenting a setting is NOT sufficient to revert it to the default value; -# you need to reload the server. -# -# This file is read on server startup and when the server receives a SIGHUP -# signal. If you edit the file on a running system, you have to SIGHUP the -# server for the changes to take effect, or use "pg_ctl reload". Some -# parameters, which are marked below, require a server shutdown and restart to -# take effect. -# -# Any parameter can also be given as a command-line option to the server, e.g., -# "postgres -c log_connections=on". Some parameters can be changed at run time -# with the "SET" SQL command. -# -# Memory units: kB = kilobytes Time units: ms = milliseconds -# MB = megabytes s = seconds -# GB = gigabytes min = minutes -# h = hours -# d = days - - -#------------------------------------------------------------------------------ -# FILE LOCATIONS -#------------------------------------------------------------------------------ - -# The default values of these variables are driven from the -D command-line -# option or PGDATA environment variable, represented here as ConfigDir. - -data_directory = '/var/lib/postgresql/<%= scope["zulip::base::postgres_version"] %>/main' # use data in another directory - # (change requires restart) -hba_file = '/etc/postgresql/<%= scope["zulip::base::postgres_version"] %>/main/pg_hba.conf' # host-based authentication file - # (change requires restart) -ident_file = '/etc/postgresql/<%= scope["zulip::base::postgres_version"] %>/main/pg_ident.conf' # ident configuration file - # (change requires restart) - -# If external_pid_file is not explicitly set, no extra PID file is written. -external_pid_file = '/var/run/postgresql/<%= scope["zulip::base::postgres_version"] %>-main.pid' # write an extra PID file - # (change requires restart) - - -#------------------------------------------------------------------------------ -# CONNECTIONS AND AUTHENTICATION -#------------------------------------------------------------------------------ - -# - Connection Settings - - -#listen_addresses = 'localhost' # what IP address(es) to listen on; - # comma-separated list of addresses; - # defaults to 'localhost', '*' = all - # (change requires restart) -port = 5432 # (change requires restart) -# max_connections = 100 # (change requires restart) -# Note: Increasing max_connections costs ~400 bytes of shared memory per -# connection slot, plus lock space (see max_locks_per_transaction). -#superuser_reserved_connections = 3 # (change requires restart) -unix_socket_directories = '/var/run/postgresql' # (change requires restart) -#unix_socket_group = '' # (change requires restart) -#unix_socket_permissions = 0777 # begin with 0 to use octal notation - # (change requires restart) -#bonjour = off # advertise server via Bonjour - # (change requires restart) -#bonjour_name = '' # defaults to the computer name - # (change requires restart) - -# - Security and Authentication - - -#authentication_timeout = 1min # 1s-600s -#ssl = true # (change requires restart) -#ssl_ciphers = 'ALL:!ADH:!LOW:!EXP:!MD5:@STRENGTH' # allowed SSL ciphers - # (change requires restart) -#ssl_renegotiation_limit = 512MB # amount of data between renegotiations -#password_encryption = on -#db_user_namespace = off - -# Kerberos and GSSAPI -#krb_server_keyfile = '' -#krb_srvname = 'postgres' # (Kerberos only) -#krb_caseins_users = off - -# - TCP Keepalives - -# see "man 7 tcp" for details - -#tcp_keepalives_idle = 0 # TCP_KEEPIDLE, in seconds; - # 0 selects the system default -#tcp_keepalives_interval = 0 # TCP_KEEPINTVL, in seconds; - # 0 selects the system default -#tcp_keepalives_count = 0 # TCP_KEEPCNT; - # 0 selects the system default - - -#------------------------------------------------------------------------------ -# RESOURCE USAGE (except WAL) -#------------------------------------------------------------------------------ - -# - Memory - - -shared_buffers = 128MB # min 128kB - # (change requires restart) -#temp_buffers = 8MB # min 800kB -#max_prepared_transactions = 0 # zero disables the feature - # (change requires restart) -# Note: Increasing max_prepared_transactions costs ~600 bytes of shared memory -# per transaction slot, plus lock space (see max_locks_per_transaction). -# It is not advisable to set max_prepared_transactions nonzero unless you -# actively intend to use prepared transactions. -#work_mem = 1MB # min 64kB -#maintenance_work_mem = 16MB # min 1MB -#max_stack_depth = 2MB # min 100kB - -# - Kernel Resource Usage - - -#max_files_per_process = 1000 # min 25 - # (change requires restart) -#shared_preload_libraries = '' # (change requires restart) - -# - Cost-Based Vacuum Delay - - -#vacuum_cost_delay = 0ms # 0-100 milliseconds -#vacuum_cost_page_hit = 1 # 0-10000 credits -#vacuum_cost_page_miss = 10 # 0-10000 credits -#vacuum_cost_page_dirty = 20 # 0-10000 credits -#vacuum_cost_limit = 200 # 1-10000 credits - -# - Background Writer - - -#bgwriter_delay = 200ms # 10-10000ms between rounds -#bgwriter_lru_maxpages = 100 # 0-1000 max buffers written/round -#bgwriter_lru_multiplier = 2.0 # 0-10.0 multipler on buffers scanned/round - -# - Asynchronous Behavior - - -#effective_io_concurrency = 1 # 1-1000. 0 disables prefetching - - -#------------------------------------------------------------------------------ -# WRITE AHEAD LOG -#------------------------------------------------------------------------------ - -# - Settings - - -#wal_level = minimal # minimal, archive, or hot_standby - # (change requires restart) -#fsync = on # turns forced synchronization on or off -#synchronous_commit = on # synchronization level; on, off, or local -#wal_sync_method = fsync # the default is the first option - # supported by the operating system: - # open_datasync - # fdatasync (default on Linux) - # fsync - # fsync_writethrough - # open_sync -#full_page_writes = on # recover from partial page writes -#wal_buffers = -1 # min 32kB, -1 sets based on shared_buffers - # (change requires restart) -#wal_writer_delay = 200ms # 1-10000 milliseconds - -#commit_delay = 0 # range 0-100000, in microseconds -#commit_siblings = 5 # range 1-1000 - -# - Checkpoints - - -#checkpoint_segments = 3 # in logfile segments, min 1, 16MB each -#checkpoint_timeout = 5min # range 30s-1h -#checkpoint_completion_target = 0.5 # checkpoint target duration, 0.0 - 1.0 -#checkpoint_warning = 30s # 0 disables - -# - Archiving - - -#archive_mode = off # allows archiving to be done - # (change requires restart) -#archive_command = '' # command to use to archive a logfile segment -#archive_timeout = 0 # force a logfile segment switch after this - # number of seconds; 0 disables - - -#------------------------------------------------------------------------------ -# REPLICATION -#------------------------------------------------------------------------------ - -# - Master Server - - -# These settings are ignored on a standby server - -#max_wal_senders = 0 # max number of walsender processes - # (change requires restart) -#wal_sender_delay = 1s # walsender cycle time, 1-10000 milliseconds -#wal_keep_segments = 0 # in logfile segments, 16MB each; 0 disables -#vacuum_defer_cleanup_age = 0 # number of xacts by which cleanup is delayed -#replication_timeout = 60s # in milliseconds; 0 disables -#synchronous_standby_names = '' # standby servers that provide sync rep - # comma-separated list of application_name - # from standby(s); '*' = all - -# - Standby Servers - - -# These settings are ignored on a master server - -#hot_standby = off # "on" allows queries during recovery - # (change requires restart) -#max_standby_archive_delay = 30s # max delay before canceling queries - # when reading WAL from archive; - # -1 allows indefinite delay -#max_standby_streaming_delay = 30s # max delay before canceling queries - # when reading streaming WAL; - # -1 allows indefinite delay -#wal_receiver_status_interval = 10s # send replies at least this often - # 0 disables -#hot_standby_feedback = off # send info from standby to prevent - # query conflicts - - -#------------------------------------------------------------------------------ -# QUERY TUNING -#------------------------------------------------------------------------------ - -# - Planner Method Configuration - - -#enable_bitmapscan = on -#enable_hashagg = on -#enable_hashjoin = on -#enable_indexscan = on -#enable_material = on -#enable_mergejoin = on -#enable_nestloop = on -#enable_seqscan = on -#enable_sort = on -#enable_tidscan = on - -# - Planner Cost Constants - - -#seq_page_cost = 1.0 # measured on an arbitrary scale -#random_page_cost = 4.0 # same scale as above -#cpu_tuple_cost = 0.01 # same scale as above -#cpu_index_tuple_cost = 0.005 # same scale as above -#cpu_operator_cost = 0.0025 # same scale as above -#effective_cache_size = 128MB - -# - Genetic Query Optimizer - - -#geqo = on -#geqo_threshold = 12 -#geqo_effort = 5 # range 1-10 -#geqo_pool_size = 0 # selects default based on effort -#geqo_generations = 0 # selects default based on effort -#geqo_selection_bias = 2.0 # range 1.5-2.0 -#geqo_seed = 0.0 # range 0.0-1.0 - -# - Other Planner Options - - -#default_statistics_target = 100 # range 1-10000 -#constraint_exclusion = partition # on, off, or partition -#cursor_tuple_fraction = 0.1 # range 0.0-1.0 -#from_collapse_limit = 8 -#join_collapse_limit = 8 # 1 disables collapsing of explicit - # JOIN clauses - - -#------------------------------------------------------------------------------ -# ERROR REPORTING AND LOGGING -#------------------------------------------------------------------------------ - -# - Where to Log - - -#log_destination = 'stderr' # Valid values are combinations of - # stderr, csvlog, syslog, and eventlog, - # depending on platform. csvlog - # requires logging_collector to be on. - -# This is used when logging to stderr: -#logging_collector = off # Enable capturing of stderr and csvlog - # into log files. Required to be on for - # csvlogs. - # (change requires restart) - -# These are only used if logging_collector is on: -#log_directory = 'pg_log' # directory where log files are written, - # can be absolute or relative to PGDATA -#log_filename = 'postgresql-%Y-%m-%d_%H%M%S.log' # log file name pattern, - # can include strftime() escapes -#log_file_mode = 0600 # creation mode for log files, - # begin with 0 to use octal notation -#log_truncate_on_rotation = off # If on, an existing log file with the - # same name as the new log file will be - # truncated rather than appended to. - # But such truncation only occurs on - # time-driven rotation, not on restarts - # or size-driven rotation. Default is - # off, meaning append to existing files - # in all cases. -#log_rotation_age = 1d # Automatic rotation of logfiles will - # happen after that time. 0 disables. -#log_rotation_size = 10MB # Automatic rotation of logfiles will - # happen after that much log output. - # 0 disables. - -# These are relevant when logging to syslog: -#syslog_facility = 'LOCAL0' -#syslog_ident = 'postgres' - -#silent_mode = off # Run server silently. - # DO NOT USE without syslog or - # logging_collector - # (change requires restart) - - -# - When to Log - - -#client_min_messages = notice # values in order of decreasing detail: - # debug5 - # debug4 - # debug3 - # debug2 - # debug1 - # log - # notice - # warning - # error - -#log_min_messages = warning # values in order of decreasing detail: - # debug5 - # debug4 - # debug3 - # debug2 - # debug1 - # info - # notice - # warning - # error - # log - # fatal - # panic - -#log_min_error_statement = error # values in order of decreasing detail: - # debug5 - # debug4 - # debug3 - # debug2 - # debug1 - # info - # notice - # warning - # error - # log - # fatal - # panic (effectively off) - -#log_min_duration_statement = -1 # -1 is disabled, 0 logs all statements - # and their durations, > 0 logs only - # statements running at least this number - # of milliseconds - - -# - What to Log - - -#debug_print_parse = off -#debug_print_rewritten = off -#debug_print_plan = off -#debug_pretty_print = on -#log_checkpoints = off -#log_connections = off -#log_disconnections = off -#log_duration = off -#log_error_verbosity = default # terse, default, or verbose messages -#log_hostname = off -#log_line_prefix = '%t ' # special values: - # %a = application name - # %u = user name - # %d = database name - # %r = remote host and port - # %h = remote host - # %p = process ID - # %t = timestamp without milliseconds - # %m = timestamp with milliseconds - # %i = command tag - # %e = SQL state - # %c = session ID - # %l = session line number - # %s = session start timestamp - # %v = virtual transaction ID - # %x = transaction ID (0 if none) - # %q = stop here in non-session - # processes - # %% = '%' - # e.g. '<%u%%%d> ' -#log_lock_waits = off # log lock waits >= deadlock_timeout -#log_statement = 'none' # none, ddl, mod, all -#log_temp_files = -1 # log temporary files equal or larger - # than the specified size in kilobytes; - # -1 disables, 0 logs all temp files -#log_timezone = '(defaults to server environment setting)' - - -#------------------------------------------------------------------------------ -# RUNTIME STATISTICS -#------------------------------------------------------------------------------ - -# - Query/Index Statistics Collector - - -#track_activities = on -#track_counts = on -#track_functions = none # none, pl, all -#track_activity_query_size = 1024 # (change requires restart) -#update_process_title = on -#stats_temp_directory = 'pg_stat_tmp' - - -# - Statistics Monitoring - - -#log_parser_stats = off -#log_planner_stats = off -#log_executor_stats = off -#log_statement_stats = off - - -#------------------------------------------------------------------------------ -# AUTOVACUUM PARAMETERS -#------------------------------------------------------------------------------ - -#autovacuum = on # Enable autovacuum subprocess? 'on' - # requires track_counts to also be on. -#log_autovacuum_min_duration = -1 # -1 disables, 0 logs all actions and - # their durations, > 0 logs only - # actions running at least this number - # of milliseconds. -#autovacuum_max_workers = 3 # max number of autovacuum subprocesses - # (change requires restart) -#autovacuum_naptime = 1min # time between autovacuum runs -#autovacuum_vacuum_threshold = 50 # min number of row updates before - # vacuum -#autovacuum_analyze_threshold = 50 # min number of row updates before - # analyze -#autovacuum_vacuum_scale_factor = 0.2 # fraction of table size before vacuum -#autovacuum_analyze_scale_factor = 0.1 # fraction of table size before analyze -#autovacuum_freeze_max_age = 200000000 # maximum XID age before forced vacuum - # (change requires restart) -#autovacuum_vacuum_cost_delay = 20ms # default vacuum cost delay for - # autovacuum, in milliseconds; - # -1 means use vacuum_cost_delay -#autovacuum_vacuum_cost_limit = -1 # default vacuum cost limit for - # autovacuum, -1 means use - # vacuum_cost_limit - - -#------------------------------------------------------------------------------ -# CLIENT CONNECTION DEFAULTS -#------------------------------------------------------------------------------ - -# - Statement Behavior - - -#search_path = '"$user",public' # schema names -#default_tablespace = '' # a tablespace name, '' uses the default -#temp_tablespaces = '' # a list of tablespace names, '' uses - # only default tablespace -#check_function_bodies = on -#default_transaction_isolation = 'read committed' -#default_transaction_read_only = off -#default_transaction_deferrable = off -#session_replication_role = 'origin' -#statement_timeout = 0 # in milliseconds, 0 is disabled -#vacuum_freeze_min_age = 50000000 -#vacuum_freeze_table_age = 150000000 -#bytea_output = 'hex' # hex, escape -#xmlbinary = 'base64' -#xmloption = 'content' - -# - Locale and Formatting - - -datestyle = 'iso, mdy' -#intervalstyle = 'postgres' -#timezone = '(defaults to server environment setting)' -#timezone_abbreviations = 'Default' # Select the set of available time zone - # abbreviations. Currently, there are - # Default - # Australia - # India - # You can create your own file in - # share/timezonesets/. -#extra_float_digits = 0 # min -15, max 3 -#client_encoding = sql_ascii # actually, defaults to database - # encoding - -# These settings are initialized by initdb, but they can be changed. -lc_messages = 'en_US.UTF-8' # locale for system error message - # strings -lc_monetary = 'en_US.UTF-8' # locale for monetary formatting -lc_numeric = 'en_US.UTF-8' # locale for number formatting -lc_time = 'en_US.UTF-8' # locale for time formatting - -# default configuration for text search -#default_text_search_config = 'pg_catalog.english' - -# - Other Defaults - - -#dynamic_library_path = '$libdir' -#local_preload_libraries = '' - - -#------------------------------------------------------------------------------ -# LOCK MANAGEMENT -#------------------------------------------------------------------------------ - -#deadlock_timeout = 1s -#max_locks_per_transaction = 64 # min 10 - # (change requires restart) -# Note: Each lock table slot uses ~270 bytes of shared memory, and there are -# max_locks_per_transaction * (max_connections + max_prepared_transactions) -# lock table slots. -#max_pred_locks_per_transaction = 64 # min 10 - # (change requires restart) - -#------------------------------------------------------------------------------ -# VERSION/PLATFORM COMPATIBILITY -#------------------------------------------------------------------------------ - -# - Previous PostgreSQL Versions - - -#array_nulls = on -#backslash_quote = safe_encoding # on, off, or safe_encoding -#default_with_oids = off -#escape_string_warning = on -#lo_compat_privileges = off -#quote_all_identifiers = off -#sql_inheritance = on -#standard_conforming_strings = on -#synchronize_seqscans = on - -# - Other Platforms and Clients - - -#transform_null_equals = off - - -#------------------------------------------------------------------------------ -# ERROR HANDLING -#------------------------------------------------------------------------------ - -#exit_on_error = off # terminate session on any error? -#restart_after_crash = on # reinitialize after backend crash? - - -#------------------------------------------------------------------------------ -# CUSTOMIZED OPTIONS -#------------------------------------------------------------------------------ - -#custom_variable_classes = '' # list of custom variable class names - -timezone = 'UTC' -default_text_search_config = 'zulip.english_us_search' - -log_destination = 'stderr' -logging_collector = on -log_directory = '/var/log/postgresql' -log_filename = 'postgresql-%Y-%m-%d_%H%M%S.log' -log_rotation_age = 7d -log_rotation_size = 100MB -log_min_duration_statement = 500 -log_line_prefix = '%m [%c]: [%l-1] ' -log_checkpoints = on -log_lock_waits = on -log_temp_files = 0 -log_autovacuum_min_duration = 100 - -autovacuum_freeze_max_age = 2000000000 -vacuum_freeze_min_age = 1000000000 -vacuum_freeze_table_age = 1800000000 - diff --git a/custom_zulip_files/scripts/lib/install b/custom_zulip_files/scripts/lib/install index abd688e..c99c983 100755 --- a/custom_zulip_files/scripts/lib/install +++ b/custom_zulip_files/scripts/lib/install @@ -1,19 +1,20 @@ #!/usr/bin/env bash set -xe -# Specify options for apt -APT_OPTIONS="${APT_OPTIONS:-}" -# Install additional packages using apt -ADDITIONAL_PACKAGES=${ADDITIONAL_PACKAGES:-} -# Call the default type "voyager", for docker it's the same -DEPLOYMENT_TYPE="${DEPLOYMENT_TYPE:-voyager}" -# Can be for example "dockervoyager" or voyager -PUPPET_CLASSES="${PUPPET_CLASSES:-zulip::voyager}" - # Assumes we've already been untarred +# Specify options for apt. +APT_OPTIONS="${APT_OPTIONS:-}" +# Install additional packages using apt. +ADDITIONAL_PACKAGES=${ADDITIONAL_PACKAGES:-} +# Deployment type is almost always voyager. +DEPLOYMENT_TYPE="${DEPLOYMENT_TYPE:-voyager}" +# Comma-separated list of puppet manifests to install. default is +# zulip::voyager for an all-in-one system or zulip::dockervoyager for +# Docker. Use e.g. zulip::app_frontend for a Zulip frontend server. +PUPPET_CLASSES="${PUPPET_CLASSES:-zulip::voyager}" + # First, install any updates from the apt repo that may be needed -# Install the key through a pipe wget -qO - https://zulip.com/dist/keys/zulip-ppa.asc | apt-key add - cat >/etc/apt/sources.list.d/zulip.list < /etc/zulip/zulip.conf /root/zulip/scripts/zulip-puppet-apply -f @@ -71,8 +71,10 @@ ln -nsf /etc/zulip/settings.py "$deploy_path"/zproject/local_settings.py mkdir -p "$deploy_path"/prod-static/serve cp -rT "$deploy_path"/prod-static/serve /home/zulip/prod-static chown -R zulip:zulip /home/zulip /var/log/zulip /etc/zulip/settings.py -# Allow this to fail, if there is no supervisor running in a docker install -chown -f zulip:zulip /var/run/supervisor.sock || : +if [ -e "/var/run/supervisor.sock" ]; then + # If supervisor isn't running, no need to chown its socket + chown zulip:zulip /var/run/supervisor.sock +fi cd /home/zulip/deployments/current diff --git a/custom_zulip_files/scripts/setup/configure-rabbitmq b/custom_zulip_files/scripts/setup/configure-rabbitmq deleted file mode 100755 index 2bda3b2..0000000 --- a/custom_zulip_files/scripts/setup/configure-rabbitmq +++ /dev/null @@ -1,14 +0,0 @@ -#!/usr/bin/env bash -# -# Delete the "guest" default user and replace it with a Zulip user -# with a real password -set -ex - -RABBITMQ_USERNAME=$("$(dirname "$0")/../../bin/get-django-setting" RABBITMQ_USERNAME) -RABBITMQ_PASSWORD=$("$(dirname "$0")/../../bin/get-django-setting" RABBITMQ_PASSWORD) -sudo rabbitmqctl delete_user "$RABBITMQ_USERNAME" || true -sudo rabbitmqctl delete_user zulip || true -sudo rabbitmqctl delete_user guest || true -sudo rabbitmqctl add_user "$RABBITMQ_USERNAME" "$RABBITMQ_PASSWORD" -sudo rabbitmqctl set_user_tags "$RABBITMQ_USERNAME" administrator -sudo rabbitmqctl set_permissions -p / "$RABBITMQ_USERNAME" '.*' '.*' '.*' diff --git a/custom_zulip_files/scripts/setup/postgres-init-db b/custom_zulip_files/scripts/setup/postgres-init-db index 69ac656..63a01cc 100755 --- a/custom_zulip_files/scripts/setup/postgres-init-db +++ b/custom_zulip_files/scripts/setup/postgres-init-db @@ -1,5 +1,6 @@ #!/bin/bash -set -ex +set -e +set -x # A bit of a helper variable, default is voyager DEPLOYMENT_TYPE="${DEPLOYMENT_TYPE:-voyager}" @@ -72,3 +73,4 @@ if [ "$DEPLOYMENT_TYPE" != "dockervoyager" ]; then fi echo "Database created" + diff --git a/custom_zulip_files/zerver/lib/queue.py b/custom_zulip_files/zerver/lib/queue.py deleted file mode 100644 index 988256a..0000000 --- a/custom_zulip_files/zerver/lib/queue.py +++ /dev/null @@ -1,263 +0,0 @@ -from __future__ import absolute_import - -from django.conf import settings -import pika -import logging -import ujson -import random -import time -import threading -import atexit -from collections import defaultdict - -from zerver.lib.utils import statsd -from typing import Any, Callable - -# This simple queuing library doesn't expose much of the power of -# rabbitmq/pika's queuing system; its purpose is to just provide an -# interface for external files to put things into queues and take them -# out from bots without having to import pika code all over our codebase. -class SimpleQueueClient(object): - def __init__(self): - self.log = logging.getLogger('zulip.queue') - self.queues = set() # type: Set[str] - self.channel = None # type: Any - self.consumers = defaultdict(set) # type: Dict[str, Set[Any]] - self._connect() - - def _connect(self): - start = time.time() - self.connection = pika.BlockingConnection(self._get_parameters()) - self.channel = self.connection.channel() - self.log.info('SimpleQueueClient connected (connecting took %.3fs)' % (time.time() - start,)) - - def _reconnect(self): - self.connection = None - self.channel = None - self.queues = set() - self._connect() - - def _get_parameters(self): - return pika.ConnectionParameters(settings.RABBITMQ_HOST, - credentials = pika.PlainCredentials( - settings.RABBITMQ_USERNAME, settings.RABBITMQ_PASSWORD)) - - def _generate_ctag(self, queue_name): - return "%s_%s" % (queue_name, str(random.getrandbits(16))) - - def _reconnect_consumer_callback(self, queue, consumer): - self.log.info("Queue reconnecting saved consumer %s to queue %s" % (consumer, queue)) - self.ensure_queue(queue, lambda: self.channel.basic_consume(consumer, - queue=queue, - consumer_tag=self._generate_ctag(queue))) - - def _reconnect_consumer_callbacks(self): - for queue, consumers in self.consumers.items(): - for consumer in consumers: - self._reconnect_consumer_callback(queue, consumer) - - def close(self): - if self.connection: - self.connection.close() - - def ready(self): - return self.channel is not None - - def ensure_queue(self, queue_name, callback): - '''Ensure that a given queue has been declared, and then call - the callback with no arguments.''' - if not self.connection.is_open: - self._connect() - - if queue_name not in self.queues: - self.channel.queue_declare(queue=queue_name, durable=True) - self.queues.add(queue_name) - callback() - - def publish(self, queue_name, body): - def do_publish(): - self.channel.basic_publish( - exchange='', - routing_key=queue_name, - properties=pika.BasicProperties(delivery_mode=2), - body=body) - - statsd.incr("rabbitmq.publish.%s" % (queue_name,)) - - self.ensure_queue(queue_name, do_publish) - - def json_publish(self, queue_name, body): - try: - return self.publish(queue_name, ujson.dumps(body)) - except (AttributeError, pika.exceptions.AMQPConnectionError): - self.log.warning("Failed to send to rabbitmq, trying to reconnect and send again") - self._reconnect() - - return self.publish(queue_name, ujson.dumps(body)) - - def register_consumer(self, queue_name, consumer): - def wrapped_consumer(ch, method, properties, body): - try: - consumer(ch, method, properties, body) - ch.basic_ack(delivery_tag=method.delivery_tag) - except Exception as e: - ch.basic_nack(delivery_tag=method.delivery_tag) - raise e - - self.consumers[queue_name].add(wrapped_consumer) - self.ensure_queue(queue_name, - lambda: self.channel.basic_consume(wrapped_consumer, queue=queue_name, - consumer_tag=self._generate_ctag(queue_name))) - - def register_json_consumer(self, queue_name, callback): - def wrapped_callback(ch, method, properties, body): - return callback(ujson.loads(body)) - return self.register_consumer(queue_name, wrapped_callback) - - def drain_queue(self, queue_name, json=False): - "Returns all messages in the desired queue" - messages = [] - def opened(): - while True: - (meta, _, message) = self.channel.basic_get(queue_name) - - if not message: - break; - - self.channel.basic_ack(meta.delivery_tag) - if json: - message = ujson.loads(message) - messages.append(message) - - self.ensure_queue(queue_name, opened) - return messages - - def start_consuming(self): - self.channel.start_consuming() - - def stop_consuming(self): - self.channel.stop_consuming() - -# Patch pika.adapters.TornadoConnection so that a socket error doesn't -# throw an exception and disconnect the tornado process from the rabbitmq -# queue. Instead, just re-connect as usual -class ExceptionFreeTornadoConnection(pika.adapters.TornadoConnection): - def _adapter_disconnect(self): - try: - super(ExceptionFreeTornadoConnection, self)._adapter_disconnect() - except (pika.exceptions.ProbableAuthenticationError, - pika.exceptions.ProbableAccessDeniedError, - pika.exceptions.IncompatibleProtocolError) as e: - logging.warning("Caught exception '%r' in ExceptionFreeTornadoConnection when \ -calling _adapter_disconnect, ignoring" % (e,)) - - -class TornadoQueueClient(SimpleQueueClient): - # Based on: - # https://pika.readthedocs.org/en/0.9.8/examples/asynchronous_consumer_example.html - def __init__(self): - super(TornadoQueueClient, self).__init__() - self._on_open_cbs = [] # type: List[Callable[[], None]] - - def _connect(self, on_open_cb = None): - self.log.info("Beginning TornadoQueueClient connection") - if on_open_cb: - self._on_open_cbs.append(on_open_cb) - self.connection = ExceptionFreeTornadoConnection( - self._get_parameters(), - on_open_callback = self._on_open, - stop_ioloop_on_close = False) - self.connection.add_on_close_callback(self._on_connection_closed) - - def _reconnect(self): - self.connection = None - self.channel = None - self.queues = set() - self._connect() - - def _on_open(self, connection): - self.connection.channel( - on_open_callback = self._on_channel_open) - - def _on_channel_open(self, channel): - self.channel = channel - for callback in self._on_open_cbs: - callback() - self._reconnect_consumer_callbacks() - self.log.info('TornadoQueueClient connected') - - def _on_connection_closed(self, connection, reply_code, reply_text): - self.log.warning("TornadoQueueClient lost connection to RabbitMQ, reconnecting...") - from tornado import ioloop - - # Try to reconnect in two seconds - retry_seconds = 2 - def on_timeout(): - try: - self._reconnect() - except pika.exceptions.AMQPConnectionError: - self.log.critical("Failed to reconnect to RabbitMQ, retrying...") - ioloop.IOLoop.instance().add_timeout(time.time() + retry_seconds, on_timeout) - - ioloop.IOLoop.instance().add_timeout(time.time() + retry_seconds, on_timeout) - - def ensure_queue(self, queue_name, callback): - def finish(frame): - self.queues.add(queue_name) - callback() - - if queue_name not in self.queues: - # If we're not connected yet, send this message - # once we have created the channel - if not self.ready(): - self._on_open_cbs.append(lambda: self.ensure_queue(queue_name, callback)) - return - - self.channel.queue_declare(queue=queue_name, durable=True, callback=finish) - else: - callback() - - def register_consumer(self, queue_name, consumer): - def wrapped_consumer(ch, method, properties, body): - consumer(ch, method, properties, body) - ch.basic_ack(delivery_tag=method.delivery_tag) - - if not self.ready(): - self.consumers[queue_name].add(wrapped_consumer) - return - - self.consumers[queue_name].add(wrapped_consumer) - self.ensure_queue(queue_name, - lambda: self.channel.basic_consume(wrapped_consumer, queue=queue_name, - consumer_tag=self._generate_ctag(queue_name))) - -queue_client = None # type: SimpleQueueClient -def get_queue_client(): - global queue_client - if queue_client is None: - if settings.RUNNING_INSIDE_TORNADO and settings.USING_RABBITMQ: - queue_client = TornadoQueueClient() - elif settings.USING_RABBITMQ: - queue_client = SimpleQueueClient() - - return queue_client - -def setup_tornado_rabbitmq(): - # When tornado is shut down, disconnect cleanly from rabbitmq - if settings.USING_RABBITMQ: - atexit.register(lambda: queue_client.close()) - -# We using a simple lock to prevent multiple RabbitMQ messages being -# sent to the SimpleQueueClient at the same time; this is a workaround -# for an issue with the pika BlockingConnection where using -# BlockingConnection for multiple queues causes the channel to -# randomly close. -queue_lock = threading.RLock() - -def queue_json_publish(queue_name, event, processor): - with queue_lock: - if settings.USING_RABBITMQ: - get_queue_client().json_publish(queue_name, event) - else: - processor(event) - diff --git a/custom_zulip_files/zerver/logging_handlers.py b/custom_zulip_files/zerver/logging_handlers.py deleted file mode 100644 index ecd7cd3..0000000 --- a/custom_zulip_files/zerver/logging_handlers.py +++ /dev/null @@ -1,81 +0,0 @@ -from __future__ import absolute_import - -from django.conf import settings - -import logging -import traceback -import platform - -from django.core import mail -from django.utils.log import AdminEmailHandler -from django.views.debug import ExceptionReporter, get_exception_reporter_filter - -from zerver.lib.queue import queue_json_publish - -class AdminZulipHandler(logging.Handler): - """An exception log handler that sends the exception to the queue to be - sent to the Zulip feedback server. - """ - - # adapted in part from django/utils/log.py - - def __init__(self): - logging.Handler.__init__(self) - - def emit(self, record): - try: - request = record.request - - filter = get_exception_reporter_filter(request) - - if record.exc_info: - stack_trace = ''.join(traceback.format_exception(*record.exc_info)) - else: - stack_trace = None - - try: - user_profile = request.user - user_full_name = user_profile.full_name - user_email = user_profile.email - except Exception: - traceback.print_exc() - # Error was triggered by an anonymous user. - user_full_name = None - user_email = None - - report = dict( - node = platform.node(), - method = request.method, - path = request.path, - data = request.GET if request.method == 'GET' - else filter.get_post_parameters(request), - remote_addr = request.META.get('REMOTE_ADDR', None), - query_string = request.META.get('QUERY_STRING', None), - server_name = request.META.get('SERVER_NAME', None), - message = record.getMessage(), - stack_trace = stack_trace, - user_full_name = user_full_name, - user_email = user_email, - ) - except: - traceback.print_exc() - report = dict( - node = platform.node(), - message = record.getMessage(), - ) - - try: - if settings.ZULIP_COM_STAGING: - # On staging, process the report directly so it can happen inside this - # try/except to prevent looping - from zilencer.error_notify import notify_server_error - notify_server_error(report) - else: - queue_json_publish('error_reports', dict( - type = "server", - report = report, - ), lambda x: None) - except: - # If this breaks, complain loudly but don't pass the traceback up the stream - # However, we *don't* want to use logging.exception since that could trigger a loop. - logging.warning("Reporting an exception triggered an exception!", exc_info=True) diff --git a/custom_zulip_files/zproject/local_settings_template.py b/custom_zulip_files/zproject/local_settings_template.py deleted file mode 100644 index bc6cce0..0000000 --- a/custom_zulip_files/zproject/local_settings_template.py +++ /dev/null @@ -1,332 +0,0 @@ -# Settings for Zulip Voyager - -### MANDATORY SETTINGS -# -# These settings MUST be set in production. In a development environment, -# sensible default values will be used. - -# The user-accessible Zulip hostname for this installation, e.g. -# zulip.example.com -EXTERNAL_HOST = 'zulip.example.com' - -# The email address for the person or team who maintain the Zulip -# Voyager installation. Will also get support emails. (e.g. zulip-admin@example.com) -ZULIP_ADMINISTRATOR = 'zulip-admin@example.com' - -# The domain for your organization, e.g. example.com -ADMIN_DOMAIN = 'example.com' - -# Enable at least one of the following authentication backends. -AUTHENTICATION_BACKENDS = ( -# 'zproject.backends.EmailAuthBackend', # Email and password; see SMTP setup below -# 'zproject.backends.ZulipRemoteUserBackend', # Local SSO -# 'zproject.backends.GoogleMobileOauth2Backend', # Google Apps, setup below -# 'zproject.backends.ZulipLDAPAuthBackend', # LDAP, setup below - ) - -# Google Oauth requires a bit of configuration; you will need to go to -# do the following: -# -# (1) Visit https://console.developers.google.com, setup an -# Oauth2 client ID that allows redirects to -# e.g. https://zulip.example.com/accounts/login/google/done/. -# -# (2) Then click into the APIs and Auth section (in the sidebar on the -# left side of the page), APIs, then under "Social APIs" click on -# "Google+ API" and click the button to enable the API. -# -# (3) put your client secret as "google_oauth2_client_secret" in -# zulip-secrets.conf, and your client ID right here: -# GOOGLE_OAUTH2_CLIENT_ID= - -# If you are using the ZulipRemoteUserBackend authentication backend, -# set this to your domain (e.g. if REMOTE_USER is "username" and the -# corresponding email address is "username@example.com", set -# SSO_APPEND_DOMAIN = "example.com") -SSO_APPEND_DOMAIN = None - -# Configure the outgoing SMTP server below. For testing, you can skip -# sending emails entirely by commenting out EMAIL_HOST, but you will -# want to configure this to support email address confirmation emails, -# missed message emails, onboarding follow-up emails, etc. To -# configure SMTP, you will need to complete the following steps: -# -# (1) Fill out the outgoing email sending configuration below. -# -# (2) Put the SMTP password for EMAIL_HOST_USER in -# /etc/zulip/zulip-secrets.conf as email_password. -# -# (3) If you are using a gmail account to send outgoing email, you -# will likely need to read this Google support answer and configure -# that account as "less secure": -# https://support.google.com/mail/answer/14257. -# -# You can quickly test your sending email configuration using: -# ./manage.py send_test_email username@example.com -# -# A common problem is hosting providers that block outgoing SMTP traffic. -# -# With the exception of reading EMAIL_HOST_PASSWORD from -# email_password in the Zulip secrets file, Zulip uses Django's -# standard EmailBackend, so if you're having issues, you may want to -# search for documentation on using your email provider with Django. -EMAIL_HOST = 'smtp.gmail.com' -EMAIL_HOST_USER = '' -EMAIL_PORT = 587 -EMAIL_USE_TLS = True -# The email From address to be used for automatically generated emails -DEFAULT_FROM_EMAIL = "Zulip " -# The noreply address to be used as Reply-To for certain generated emails. -# Messages sent to this address should not be delivered anywhere. -NOREPLY_EMAIL_ADDRESS = "noreply@example.com" - -# A list of strings representing the host/domain names that this -# Django site can serve. You should reset it to be a list of -# domains/IP addresses for your site. This is a security measure to -# prevent an attacker from poisoning caches and triggering password -# reset emails with links to malicious hosts by submitting requests -# with a fake HTTP Host header. You must include 'localhost' here. -ALLOWED_HOSTS = ['*'] - -### OPTIONAL SETTINGS - -# Controls whether session cookies expire when the browser closes -SESSION_EXPIRE_AT_BROWSER_CLOSE = False - -# Session cookie expiry in seconds after the last page load -SESSION_COOKIE_AGE = 60 * 60 * 24 * 7 * 2 # 2 weeks - -# Controls whether or not there is a feedback button in the UI. -ENABLE_FEEDBACK = False - -# By default, the feedback button will submit feedback to the Zulip -# developers. If you set FEEDBACK_EMAIL to be an email address -# (e.g. ZULIP_ADMINISTRATOR), feedback sent by your users will instead -# be sent to that email address. -FEEDBACK_EMAIL = ZULIP_ADMINISTRATOR - -# Controls whether or not error reports are sent to Zulip. Error -# reports are used to improve the quality of the product and do not -# include message contents; please contact Zulip support with any -# questions. -ERROR_REPORTING = True - -# Controls whether or not Zulip will provide inline image preview when -# a link to an image is referenced in a message. -INLINE_IMAGE_PREVIEW = True - -# By default, files uploaded by users and user avatars are stored -# directly on the Zulip server. If file storage in Amazon S3 is -# desired, you can configure that as follows: -# -# (1) Set s3_key and s3_secret_key in /etc/zulip/zulip-secrets.conf to -# be the S3 access and secret keys that you want to use, and setting -# the S3_AUTH_UPLOADS_BUCKET and S3_AVATAR_BUCKET to be the S3 buckets -# you've created to store file uploads and user avatars, respectively. -# Then restart Zulip (scripts/restart-zulip). -# -# (2) Edit /etc/nginx/sites-available/zulip-enterprise to comment out -# the nginx configuration for /user_uploads and /user_avatars (see -# https://github.com/zulip/zulip/issues/291 for discussion of a better -# solution that won't be automatically reverted by the Zulip upgrade -# script), and then restart nginx. -LOCAL_UPLOADS_DIR = "/home/zulip/uploads" -#S3_AUTH_UPLOADS_BUCKET = "" -#S3_AVATAR_BUCKET = "" - -# Maximum allowed size of uploaded files, in megabytes. DO NOT SET -# ABOVE 80MB. The file upload implementation doesn't support chunked -# uploads, so browsers will crash if you try uploading larger files. -MAX_FILE_UPLOAD_SIZE = 25 - -# Controls whether name changes are completely disabled for this installation -# This is useful in settings where you're syncing names from an integrated LDAP/Active Directory -NAME_CHANGES_DISABLED = False - -# Controls whether users who have not uploaded an avatar will receive an avatar -# from gravatar.com. -ENABLE_GRAVATAR = True - -# To override the default avatar image if ENABLE_GRAVATAR is False, place your -# custom default avatar image at /home/zulip/local-static/default-avatar.png -# and uncomment the following line. -#DEFAULT_AVATAR_URI = '/local-static/default-avatar.png' - -# To access an external postgres database you should define the host name in -# REMOTE_POSTGRES_HOST, you can define the password in the secrets file in the -# property postgres_password, and the SSL connection mode in REMOTE_POSTGRES_SSLMODE -# Different options are: -# disable: I don't care about security, and I don't want to pay the overhead of encryption. -# allow: I don't care about security, but I will pay the overhead of encryption if the server insists on it. -# prefer: I don't care about encryption, but I wish to pay the overhead of encryption if the server supports it. -# require: I want my data to be encrypted, and I accept the overhead. I trust that the network will make sure I always connect to the server I want. -# verify-ca: I want my data encrypted, and I accept the overhead. I want to be sure that I connect to a server that I trust. -# verify-full: I want my data encrypted, and I accept the overhead. I want to be sure that I connect to a server I trust, and that it's the one I specify. -#REMOTE_POSTGRES_HOST = 'dbserver.example.com' -#REMOTE_POSTGRES_SSLMODE = 'require' - -### TWITTER INTEGRATION - -# Zulip supports showing inline Tweet previews when a tweet is linked -# to in a message. To support this, Zulip must have access to the -# Twitter API via OAuth. To obtain the various access tokens needed -# below, you must register a new application under your Twitter -# account by doing the following: -# -# 1. Log in to http://dev.twitter.com. -# 2. In the menu under your username, click My Applications. From this page, create a new application. -# 3. Click on the application you created and click "create my access token". -# 4. Fill in the values for twitter_consumer_key, twitter_consumer_secret, twitter_access_token_key, -# and twitter_access_token_secret in /etc/zulip/zulip-secrets.conf. - -### EMAIL GATEWAY INTEGRATION - -# The Email gateway integration supports sending messages into Zulip -# by sending an email. This is useful for receiving notifications -# from third-party services that only send outgoing notifications via -# email. Once this integration is configured, each stream will have -# an email address documented on the stream settings page an emails -# sent to that address will be delivered into the stream. -# -# There are two ways to configure email mirroring in Zulip: -# 1. Local delivery: A MTA runs locally and passes mail directly to Zulip -# 2. Polling: Checks an IMAP inbox every minute for new messages. -# -# The local delivery configuration is preferred for production because -# it supports nicer looking email addresses and has no cron delay, -# while the polling mechanism is better for testing/developing this -# feature because it doesn't require a public-facing IP/DNS setup. -# -# The main email mirror setting is the email address pattern, where -# you specify the email address format you'd like the integration to -# use. It should be one of the following: -# %s@zulip.example.com (for local delivery) -# username+%s@example.com (for polling if EMAIL_GATEWAY_LOGIN=username@example.com) -EMAIL_GATEWAY_PATTERN = "" -# -# If you are using local delivery, EMAIL_GATEWAY_PATTERN is all you need -# to change in this file. You will also need to enable the Zulip postfix -# configuration to support local delivery by adding -# , zulip::postfix_localmail -# to puppet_classes in /etc/zulip/zulip.conf and then running -# `scripts/zulip-puppet-apply -f` to do the installation. -# -# If you are using polling, you will need to setup an IMAP email -# account dedicated to Zulip email gateway messages. The model is -# that users will send emails to that account via an address of the -# form username+%s@example.com (which is what you will set as -# EMAIL_GATEWAY_PATTERN); your email provider should deliver those -# emails to the username@example.com inbox. Then you run in a cron -# job `./manage.py email-mirror` (see puppet/zulip/files/cron.d/email-mirror), -# which will check that inbox and batch-process any new messages. -# -# You will need to configure authentication for the email mirror -# command to access the IMAP mailbox below and in zulip-secrets.conf. -# -# The IMAP login; username here and password as email_gateway_login in -# zulip-secrets.conf. -EMAIL_GATEWAY_LOGIN = "" -# The IMAP server & port to connect to -EMAIL_GATEWAY_IMAP_SERVER = "" -EMAIL_GATEWAY_IMAP_PORT = 993 -# The IMAP folder name to check for emails. All emails sent to EMAIL_GATEWAY_PATTERN above -# must be delivered to this folder -EMAIL_GATEWAY_IMAP_FOLDER = "INBOX" - -### LDAP integration configuration -# Zulip supports retrieving information about users via LDAP, and -# optionally using LDAP as an authentication mechanism. -# -# In either configuration, you will need to do the following: -# -# * Fill in the LDAP configuration options below so that Zulip can -# connect to your LDAP server -# -# * Setup the mapping between email addresses (used as login names in -# Zulip) and LDAP usernames. There are two supported ways to setup -# the username mapping: -# -# (A) If users' email addresses are in LDAP, set -# LDAP_APPEND_DOMAIN = None -# AUTH_LDAP_USER_SEARCH to lookup users by email address -# -# (B) If LDAP only has usernames but email addresses are of the form -# username@example.com, you should set: -# LDAP_APPEND_DOMAIN = example.com and -# AUTH_LDAP_USER_SEARCH to lookup users by username -# -# You can quickly test whether your configuration works by running: -# ./manage.py query_ldap username@example.com -# From the root of your Zulip installation; if your configuration is working -# that will output the full name for your user. -# -# ------------------------------------------------------------- -# -# If you are using LDAP for authentication, you will need to enable -# the zproject.backends.ZulipLDAPAuthBackend auth backend in -# AUTHENTICATION_BACKENDS above. After doing so, you should be able -# to login to Zulip by entering your email address and LDAP password -# on the Zulip login form. -# -# If you are using LDAP to populate names in Zulip, once you finish -# configuring this integration, you will need to run: -# ./manage.py sync_ldap_user_data -# To sync names for existing users; you may want to run this in a cron -# job to pick up name changes made on your LDAP server. -import ldap -from django_auth_ldap.config import LDAPSearch, GroupOfNamesType - -# URI of your LDAP server. If set, LDAP is used to prepopulate a user's name in -# Zulip. Example: "ldaps://ldap.example.com" -AUTH_LDAP_SERVER_URI = "" - -# This DN will be used to bind to your server. If unset, anonymous -# binds are performed. If set, you need to specify the password as -# 'auth_ldap_bind_password' in zulip-secrets.conf. -AUTH_LDAP_BIND_DN = "" - -# Specify the search base and the property to filter on that corresponds to the -# username. -AUTH_LDAP_USER_SEARCH = LDAPSearch("ou=users,dc=example,dc=com", - ldap.SCOPE_SUBTREE, "(uid=%(user)s)") - -# If the value of a user's "uid" (or similar) property is not their email -# address, specify the domain to append here. -LDAP_APPEND_DOMAIN = None - -# This map defines how to populate attributes of a Zulip user from LDAP. -AUTH_LDAP_USER_ATTR_MAP = { -# Populate the Django user's name from the LDAP directory. - "full_name": "cn", -} - -CAMO_URI = '' - -# RabbitMQ configuration -# -# By default, Zulip connects to rabbitmq running locally on the machine, -# but Zulip also supports connecting to RabbitMQ over the network; -# to use a remote RabbitMQ instance, set RABBITMQ_HOST here. -# RABBITMQ_HOST = "localhost" -# To use another rabbitmq user than the default 'zulip', set RABBITMQ_USERNAME here. -# RABBITMQ_USERNAME = 'zulip' - -# Memcached configuration -# -# By default, Zulip connects to memcached running locally on the machine, -# but Zulip also supports connecting to memcached over the network; -# to use a remote Memcached instance, set MEMCACHED_LOCATION here. -# Format HOST:PORT -# MEMCACHED_LOCATION = 127.0.0.1:11211 - -# Redis configuration -# -# By default, Zulip connects to redis running locally on the machine, -# but Zulip also supports connecting to redis over the network; -# to use a remote RabbitMQ instance, set REDIS_HOST here. -# REDIS_HOST = '127.0.0.1' -# For a different redis port set the REDIS_PORT here. -# REDIS_PORT = 6379 - -# Controls whether Zulip will rate-limit user requests. -# RATE_LIMITING = True diff --git a/custom_zulip_files/zproject/settings.py b/custom_zulip_files/zproject/settings.py deleted file mode 100644 index 0fcf2cb..0000000 --- a/custom_zulip_files/zproject/settings.py +++ /dev/null @@ -1,958 +0,0 @@ -from __future__ import absolute_import -# Django settings for zulip project. -######################################################################## -# Here's how settings for the Zulip project work: -# -# * settings.py contains non-site-specific and settings configuration -# for the Zulip Django app. -# * settings.py imports local_settings.py, and any site-specific configuration -# belongs there. The template for local_settings.py is local_settings_template.py -######################################################################## -import os -import platform -import time -import sys -import six.moves.configparser - -from zerver.lib.db import TimeTrackingConnection -import six - -######################################################################## -# INITIAL SETTINGS -######################################################################## - -config_file = six.moves.configparser.RawConfigParser() -config_file.read("/etc/zulip/zulip.conf") - -# Whether this instance of Zulip is running in a production environment. -PRODUCTION = config_file.has_option('machine', 'deploy_type') -DEVELOPMENT = not PRODUCTION - -secrets_file = six.moves.configparser.RawConfigParser() -if PRODUCTION: - secrets_file.read("/etc/zulip/zulip-secrets.conf") -else: - secrets_file.read("zproject/dev-secrets.conf") - -def get_secret(key): - if secrets_file.has_option('secrets', key): - return secrets_file.get('secrets', key) - return None - -# Make this unique, and don't share it with anybody. -SECRET_KEY = get_secret("secret_key") - -# A shared secret, used to authenticate different parts of the app to each other. -SHARED_SECRET = get_secret("shared_secret") - -# We use this salt to hash a user's email into a filename for their user-uploaded -# avatar. If this salt is discovered, attackers will only be able to determine -# that the owner of an email account has uploaded an avatar to Zulip, which isn't -# the end of the world. Don't use the salt where there is more security exposure. -AVATAR_SALT = get_secret("avatar_salt") - -# SERVER_GENERATION is used to track whether the server has been -# restarted for triggering browser clients to reload. -SERVER_GENERATION = int(time.time()) - -if not 'DEBUG' in globals(): - # Uncomment end of next line to test JS/CSS minification. - DEBUG = DEVELOPMENT # and platform.node() != 'your-machine' - -TEMPLATE_DEBUG = DEBUG -if DEBUG: - INTERNAL_IPS = ('127.0.0.1',) - -# Detect whether we're running as a queue worker; this impacts the logging configuration. -if len(sys.argv) > 2 and sys.argv[0].endswith('manage.py') and sys.argv[1] == 'process_queue': - IS_WORKER = True -else: - IS_WORKER = False - - -# This is overridden in test_settings.py for the test suites -TEST_SUITE = False -# The new user tutorial is enabled by default, but disabled for client tests. -TUTORIAL_ENABLED = True - -# Import variables like secrets from the local_settings file -# Import local_settings after determining the deployment/machine type -if PRODUCTION: - from .local_settings import * -else: - # For the Dev VM environment, we use the same settings as the - # sample local_settings.py file, with a few exceptions. - from .local_settings_template import * - LOCAL_UPLOADS_DIR = 'uploads' - EXTERNAL_HOST = 'localhost:9991' - ALLOWED_HOSTS = ['localhost'] - AUTHENTICATION_BACKENDS = ('zproject.backends.DevAuthBackend',) - # Add some of the below if you're testing other backends - # AUTHENTICATION_BACKENDS = ('zproject.backends.EmailAuthBackend', - # 'zproject.backends.GoogleMobileOauth2Backend',) - EXTERNAL_URI_SCHEME = "http://" - EMAIL_GATEWAY_PATTERN = "%s@" + EXTERNAL_HOST - ADMIN_DOMAIN = "zulip.com" - NOTIFICATION_BOT = "notification-bot@zulip.com" - ERROR_BOT = "error-bot@zulip.com" - NEW_USER_BOT = "new-user-bot@zulip.com" - EMAIL_GATEWAY_BOT = "emailgateway@zulip.com" - -######################################################################## -# DEFAULT VALUES FOR SETTINGS -######################################################################## - -# For any settings that are not defined in local_settings.py, -# we want to initialize them to sane default -DEFAULT_SETTINGS = {'TWITTER_CONSUMER_KEY': '', - 'TWITTER_CONSUMER_SECRET': '', - 'TWITTER_ACCESS_TOKEN_KEY': '', - 'TWITTER_ACCESS_TOKEN_SECRET': '', - 'EMAIL_GATEWAY_PATTERN': '', - 'EMAIL_GATEWAY_EXAMPLE': '', - 'EMAIL_GATEWAY_BOT': None, - 'EMAIL_GATEWAY_LOGIN': None, - 'EMAIL_GATEWAY_PASSWORD': None, - 'EMAIL_GATEWAY_IMAP_SERVER': None, - 'EMAIL_GATEWAY_IMAP_PORT': None, - 'EMAIL_GATEWAY_IMAP_FOLDER': None, - 'MANDRILL_API_KEY': '', - 'S3_KEY': '', - 'S3_SECRET_KEY': '', - 'S3_BUCKET': '', - 'S3_AVATAR_BUCKET': '', - 'LOCAL_UPLOADS_DIR': None, - 'MAX_FILE_UPLOAD_SIZE': 25, - 'DROPBOX_APP_KEY': '', - 'ERROR_REPORTING': True, - 'JWT_AUTH_KEYS': {}, - 'NAME_CHANGES_DISABLED': False, - 'DEPLOYMENT_ROLE_NAME': "", - 'RABBITMQ_HOST': 'localhost', - 'RABBITMQ_USERNAME': 'zulip', - 'MEMCACHED_LOCATION': '127.0.0.1:11211', - 'RATE_LIMITING': True, - 'REDIS_HOST': '127.0.0.1', - 'REDIS_PORT': 6379, - # The following bots only exist in non-VOYAGER installs - 'ERROR_BOT': None, - 'NEW_USER_BOT': None, - 'NAGIOS_STAGING_SEND_BOT': None, - 'NAGIOS_STAGING_RECEIVE_BOT': None, - 'APNS_CERT_FILE': None, - 'ANDROID_GCM_API_KEY': None, - 'INITIAL_PASSWORD_SALT': None, - 'FEEDBACK_BOT': 'feedback@zulip.com', - 'FEEDBACK_BOT_NAME': 'Zulip Feedback Bot', - 'API_SUPER_USERS': set(), - 'ADMINS': '', - 'INLINE_IMAGE_PREVIEW': True, - 'CAMO_URI': '', - 'ENABLE_FEEDBACK': PRODUCTION, - 'FEEDBACK_EMAIL': None, - 'ENABLE_GRAVATAR': True, - 'DEFAULT_AVATAR_URI': '/static/images/default-avatar.png', - 'AUTH_LDAP_SERVER_URI': "", - 'EXTERNAL_URI_SCHEME': "https://", - 'ZULIP_COM': False, - 'ZULIP_COM_STAGING': False, - 'STATSD_HOST': '', - 'REMOTE_POSTGRES_HOST': '', - 'REMOTE_POSTGRES_SSLMODE': '', - 'GOOGLE_CLIENT_ID': '', - 'DBX_APNS_CERT_FILE': None, - } - -for setting_name, setting_val in six.iteritems(DEFAULT_SETTINGS): - if not setting_name in vars(): - vars()[setting_name] = setting_val - -# These are the settings that we will check that the user has filled in for -# production deployments before starting the app. It consists of a series -# of pairs of (setting name, default value that it must be changed from) -REQUIRED_SETTINGS = [("EXTERNAL_HOST", "zulip.example.com"), - ("ZULIP_ADMINISTRATOR", "zulip-admin@example.com"), - ("ADMIN_DOMAIN", "example.com"), - # SECRET_KEY doesn't really need to be here, in - # that we set it automatically, but just in - # case, it seems worth having in this list - ("SECRET_KEY", ""), - ("AUTHENTICATION_BACKENDS", ()), - ("NOREPLY_EMAIL_ADDRESS", "noreply@example.com"), - ("DEFAULT_FROM_EMAIL", "Zulip "), - ("ALLOWED_HOSTS", "*"), - ] - -if ADMINS == "": - ADMINS = (("Zulip Administrator", ZULIP_ADMINISTRATOR),) -MANAGERS = ADMINS - -# Voyager is a production zulip server that is not zulip.com or -# staging.zulip.com VOYAGER is the standalone all-on-one-server -# production deployment model for based on the original Zulip -# ENTERPRISE implementation. We expect most users of the open source -# project will be using VOYAGER=True in production. -VOYAGER = PRODUCTION and not ZULIP_COM - -######################################################################## -# STANDARD DJANGO SETTINGS -######################################################################## - -# Local time zone for this installation. Choices can be found here: -# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name -# although not all choices may be available on all operating systems. -# In a Windows environment this must be set to your system time zone. -TIME_ZONE = 'America/New_York' - -# Language code for this installation. All choices can be found here: -# http://www.i18nguy.com/unicode/language-identifiers.html -LANGUAGE_CODE = 'en-us' - -# The ID, as an integer, of the current site in the django_site database table. -# This is used so that application data can hook into specific site(s) and a -# single database can manage content for multiple sites. -# -# We set this site's domain to 'zulip.com' in populate_db. -SITE_ID = 1 - -# If you set this to False, Django will make some optimizations so as not -# to load the internationalization machinery. -USE_I18N = True - -# If you set this to False, Django will not format dates, numbers and -# calendars according to the current locale. -USE_L10N = True - -# If you set this to False, Django will not use timezone-aware datetimes. -USE_TZ = True - -DEPLOY_ROOT = os.path.join(os.path.realpath(os.path.dirname(__file__)), '..') -TEMPLATE_DIRS = ( os.path.join(DEPLOY_ROOT, 'templates'), ) -LOCALE_PATHS = ( os.path.join(DEPLOY_ROOT, 'locale'), ) - -# Make redirects work properly behind a reverse proxy -USE_X_FORWARDED_HOST = True - -# List of callables that know how to import templates from various sources. -TEMPLATE_LOADERS = ( - 'django.template.loaders.filesystem.Loader', - 'django.template.loaders.app_directories.Loader', - ) -if PRODUCTION: - # Template caching is a significant performance win in production. - TEMPLATE_LOADERS = ( - ('django.template.loaders.cached.Loader', - TEMPLATE_LOADERS), - ) - -MIDDLEWARE_CLASSES = ( - # Our logging middleware should be the first middleware item. - 'zerver.middleware.TagRequests', - 'zerver.middleware.LogRequests', - 'zerver.middleware.JsonErrorHandler', - 'zerver.middleware.RateLimitMiddleware', - 'zerver.middleware.FlushDisplayRecipientCache', - 'django.middleware.common.CommonMiddleware', - 'zerver.middleware.SessionHostDomainMiddleware', - 'django.middleware.csrf.CsrfViewMiddleware', - 'django.contrib.auth.middleware.AuthenticationMiddleware', -) - -ANONYMOUS_USER_ID = None - -AUTH_USER_MODEL = "zerver.UserProfile" - -TEST_RUNNER = 'zerver.lib.test_runner.Runner' - -ROOT_URLCONF = 'zproject.urls' - -# Python dotted path to the WSGI application used by Django's runserver. -WSGI_APPLICATION = 'zproject.wsgi.application' - -INSTALLED_APPS = [ - 'django.contrib.auth', - 'django.contrib.contenttypes', - 'django.contrib.sessions', - 'django.contrib.sites', - 'django.contrib.staticfiles', - 'confirmation', - 'guardian', - 'pipeline', - 'zerver', -] - -if not VOYAGER: - INSTALLED_APPS += [ - 'analytics', - 'zilencer', - ] - -# Base URL of the Tornado server -# We set it to None when running backend tests or populate_db. -# We override the port number when running frontend tests. -TORNADO_SERVER = 'http://localhost:9993' -RUNNING_INSIDE_TORNADO = False - -######################################################################## -# DATABASE CONFIGURATION -######################################################################## - -DATABASES = {"default": { - 'ENGINE': 'django.db.backends.postgresql_psycopg2', - 'NAME': 'zulip', - 'USER': 'zulip', - 'PASSWORD': '', # Authentication done via certificates - 'HOST': '', # Host = '' => connect through a local socket - 'SCHEMA': 'zulip', - 'CONN_MAX_AGE': 600, - 'OPTIONS': { - 'connection_factory': TimeTrackingConnection - }, - }, -} - -if DEVELOPMENT: - LOCAL_DATABASE_PASSWORD = get_secret("local_database_password") - DATABASES["default"].update({ - 'PASSWORD': LOCAL_DATABASE_PASSWORD, - 'HOST': 'localhost' - }) -elif REMOTE_POSTGRES_HOST != '': - DATABASES['default'].update({ - 'HOST': REMOTE_POSTGRES_HOST, - }) - if get_secret("postgres_password") is not None: - DATABASES['default'].update({ - 'PASSWORD': get_secret("postgres_password"), - }) - if REMOTE_POSTGRES_SSLMODE != '': - DATABASES['default']['OPTIONS']['sslmode'] = REMOTE_POSTGRES_SSLMODE - else: - DATABASES['default']['OPTIONS']['sslmode'] = 'verify-full' - -######################################################################## -# RABBITMQ CONFIGURATION -######################################################################## - -USING_RABBITMQ = True -RABBITMQ_PASSWORD = get_secret("rabbitmq_password") - -######################################################################## -# CACHING CONFIGURATION -######################################################################## - -SESSION_ENGINE = "django.contrib.sessions.backends.cached_db" - -CACHES = { - 'default': { - 'BACKEND': 'django.core.cache.backends.memcached.PyLibMCCache', - 'LOCATION': MEMCACHED_LOCATION, - 'TIMEOUT': 3600 - }, - 'database': { - 'BACKEND': 'django.core.cache.backends.db.DatabaseCache', - 'LOCATION': 'third_party_api_results', - # Basically never timeout. Setting to 0 isn't guaranteed - # to work, see https://code.djangoproject.com/ticket/9595 - 'TIMEOUT': 2000000000, - 'OPTIONS': { - 'MAX_ENTRIES': 100000000, - 'CULL_FREQUENCY': 10, - } - }, -} - -######################################################################## -# REDIS-BASED RATE LIMITING CONFIGURATION -######################################################################## - -RATE_LIMITING_RULES = [ - (60, 100), # 100 requests max every minute - ] - -######################################################################## -# SECURITY SETTINGS -######################################################################## - -# Tell the browser to never send our cookies without encryption, e.g. -# when executing the initial http -> https redirect. -# -# Turn it off for local testing because we don't have SSL. -if PRODUCTION: - SESSION_COOKIE_SECURE = True - CSRF_COOKIE_SECURE = True - -try: - # For get_updates hostname sharding. - domain = config_file.get('django', 'cookie_domain') - SESSION_COOKIE_DOMAIN = '.' + domain - CSRF_COOKIE_DOMAIN = '.' + domain -except six.moves.configparser.Error: - # Failing here is OK - pass - -# Prevent Javascript from reading the CSRF token from cookies. Our code gets -# the token from the DOM, which means malicious code could too. But hiding the -# cookie will slow down some attackers. -CSRF_COOKIE_PATH = '/;HttpOnly' -CSRF_FAILURE_VIEW = 'zerver.middleware.csrf_failure' - -if DEVELOPMENT: - # Use fast password hashing for creating testing users when not - # PRODUCTION. Saves a bunch of time. - PASSWORD_HASHERS = ( - 'django.contrib.auth.hashers.SHA1PasswordHasher', - 'django.contrib.auth.hashers.PBKDF2PasswordHasher' - ) - # Also we auto-generate passwords for the default users which you - # can query using ./manage.py print_initial_password - INITIAL_PASSWORD_SALT = get_secret("initial_password_salt") - -######################################################################## -# API/BOT SETTINGS -######################################################################## - -if "EXTERNAL_API_PATH" not in vars(): - EXTERNAL_API_PATH = EXTERNAL_HOST + "/api" -EXTERNAL_API_URI = EXTERNAL_URI_SCHEME + EXTERNAL_API_PATH - -S3_KEY = get_secret("s3_key") -S3_SECRET_KEY = get_secret("s3_secret_key") - -# GCM tokens are IP-whitelisted; if we deploy to additional -# servers you will need to explicitly add their IPs here: -# https://cloud.google.com/console/project/apps~zulip-android/apiui/credential -ANDROID_GCM_API_KEY = get_secret("android_gcm_api_key") - -GOOGLE_OAUTH2_CLIENT_SECRET = get_secret('google_oauth2_client_secret') - -DROPBOX_APP_KEY = get_secret("dropbox_app_key") - -MAILCHIMP_API_KEY = get_secret("mailchimp_api_key") - -# This comes from our mandrill accounts page -MANDRILL_API_KEY = get_secret("mandrill_api_key") - -# Twitter API credentials -# Secrecy not required because its only used for R/O requests. -# Please don't make us go over our rate limit. -TWITTER_CONSUMER_KEY = get_secret("twitter_consumer_key") -TWITTER_CONSUMER_SECRET = get_secret("twitter_consumer_secret") -TWITTER_ACCESS_TOKEN_KEY = get_secret("twitter_access_token_key") -TWITTER_ACCESS_TOKEN_SECRET = get_secret("twitter_access_token_secret") - -# These are the bots that Zulip sends automated messages as. -INTERNAL_BOTS = [ {'var_name': 'NOTIFICATION_BOT', - 'email_template': 'notification-bot@%s', - 'name': 'Notification Bot'}, - {'var_name': 'EMAIL_GATEWAY_BOT', - 'email_template': 'emailgateway@%s', - 'name': 'Email Gateway'}, - {'var_name': 'NAGIOS_SEND_BOT', - 'email_template': 'nagios-send-bot@%s', - 'name': 'Nagios Send Bot'}, - {'var_name': 'NAGIOS_RECEIVE_BOT', - 'email_template': 'nagios-receive-bot@%s', - 'name': 'Nagios Receive Bot'}, - {'var_name': 'WELCOME_BOT', - 'email_template': 'welcome-bot@%s', - 'name': 'Welcome Bot'} ] - -INTERNAL_BOT_DOMAIN = "zulip.com" - -# Set the realm-specific bot names -for bot in INTERNAL_BOTS: - if vars().get(bot['var_name']) is None: - bot_email = bot['email_template'] % (INTERNAL_BOT_DOMAIN,) - vars()[bot['var_name'] ] = bot_email - -if EMAIL_GATEWAY_BOT not in API_SUPER_USERS: - API_SUPER_USERS.add(EMAIL_GATEWAY_BOT) -if EMAIL_GATEWAY_PATTERN != "": - EMAIL_GATEWAY_EXAMPLE = EMAIL_GATEWAY_PATTERN % ("support+abcdefg",) - -DEPLOYMENT_ROLE_KEY = get_secret("deployment_role_key") - -if PRODUCTION: - FEEDBACK_TARGET="https://zulip.com/api" -else: - FEEDBACK_TARGET="http://localhost:9991/api" - -######################################################################## -# STATSD CONFIGURATION -######################################################################## - -# Statsd is not super well supported; if you want to use it you'll need -# to set STATSD_HOST and STATSD_PREFIX. -if STATSD_HOST != '': - INSTALLED_APPS += ['django_statsd'] - STATSD_PORT = 8125 - STATSD_CLIENT = 'django_statsd.clients.normal' - -######################################################################## -# CAMO HTTPS CACHE CONFIGURATION -######################################################################## - -if CAMO_URI != '': - # This needs to be synced with the Camo installation - CAMO_KEY = get_secret("camo_key") - -######################################################################## -# STATIC CONTENT AND MINIFICATION SETTINGS -######################################################################## - -STATIC_URL = '/static/' - -# ZulipStorage is a modified version of PipelineCachedStorage, -# and, like that class, it inserts a file hash into filenames -# to prevent the browser from using stale files from cache. -# -# Unlike PipelineStorage, it requires the files to exist in -# STATIC_ROOT even for dev servers. So we only use -# ZulipStorage when not DEBUG. - -# This is the default behavior from Pipeline, but we set it -# here so that urls.py can read it. -PIPELINE = not DEBUG - -if DEBUG: - STATICFILES_STORAGE = 'pipeline.storage.PipelineStorage' - STATICFILES_FINDERS = ( - 'django.contrib.staticfiles.finders.AppDirectoriesFinder', - ) - if PIPELINE: - STATIC_ROOT = 'prod-static/serve' - else: - STATIC_ROOT = 'static/' -else: - STATICFILES_STORAGE = 'zerver.storage.ZulipStorage' - STATICFILES_FINDERS = ( - 'zerver.finders.ZulipFinder', - ) - if PRODUCTION: - STATIC_ROOT = '/home/zulip/prod-static' - else: - STATIC_ROOT = 'prod-static/serve' - -# We want all temporary uploaded files to be stored on disk. -FILE_UPLOAD_MAX_MEMORY_SIZE = 0 - -STATICFILES_DIRS = ['static/'] -STATIC_HEADER_FILE = 'zerver/static_header.txt' - -# To use minified files in dev, set PIPELINE = True. For the full -# cache-busting behavior, you must also set DEBUG = False. -# -# You will need to run update-prod-static after changing -# static files. - -PIPELINE_CSS = { - 'activity': { - 'source_filenames': ('styles/activity.css',), - 'output_filename': 'min/activity.css' - }, - 'portico': { - 'source_filenames': ( - 'third/zocial/zocial.css', - 'styles/portico.css', - 'styles/pygments.css', - 'styles/thirdparty-fonts.css', - 'styles/fonts.css', - ), - 'output_filename': 'min/portico.css' - }, - # Two versions of the app CSS exist because of QTBUG-3467 - 'app-fontcompat': { - 'source_filenames': ( - 'third/bootstrap-notify/css/bootstrap-notify.css', - 'third/spectrum/spectrum.css', - 'styles/zulip.css', - 'styles/pygments.css', - 'styles/thirdparty-fonts.css', - # We don't want fonts.css on QtWebKit, so its omitted here - ), - 'output_filename': 'min/app-fontcompat.css' - }, - 'app': { - 'source_filenames': ( - 'third/bootstrap-notify/css/bootstrap-notify.css', - 'third/spectrum/spectrum.css', - 'third/jquery-perfect-scrollbar/css/perfect-scrollbar.css', - 'styles/zulip.css', - 'styles/pygments.css', - 'styles/thirdparty-fonts.css', - 'styles/fonts.css', - ), - 'output_filename': 'min/app.css' - }, - 'common': { - 'source_filenames': ( - 'third/bootstrap/css/bootstrap.css', - 'third/bootstrap/css/bootstrap-btn.css', - 'third/bootstrap/css/bootstrap-responsive.css', - ), - 'output_filename': 'min/common.css' - }, -} - -JS_SPECS = { - 'common': { - 'source_filenames': ( - 'third/jquery/jquery-1.7.2.js', - 'third/underscore/underscore.js', - 'js/blueslip.js', - 'third/bootstrap/js/bootstrap.js', - 'js/common.js', - ), - 'output_filename': 'min/common.js' - }, - 'signup': { - 'source_filenames': ( - 'js/signup.js', - 'third/jquery-validate/jquery.validate.js', - ), - 'output_filename': 'min/signup.js' - }, - 'initial_invite': { - 'source_filenames': ( - 'third/jquery-validate/jquery.validate.js', - 'js/initial_invite.js', - ), - 'output_filename': 'min/initial_invite.js' - }, - 'api': { - 'source_filenames': ('js/api.js',), - 'output_filename': 'min/api.js' - }, - 'app_debug': { - 'source_filenames': ('js/debug.js',), - 'output_filename': 'min/app_debug.js' - }, - 'app': { - 'source_filenames': [ - 'third/bootstrap-notify/js/bootstrap-notify.js', - 'third/html5-formdata/formdata.js', - 'third/jquery-validate/jquery.validate.js', - 'third/jquery-form/jquery.form.js', - 'third/jquery-filedrop/jquery.filedrop.js', - 'third/jquery-caret/jquery.caret.1.02.js', - 'third/xdate/xdate.dev.js', - 'third/spin/spin.js', - 'third/jquery-mousewheel/jquery.mousewheel.js', - 'third/jquery-throttle-debounce/jquery.ba-throttle-debounce.js', - 'third/jquery-idle/jquery.idle.js', - 'third/jquery-autosize/jquery.autosize.js', - 'third/jquery-perfect-scrollbar/js/perfect-scrollbar.js', - 'third/lazyload/lazyload.js', - 'third/spectrum/spectrum.js', - 'third/winchan/winchan.js', - 'third/sockjs/sockjs-0.3.4.js', - 'third/handlebars/handlebars.runtime.js', - 'third/marked/lib/marked.js', - 'templates/compiled.js', - 'js/feature_flags.js', - 'js/loading.js', - 'js/util.js', - 'js/dict.js', - 'js/localstorage.js', - 'js/channel.js', - 'js/setup.js', - 'js/muting.js', - 'js/muting_ui.js', - 'js/viewport.js', - 'js/rows.js', - 'js/unread.js', - 'js/stream_list.js', - 'js/filter.js', - 'js/narrow.js', - 'js/reload.js', - 'js/compose_fade.js', - 'js/fenced_code.js', - 'js/echo.js', - 'js/socket.js', - 'js/compose.js', - 'js/stream_color.js', - 'js/admin.js', - 'js/stream_data.js', - 'js/subs.js', - 'js/message_edit.js', - 'js/condense.js', - 'js/resize.js', - 'js/floating_recipient_bar.js', - 'js/ui.js', - 'js/click_handlers.js', - 'js/scroll_bar.js', - 'js/gear_menu.js', - 'js/copy_and_paste.js', - 'js/popovers.js', - 'js/typeahead_helper.js', - 'js/search_suggestion.js', - 'js/search.js', - 'js/composebox_typeahead.js', - 'js/navigate.js', - 'js/hotkey.js', - 'js/favicon.js', - 'js/notifications.js', - 'js/hashchange.js', - 'js/invite.js', - 'js/message_list_view.js', - 'js/message_list.js', - 'js/message_flags.js', - 'js/alert_words.js', - 'js/alert_words_ui.js', - 'js/people.js', - 'js/message_store.js', - 'js/server_events.js', - 'js/zulip.js', - 'js/activity.js', - 'js/colorspace.js', - 'js/timerender.js', - 'js/tutorial.js', - 'js/templates.js', - 'js/avatar.js', - 'js/settings.js', - 'js/tab_bar.js', - 'js/emoji.js', - 'js/referral.js', - 'js/custom_markdown.js', - 'js/bot_data.js', - # JS bundled by webpack is also included here if PIPELINE setting is true - ], - 'output_filename': 'min/app.js' - }, - 'activity': { - 'source_filenames': ( - 'third/sorttable/sorttable.js', - ), - 'output_filename': 'min/activity.js' - }, - # We also want to minify sockjs separately for the sockjs iframe transport - 'sockjs': { - 'source_filenames': ('third/sockjs/sockjs-0.3.4.js',), - 'output_filename': 'min/sockjs-0.3.4.min.js' - }, -} - -if PIPELINE: - JS_SPECS['app']['source_filenames'].append('js/bundle.js') - -app_srcs = JS_SPECS['app']['source_filenames'] - -PIPELINE_JS = {} # Now handled in tools/minify-js -PIPELINE_JS_COMPRESSOR = None - -PIPELINE_CSS_COMPRESSOR = 'pipeline.compressors.yui.YUICompressor' -PIPELINE_YUI_BINARY = '/usr/bin/env yui-compressor' - -######################################################################## -# LOGGING SETTINGS -######################################################################## - -ZULIP_PATHS = [ - ("SERVER_LOG_PATH", "/var/log/zulip/server.log"), - ("ERROR_FILE_LOG_PATH", "/var/log/zulip/errors.log"), - ("MANAGEMENT_LOG_PATH", "/var/log/zulip/manage.log"), - ("WORKER_LOG_PATH", "/var/log/zulip/workers.log"), - ("PERSISTENT_QUEUE_FILENAME", "/home/zulip/tornado/event_queues.pickle"), - ("JSON_PERSISTENT_QUEUE_FILENAME", "/home/zulip/tornado/event_queues.json"), - ("EMAIL_MIRROR_LOG_PATH", "/var/log/zulip/email-mirror.log"), - ("EMAIL_DELIVERER_LOG_PATH", "/var/log/zulip/email-deliverer.log"), - ("LDAP_SYNC_LOG_PATH", "/var/log/zulip/sync_ldap_user_data.log"), - ("QUEUE_ERROR_DIR", "/var/log/zulip/queue_error"), - ("STATS_DIR", "/home/zulip/stats"), - ("DIGEST_LOG_PATH", "/var/log/zulip/digest.log"), - ] - -# The Event log basically logs most significant database changes, -# which can be useful for debugging. -if VOYAGER: - EVENT_LOG_DIR = None -else: - ZULIP_PATHS.append(("EVENT_LOG_DIR", "/home/zulip/logs/event_log")) - -for (var, path) in ZULIP_PATHS: - if DEVELOPMENT: - # if DEVELOPMENT, store these files in the Zulip checkout - path = os.path.basename(path) - vars()[var] = path - -ZULIP_WORKER_TEST_FILE = '/tmp/zulip-worker-test-file' - - -if IS_WORKER: - FILE_LOG_PATH = WORKER_LOG_PATH -else: - FILE_LOG_PATH = SERVER_LOG_PATH - -LOGGING = { - 'version': 1, - 'disable_existing_loggers': True, - 'formatters': { - 'default': { - 'format': '%(asctime)s %(levelname)-8s %(message)s' - } - }, - 'filters': { - 'ZulipLimiter': { - '()': 'zerver.lib.logging_util.ZulipLimiter', - }, - 'EmailLimiter': { - '()': 'zerver.lib.logging_util.EmailLimiter', - }, - 'require_debug_false': { - '()': 'django.utils.log.RequireDebugFalse', - }, - 'nop': { - '()': 'zerver.lib.logging_util.ReturnTrue', - }, - 'require_really_deployed': { - '()': 'zerver.lib.logging_util.RequireReallyDeployed', - }, - }, - 'handlers': { - 'zulip_admins': { - 'level': 'ERROR', - 'class': 'zerver.logging_handlers.AdminZulipHandler', - # For testing the handler delete the next line - 'filters': ['ZulipLimiter', 'require_debug_false', 'require_really_deployed'], - 'formatter': 'default' - }, - 'console': { - 'level': 'DEBUG', - 'class': 'logging.StreamHandler', - 'formatter': 'default' - }, - 'file': { - 'level': 'DEBUG', - 'class': 'logging.handlers.TimedRotatingFileHandler', - 'formatter': 'default', - 'filename': FILE_LOG_PATH, - 'when': 'D', - 'interval': 7, - 'backupCount': 100000000, - }, - 'errors_file': { - 'level': 'WARNING', - 'class': 'logging.handlers.TimedRotatingFileHandler', - 'formatter': 'default', - 'filename': ERROR_FILE_LOG_PATH, - 'when': 'D', - 'interval': 7, - 'backupCount': 100000000, - }, - }, - 'loggers': { - '': { - 'handlers': ['console', 'file', 'errors_file'], - 'level': 'INFO', - 'propagate': False, - }, - 'django': { - 'handlers': (['zulip_admins'] if ERROR_REPORTING else []) - + ['console', 'file', 'errors_file'], - 'level': 'INFO', - 'propagate': False, - }, - 'zulip.requests': { - 'handlers': ['console', 'file', 'errors_file'], - 'level': 'INFO', - 'propagate': False, - }, - 'zulip.queue': { - 'handlers': ['console', 'file', 'errors_file'], - 'level': 'WARNING', - 'propagate': False, - }, - 'zulip.management': { - 'handlers': ['file', 'errors_file'], - 'level': 'INFO', - 'propagate': False, - }, - 'requests': { - 'handlers': ['console', 'file', 'errors_file'], - 'level': 'WARNING', - 'propagate': False, - }, - ## Uncomment the following to get all database queries logged to the console - # 'django.db': { - # 'handlers': ['console'], - # 'level': 'DEBUG', - # 'propagate': False, - # }, - } -} - -TEMPLATE_CONTEXT_PROCESSORS = ( - 'zerver.context_processors.add_settings', - 'zerver.context_processors.add_metrics', -) - -ACCOUNT_ACTIVATION_DAYS=7 - -LOGIN_REDIRECT_URL='/' - -# Client-side polling timeout for get_events, in milliseconds. -# We configure this here so that the client test suite can override it. -# We already kill the connection server-side with heartbeat events, -# but it's good to have a safety. This value should be greater than -# (HEARTBEAT_MIN_FREQ_SECS + 10) -POLL_TIMEOUT = 90 * 1000 - -# iOS App IDs -ZULIP_IOS_APP_ID = 'com.zulip.Zulip' -DBX_IOS_APP_ID = 'com.dropbox.Zulip' - -######################################################################## -# SSO AND LDAP SETTINGS -######################################################################## - -USING_APACHE_SSO = ('zproject.backends.ZulipRemoteUserBackend' in AUTHENTICATION_BACKENDS) - -if (len(AUTHENTICATION_BACKENDS) == 1 and - AUTHENTICATION_BACKENDS[0] == "zproject.backends.ZulipRemoteUserBackend"): - HOME_NOT_LOGGED_IN = "/accounts/login/sso" - ONLY_SSO = True -else: - HOME_NOT_LOGGED_IN = '/login' - ONLY_SSO = False -AUTHENTICATION_BACKENDS += ('zproject.backends.ZulipDummyBackend',) - -POPULATE_PROFILE_VIA_LDAP = bool(AUTH_LDAP_SERVER_URI) - -if POPULATE_PROFILE_VIA_LDAP and \ - not 'zproject.backends.ZulipLDAPAuthBackend' in AUTHENTICATION_BACKENDS: - AUTHENTICATION_BACKENDS += ('zproject.backends.ZulipLDAPUserPopulator',) -else: - POPULATE_PROFILE_VIA_LDAP = 'zproject.backends.ZulipLDAPAuthBackend' in AUTHENTICATION_BACKENDS or POPULATE_PROFILE_VIA_LDAP - -######################################################################## -# EMAIL SETTINGS -######################################################################## - -# If an email host is not specified, fail silently and gracefully -if not EMAIL_HOST and PRODUCTION: - EMAIL_BACKEND = 'django.core.mail.backends.dummy.EmailBackend' -elif DEVELOPMENT: - # In the dev environment, emails are printed to the run-dev.py console. - EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend' -else: - EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend' - -EMAIL_HOST_PASSWORD = get_secret('email_password') -if "EMAIL_GATEWAY_PASSWORD" not in vars(): - EMAIL_GATEWAY_PASSWORD = get_secret('email_gateway_password') -if "AUTH_LDAP_BIND_PASSWORD" not in vars(): - AUTH_LDAP_BIND_PASSWORD = get_secret('auth_ldap_bind_password') - -######################################################################## -# MISC SETTINGS -######################################################################## - -if PRODUCTION: - # Filter out user data - DEFAULT_EXCEPTION_REPORTER_FILTER = 'zerver.filters.ZulipExceptionReporterFilter' - -# This is a debugging option only -PROFILE_ALL_REQUESTS = False - -CROSS_REALM_BOT_EMAILS = set(('feedback@zulip.com', 'notification-bot@zulip.com')) diff --git a/docker-compose.yml b/docker-compose.yml index 5462a22..b7c8b42 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -21,7 +21,7 @@ redis: volumes: - "/opt/docker/zulip/redis:/var/lib/redis:rw" zulip: - image: "quay.io/galexrt/zulip:v1.3.10-1" + image: "quay.io/galexrt/zulip:v1.3.11" ports: - "80:80" - "443:443" diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh index 1b48c47..9a92afb 100755 --- a/docker-entrypoint.sh +++ b/docker-entrypoint.sh @@ -56,6 +56,8 @@ export ZULIP_USER_PASS="${ZULIP_USER_PASS:-zulip}" # Auto backup settings AUTO_BACKUP_ENABLED="${AUTO_BACKUP_ENABLED:-True}" AUTO_BACKUP_INTERVAL="${AUTO_BACKUP_INTERVAL:-30 3 * * *}" +# Zulip configuration function specific variable(s) +SPECIAL_SETTING_DETECTION_MODE="${SPECIAL_SETTING_DETECTION_MODE:-True}" # entrypoint.sh specific variable(s) ZPROJECT_SETTINGS="/home/zulip/deployments/current/zproject/settings.py" SETTINGS_PY="/etc/zulip/settings.py" @@ -117,9 +119,15 @@ setConfigurationValue() { local TYPE="$4" if [ -z "$TYPE" ]; then case "$2" in - [Tt][Rr][Uu][Ee]|[Ff][Aa][Ll][Ss][Ee]) + [Tt][Rr][Uu][Ee]|[Ff][Aa][Ll][Ss][Ee]|[Nn]one) TYPE="bool" ;; + [0-9]*) + TYPE="integer" + ;; + \(*\)) + TYPE="array" + ;; *) TYPE="string" ;; @@ -130,6 +138,7 @@ setConfigurationValue() { if [ -z "$2" ]; then return 0 fi + VALUE="$2" ;; literal) VALUE="$1" @@ -309,7 +318,10 @@ zulipConfiguration() { if [ "$setting_key" = "AUTH_LDAP_USER_SEARCH" ] || [ "$setting_key" = "AUTH_LDAP_USER_ATTR_MAP" ] || \ ([ "$setting_key" = "LDAP_APPEND_DOMAIN" ] && [ "$setting_var" = "None" ]) && [ "$setting_key" = "SECURE_PROXY_SSL_HEADER" ] || \ [[ "$setting_key" = "CSRF_"* ]]; then - type="array" + type="array" + fi + if [ -z "$SPECIAL_SETTING_DETECTION_MODE" ] && ([ "$SPECIAL_SETTING_DETECTION_MODE" = "True" ] || [ "$SPECIAL_SETTING_DETECTION_MODE" = "true" ]); then + type="" fi setConfigurationValue "$setting_key" "$setting_var" "$file" "$type" done diff --git a/kubernetes/zulip-rc.yml b/kubernetes/zulip-rc.yml index 1ab2cf1..f5a204a 100644 --- a/kubernetes/zulip-rc.yml +++ b/kubernetes/zulip-rc.yml @@ -1,20 +1,19 @@ apiVersion: v1 kind: ReplicationController metadata: - name: zulip-v1.3.10-1 - namespace: default + name: zulip-v1.3.11 labels: - version: v1.3.10-1 + version: v1.3.11 app: zulip spec: replicas: 1 selector: - version: v1.3.10-1 + version: v1.3.11 app: zulip template: metadata: labels: - version: v1.3.10-1 + version: v1.3.11 app: zulip spec: containers: @@ -60,12 +59,13 @@ spec: - name: postgresql-persistent-storage mountPath: /var/lib/postgresql - name: zulip - image: quay.io/galexrt/zulip:v1.3.10-1 + image: quay.io/galexrt/zulip:v1.3.11 resources: limits: cpu: 100m memory: 3584Mi env: + # Please take a look at the environment variables in docker-compose.yml for all required env variables! - name: DB_HOST value: "database" - name: MEMCACHED_HOST diff --git a/kubernetes/zulip-svc.yml b/kubernetes/zulip-svc.yml index 1c5c3c9..6542964 100644 --- a/kubernetes/zulip-svc.yml +++ b/kubernetes/zulip-svc.yml @@ -2,7 +2,6 @@ apiVersion: v1 kind: Service metadata: name: zulip - namespace: default labels: app: zulip spec: