diff options
510 files changed, 2986 insertions, 3111 deletions
diff --git a/CHANGELOG.old b/CHANGELOG.old deleted file mode 100644 index bb0be94ba..000000000 --- a/CHANGELOG.old +++ /dev/null @@ -1,1705 +0,0 @@ -This is the legacy CHANGELOG. Please see the new ChangeLog file and the ReleaseNotes page at: - -http://reductivelabs.com/trac/puppet/wiki/ReleaseNotes - -0.25.0 - Fixed #2280 - Detailed exit codes fix - - Fixed #198 - Puppet man pages added - - Moved puppetd, puppetmasterd, puppetrun, puppetca from bin to sbin - - Fixed #2071 - Updated LDAP schema - - Fixed #1849 - Ruby 1.9 portability: `when' doesn't like colons, replace with semicolons - - Fixed #1910 - Updated logcheck regex - - Fixed #1879 - Added to tidy documentation - - Fixed #1881 - Added md5lite explanation - - Fixed #1877 - Tidy type reference update for use of 0 - - Fix autotest on win32 - - Doc strings update for REST - - Fixed #1840 - Bug fixes and improvements for Emacs puppet-mode.el - -0.24.8 - Fixed #2077 - ralsh user broken on OSX - - Fixed #2004 - ssh_authorized_key fails if no target is defined - - Fixed #1629 - incorrect permissions on ssh_authorized_keys created files - - Fixed #2000 - No default specified for checksum - - Fixed #2026 - Red Hat ignoring stop method - - Added ext/dbfix.sql script - fixes common errors in stored configuration databases - - Fixed #1963 - Failing to read /proc/mounts for selinux kills file downloads - - Fixed #2025 - gentoo service provider handle only default init level - - Fixed #1910 - updated logcheck - - Fixed #1871 - Sensitive information leaked in log reports - - Fixed #1956 - Cleaned up variable names to be more sane, clarified error messages - and fixed incorrect use of 'value' variable rather than 'member'. - - Fixed #1831 - Added sprintf function - - Fixed #1830 - Added regsubst function - - Updated up2date and service confines to add support for Oracle EL and VM - - Fixing #1948 and #1953 - augeas ins bug: wrong number of arguments (1 for 3) - - Fixing #944 - changing error message from warning to info - connection recycled - - Fixed #961 - puppetd creating too many/not closing TCP connections - - Fixed #1959 - Added column protection for environment schema migration - - Fixing #1869 - autoloaded files should never leak exceptions - - Fixing #1543 - Nagios parse errors no longer kill Puppet - - Fixed #1420 - nagios_serviceescalation not allowing host_name more than one type - - Fixed #1884 - Exported resources are marked as unexported when collected on the exporting host - - Fixed #1922 - Functions squash all arguments into a single hash - - Fixed #1538 - Yumrepo sets permissions wrongly on files in /etc/yum.repos.d - - Fixed #1936 - Added /* */ support to the vim file - - Fixed #1541 - nagios objects write files to clientbucket on every change - - Fixed #1542 - cannot purge nagios objects - - Fixing #1912 - gid still works with no 'should' value fixing ralsh issues - - Fixing the Rakefile to use 'git format-patch' - - Added README.rst file - - Enhancements to Stored Configuration performance - - Added Reductive Labs build library to tasks directory - - Fixed #1852 - Correct behaviour when no SELinux bindings - - Updated Red Hat spec file 0.24.7 - - Fixed #1920 - Shadow password corruption - -0.24.7 - Fixed #1804 - Added VDev and MultiVDev properties to the ZPool type - - Fixed #1496 - nagios_servicedependency needs a unique host_name? - - Fixed #1420 - nagios_serviceescalation not allowing host_name more than one type - - Bug #1803 Zfs should auto require the ancestor file systems - - Refactor #1802 Use 'zfs get -H -o value' instead of parsing output for value - - Fixing #1800 - tidy now correctly ignores missing files and directories - - Fixing #1794 - returning sync when it is already initialized - - Fixing #1750 again - All of the properties and now :ensure check replace? - - Deprecate the NetInfo nameservice provider. Use directoryservice instead - - Add macauthorization type - - Fixing #1703 - using a mutex around the sending of the tagmails - - Fix #1788 - allow rspec rake to run only some tests - - Fixing the AST constant warnings, using a variable instead of a constant - - Feature #1696 Add support for branded zones - - Feature #1783 - Add ZFS support - - type/mcx.rb Feature #1026 - MCX Type - - Fixing #1749 - Splay now hopefully behaves "better" for small values - - Fix #1741 - Add inline_template function - - Slight denormalisation to store a host's environment as a first class - - Added Rake :ci namespace and CI tasks - - Refactoring the thread-safety in Puppet::Util - - Removing the included testing gems; you must now install them yourself - - Refactoring of SELinux functions to use native Ruby SELinux interface - - Removing all mention of EPM, RPM, or Sun packages. - - Fixed #1496 - nagios_servicedependency needs a unique host_name? - - Fixed #1420 - nagios_serviceescalation not allowing host_name more than one type - - Fixed #1695 - Solaris 10 zone provider doesn't properly handle unknown zone attributes in newer releases - - Fixed #1776 - Trivial fix for gentoo service provider - - Fixed #1767 - Minor fix to emacs mode - - Fixed #1711 - fileserver test fails due to incorrect mocking - - Fixed #1751 - Mac OS X DirectoryService nameservice provider support for - plist output and password hash fil - - Fixed #1752 - Add an optional argument to Puppet::Util.execute to determine - whether stderr and stdout are combined in the output - - Added versionable feature to the RPM provider - - Fixed #1668 - puppetca can't clean unsigned certs - - Moved RRD feature from util/metric.rb to feature/base.rb - - Fixed #1735 and #1747 - Fixes to confine system - - Fixed #1681 - Add filesystem type check to test for per-file SELinux context support - - Fixed #1746 - Sync SELinux file attributes after file contents created/modified - - Replaced SELInux calls to binaries with Ruby SELinux bindings - - Fixed #1748 - Include spec directory in packages - - Fixes #1672 - unsafe crontab handling in Solaris - - Fixed #1718 - Added preseed to apt uninstall and purge - - Fixed #1739 - Added uninstall functionality to yum provider - - Fixed #1710 - Spurious output in test run - - Fixed #1667 - Documentation should specify natural language regexs, not Regexp objects - - Fixed #1692 - k5login fails to set mode when file is created - - Fixed #1660 - Added specific recurse values for tidy - - Fixed #1698 - All logs should now show up in the reports - - Fixed #1661 - Type reference: tidy should specify manditory parameters - - Fixed #1104 - Classes and nodes should set $name variables - - Updated Red Hat spec file for 0.24.6 - - Removed conf/debian directory - Debian packaging information - now maintained downstream - - Added augeas type - - Added support for @doc type and manifest documentation support - see: - http://reductivelabs.com/trac/puppet/wiki/PuppetManifestDocumentation - - Added multiline comment support - -0.24.6 - Adding support to the user type for: profiles, auths, project, - key/value pairs (extension to Solaris RBAC support added in - 0.24.6) - - Fixed #1662 - Configuration Reference still references 'section' - - Fixed #1460 - enhance redhat puppetmaster init.d script to easy start puppetmaster as a mongrel cluster - - Fixed #1663 - Regression relating to facter fact naming from 0.24.5 - - Fixed #1655 - Provider::Confine::Variable tests are broken - - Fixed #1646 - service puppet status does not work as non-root - on redhat system - - Fixed #1649 - Updated OSX package cleanup - - Fixed #1647 - puppetdoc -r providers now working again - - Fixed #1639 - uninitialized constant Puppet::Type::User::ProviderUseradd - - Fixed #1637 - With an inexistant (global) templatedir, modules - can't access their templates - - Fixed #1202 - Collection attribute matching doesn't parse arrays - - Fixed #1473 - Puppetd stops with error after puppetmasterd - is unavailable - - Fixed #1354 - yum provider problems with RHEL 3 - - Fixed #1633 - Added support for --detailed-exits to bin/puppet - - Fixed #381 - Allow Allow multiple overrides in one statement - - Fixing #947 - pluginsync no longer fails poorly when no plugins exist - - Fixed #981 - Removed 'Adding aliases' info message - - Fixing #1089 - Log messages are now tagged with the log level, - making it easier to match messages in the 'tagmail' report. - - Fixing #1098 - Multiline strings now correctly increment the line count - - Fixing #1614 - Environments no longer have to be listed out - - Fixed #1628 - Changed node search to use certname rather than Facter - hostname - - Fixed #1613 - The client environment will be substituted when looking - up settings. - - Updated puppet binary documentation - - Feature #1624 - Added RBAC roles to solaris user provider - - Fixed #1586 - Specifying "fully qualified" package names in Gentoo - - Fixed #1620 - Add 'sles' to Puppet confines when 'suse' is used - - Fixed #1585 - Allow complex 'if' and variable expressions - - Fixed #1564 - Saving File#checksum to state.yaml broken - - Fixed #1603 - Added support for running Puppet inside a Rack application - (mod_rails) with Passenger and Apache - - Fixed #1596 - Deploying file resources with ++ generates error - - Modified the group and zone resource types to no longer call - 'currentpropvalues' as a means of setting all values to absent. - There should be no behaviour change from this change. - - Modified the behaviour of resource-level 'retrieve' -- it only - calls 'retrieve' on each property if the resource exists. - - Fixed #1622 - Users and their groups should again add in one transaction - - Fixed #791 - You should now be able to create and find a user/group in one transaction. - - Fixed #1610 - Raise "Filebucketed" messages to Notice priority - - FIxed #1530 - ssh_authorized_keys provider does not crash anymore on SSH type 1 keys - - Added a number of confines to package providers - - Fixed #1609 - Added confines for the Gentoo, FreeBSD and - SMF (Solaris) service providers - - Fixed #1608 - Added ubuntu to defaultfor for apt provider - - Fixed #1607 - Added ubuntu to defaultfor for Debian service - provider - - Fixed #1045 - Multiple metaparams all get added to resources. - - Fixed #1472 -- defined, exported resources in the current compile - now get expanded correctly. - - Fixed #1595 - Internally, Property#retrieve is no longer called - when no 'should' value is available for a resource. - - Fixed #1588 - Fixed puppetca --clean --all - - Fixed #1584 - Added support for appended variables - - Fixed #1554 - Added support for multiple template directories - - Fixed #1500 - puppetrun not working - - Fixed #1579 and #1580 - errors in the Puppet RPM spec file - - Fixed #1572 -- file purging now fails if remote sources do not exist. - - Fixed #1521 -- ldap user and password are now used with the default connection. - - Fixed issues with file descriptors leaking into subprocesses - - Fixed #1568 - createpackage.sh - - Fixed #1571 - Puppet::Util::binary returns incorrect results - - Fixed #1553 - Puppet and Facter cannot both install the plist module into two different locations - - Adjusted hpuxuseradd user provider to confine to HP-UX and fixed HP-UX user provider path regression - - Fixed debug messages in package type - thanks to Todd Zullinger for this fix - - Fixed #1566 - changed password property of the user type - - Fixed debug messages in package type - - Updated Red Hat spec file - - Fixes #1455 - Adds HP-UX support for user type - - Fixes #1551 puppetmaster.freshness xmlrpc call returns incorrect type - - Fixes #1554 - Fix exception for undefined hostname - - Fixed #1533 - changed permissions for man directory - - Added daemontools and runit providers for service type - - Added simple rake task for running unit tests - - Added spec Rake task - - Fixed #1526 - Fixed leak in template - - Fixed #1506 - Removed storeconfig duplicate indexes - - Fixed #1457 - case insensitive match for error - - Fixed #1488 - Moved individual functions out of functions.rb into - lib/puppet/parser/functions directory. New functions should be create in this directory. - - Fixed #1508 - Added HP-UX package provider - - Fixed #1502 - Fixed poor stored configuration performance - - Fixed #1510 - Storeconfiguration fixed for Rails 2.1 - - Add the -P/--ping option to puppetrun, fixes #1501 - - Fixed #1394 - Added stored configuration clearing script to /ext - - Fixed #1442 - replaced use of Facter for report titling with certname - - Fixed $1456 - add proxy configuration capability to yum repo - - Fixed #1457 - removed confine warning - - A working script to create an OS X pkg out of the Puppet repository - - Fixed #1441 - Updated console colours - - Expose all puppet variables as instance member variables of the template wrapper. - This helps resolve redmine #1427, by providing a safe mechanism to access variables. - - * Implement Puppet::Parser::Scope#to_hash, which returns a hash containing all the - variable bindings in the current and, optionally, parent scope. - * Use that to set instance member variables into Puppet::Parser::Templatewrapper - * Report the time taken for variable binding at debug level, to help identify any - performance regression that is encountered in the real world. - * Rename the @scope and @file members of the template wrapper, to avoid clashing - with a scope variable exposed within puppet. - - Ensure that we consistently use either string #{} interpolation or String.% - interpolation, not both, to avoid issues where a #{} interpolated value - contains a % character. - - Feature #1476: Allow specification of --bindir --sbindir --sitelibdir --mandir --destdir - in installation - - Added feature #1241 : Improve performance of group lookups - - Fixed bug #1448: Puppet CA incorrectly writes out all certs to inventory .txt on each - certificate signing - - Fixing puppetlast to make it work with 0.24.5 / 0.25. Made puppetlast work on 0.24.5 - by using the YAML indirector - -0.24.5 - You can now select the encoding format when transferring the catalog, - with 'yaml' still being the default but 'marshal' being an option. - This is because testing has shown drastic performance differences - between the two, with up to 70% of compile time being spent - in YAML code. Use the 'catalog_format' setting to choose your format, - and the setting must be set on the client. - - Fixed #1431 - Provider confines must now specify similar tests in one call. - I.e., you can't do confine :operatingsystem => %w{a b} and then - confine :operatingsystem => %w{b c}; you'd need to do them in one command. - This now-obsolete behaviour does not seem to be used anywhere. - The fix for #1431 is actually just removing the tests that exposed - this change; the change happened when I refactored how confines work. - - Removed faulty interface type - - Updated /spec/unit/rails.rb test - - Fix #1426 - services on redhat are restarted again and status is - called from the Red Hat provider - - Fixed #1414 - Return code from waitpid now right shifted 8 bits - - Fixed #174 - a native type type for managing ssh authorized_keys - files is available. - - Further moves from the examples directory and ext directory - - Fixed #1397 One line fix, fail instead of log - - Moved debian to conf and updated examples directory - - Fixed #1368 - updated Red Hat init scripts - - Added message referencing ReductiveLabs build library - - Fixed #1396 - Added sha1 function from DavidS to core - - Fixed #1399 - the ldap user provider now knows it can manage - passwords. - - Fixed #1272 - if you provide a group name as the gid to an ldap - user, the name will be converted to a gid. Note that this only - looks up ldap groups, at this point; if you want to set an ldap - user's primary group to a local group, you have to specify the GID. - - Fixed #1226 - gems can now specify source repositories. - - Fixed #1232 - the rundir no longer specifies a user/group, - and there are now client- and server-specific yaml directories. - - Fixed 1240 - puppet will function more like puppetd if graphing - or reporting are enabled. - - Fixed #1231 - Exceptions during initialization should now be clearer. - - Fixed #1006 - puppetrun --class works again. I added the class - membership testing to the Ldap node terminus, and added tests, - so it shouldn't break again. - - Fixed #1114 - Facts in plugin directories should now be autoloaded, - as long as you're using Facter 1.5. - - Removed support for the 'node_name' setting in LDAP and external node lookups. - Fixed #1195 - Updated Gentoo init scripts - - Fixed #1367 - Updated Rakefile for new daily builds - - Fixed #1370 - removed test/util/loadedfile.rb tests - - Fixed #1221 - aliases to titles now work for resources. - - Fixed #1012 - templates in the templatedir are preferred to module templates. - - Fixed #707 - special '@reboot'-style cron jobs work again. - - Fixed #1360 - allowdupe works on groups again. - - Fixed #1369 - the init service provider now supports HP-UX. - - Removed support for the 'node_name' setting in LDAP and external node - lookups. - - Also removed support for 'default' nodes in external nodes. - LDAP nodes now use the certificate name, the short name, and 'default', - but external nodes just use the certificate name and any custom terminus - types will use just the certificate name. - - Fixing #1168 (for 0.24.x) -- automatically downcasing the fqdn. - Also requiring that passed in certnames be downcased; the setting - system isn't currently flexible enough to automatically downcase - it for the user. - - Adding a ResourceTemplate class for using templates directly - within resources (i.e., client-side templates). This would really - only be used for composite resources that pass the results of the - template on to generated resources. - - Exporting or collecting resources no longer raises an exception - when no storeconfigs is enabled, it just produces a warning. - - Always using the cert name to store yaml files, which fixes #1178. - The Master handler previously provided the support for the :node_name - setting, and that functionality has now been moved into the Node - class. At the same time, the names to search through have been - changed somewhat: Previously, the certificate name and the - hostname were both used for searching, but now, the cert name - is always searched first (unless node_name == facter), but only - the Facter hostname, domain, and fqdn are used otherwise. We no - longer split the cert name, only the hostname/domain/fqdn. - - Fixing transaction support for prefetching generated resources. - - Adding support for settings within the existing Facter provider confines. - - Moving all confine code out of the Provider class, and fixing #1197. - Created a Confiner module for the Provider class methods, enhanced - the interface between it and the Confine class to make sure binary - paths are searched for fresh each time. - - Modified the 'factpath' setting to automatically configure - Facter to load facts there if a new enough version of - Facter is used. - - Crontab provider: fix a parse error when a line begins with a space - character (fixes #1216) - - Instead of deleting the init scripts (with --del) we should simply - disable it with chkconfig service off, and respectfully do the same - for enable => true; - - Added ldap providers for users and groups. - - Added support for the --all option to puppetca --clean. If - puppetca --clean --all is issued then all client certificates - are removed. - - Resources now return the 'should' value for properties from - the [] accessor method (they previously threw an exception when - this method was used with properties). This shouldn't have any - affect functionally; it just makes the method equivalent to 'should' - for properties, but it works for all attribute types now. - - Modified the 'master' handler to use the Catalog class to - compile node configurations, rather than using the Configuration - handler, which was never used directly. I removed the Configuration - handler as a result. - - Modified the 'master' handler (responsible for sending configurations - to clients) to always return Time.now as its compile date, so - configurations will always get recompiled. - - Fixed #1184 -- definitions now autoload correctly all of the time. - - Removed the code from the client that tries to avoid recompiling - the catalog. The client will now always recompile, assuming it - can reach the server. It will still use the cached config if - there's a failure. - - Fixing #1173 -- classes and definitions can now have the same - name as a directory with no failures. - - Saving new facts now expires any cached node information. - - Switching how caching is handled, so that objects now all - have an expiration date associated with them. This makes it - much easier to know whether a given cached object should be used - or if it should be regenerated. - - Changing the default environment to production. - -0.24.4 - Pass source to pkg_add via the PKG_PATH environment variable if - it ends in a '/' indicating it is a directory. Allows pkg_add - to resolve dependancies, and make it possible to specify packages - without version numbers. - - Fixing #571 -- provider suitability is now checked at resource - evaluation time, rather than resource instantiation time. This - means that you don't catch your "errors" as early, but it also - means you should be able to realistically configure a whole host - in one run. - - Moved the configuration of the Node cache to the puppetmasterd - executable, since it otherwise causes caches to be used in all - cases, which we don't want (e.g., bin/puppet was using them). - - Ported #198 man page creation functionality to 0.24.x branch and - added man pages and man page creation logic to install.rb. The - man pages are stored in man/man8 and will install to config::CONFIG - mandir/man8. - - Fixing #1138 -- the yamldir is automatically created by the - server now that it's in the :puppetmasterd section rather than - a separate :yaml section. - - Disabling http keep-alive as a means of preventing #1010. - There is now a constant in Puppet::Network::HttpPool that will - disable or enable this feature, but note that we determined - that it can cause corruption, especially in file serving (but - it's client-side corruption). - - Applying patch by Ryan McBride to fix OpenBSD package - matching. The actual problem was caused by the fix to #1001. - - Found all instances of methods where split() is used without - any local variables and added a local variable -- see - http://snurl.com/21zf8. My own testing showed that this - caused memory growth to level off at a reasonable level. - Note that the link above says the problem is only with class - methods, but my own testing showed that it's any method that - meets these criteria. This is not a functional change, but - should hopefully be the last nail in the coffin of #1131. - - Found an array that leaked pretty quickly between reparsing - files, thanks to work by Adam Jacob and Arjuna Christenson - (the finding, not the leak). I'm going to act like this - fixes #1131, at least for now, but I doubt it does, - since that shows general memory growth over time, whereas - the leak here should go away as soon as files are reparsed - (because the parser is holding the reference to the leaking - array). - - Fixed #1147: Cached nodes are correctly considered out of - date if the node facts have been updated (thus causing - node facts to again be available in manifests, for those - cases where they were not). - - Fixed #1137: The certificate name is correctly being added - to the facts hash. - - Fixed #1136: Verbose and Debug no longer clobber each other. - - Hopefully *finally* fixed the "already being managed" problem - (#1036). The problem only cropped up if there was a failure - when trying to manage the system -- this would cause the - setting-based resources not to get cleaned up. - -0.24.3 - Modified the ldap node terminus to also use the facts version - as the version for a node, which should similarly encourage the - use of the yaml cache. (Related to #1130) - - Caching node information in yaml (I figured caching in memory will - cause ever-larger memory growth), and changing the external node - terminus to use the version of the facts as their version. This - will usually result in the cached node information being used, - instead of always hitting the external node app during file - serving. Note that if the facts aren't changed by the client, - then this will result in the cached node being used, but at this - point, the client always updates its facts. (#1130) - - Fixing #1132 -- host names can now have dashes anywhere. - (Patch by freiheit.) - - Fixing #1118 -- downloading plugins and facts now ignores noop. - Note that this changes the behaviour a bit -- the resource's - noop setting always beats the global setting (previously, - whichever was true would win). - - The change in checksums from 'timestamp' to 'mtime' no longer - result in updates on every run (#1116). - - Aliases again work in relationships (#1094). - - The CA serial file will no longer ever be owned by - root (#1041). - - Fixing the rest of #1113: External node commands can specify - an environment and Puppet will now use it. - - Partially fixing #1113: LDAP nodes now support environments, - and the schema has been updated accordingly. - - Always duplicating resource defaults in the parser, so that - stacked metaparameter values do not result in all resources - that receive a given default also getting those stacked - values. - -0.24.2 - Fixing #1062 by moving the yamldir setting to its own yaml - section. This should keep the yamldir from being created - on clients. - - Fixed #1047 -- Puppet's parser no longer changes the order - in which statements are evaluated, which means that case - statements can now set variables that are used by other - variables. - - Fixed #1063 -- the master correctly logs syntax errors when - reparsing during a single run. - - Removed the loglevels from the valid values for `logoutput` - in the Exec resource type -- the log levels are specified - using the `loglevel` parameter, not `logoutput`. This never - worked, or at least hasn`t for ages, and now the docs are - just correct. - - Somewhat refactored fileserving so that it no longer caches - any objects, nor does it use Puppet's RAL resources. In the - process, I fixed #894 (you can now copy links) and refactored - other classes as necessary. Mostly it was fixing tests. - - Hopefully partially fixed #1010 -- clients should now fail - to install files whose checksums do not match the checksum - from the server. - - Fixed #1018 -- resources now have their namevars added as - aliases in the resource catalog, just like they were added - in the resource classes. - - Fixed #1037 -- remote unreadable files no longer have the - permission denied exceptions caught, thus forbidding them - from being replaced with 'nil'. - - The environment is now available as a variable in the manifests. - - Fixed #1043 -- autoloading now searches the plugins directory - in each module, in addition to the lib directory. The 'lib' - directory is also deprecated, but supported for now to give - people a chance to convert. - - Fixed #1003 -- Applying DavidS's patch to fix searching for - tags in sql. - - Fixed #992 -- Puppet is now compatible with gems 1.0.1. - - Fixed #968 again, this time with tests -- parseonly works, - including not compiling the configurations, and also storeconfigs - is no longer required during parse-testing. - - Fixed #1021 -- the problem was that my method of determining - the in-degree sometimes resulted in a lower number than the - number of in-edges. - - Fixed #997 -- virtual defined types are no longer evaluated. - NOTE: This introduces a behaviour change, in that you previously - could realize a resource within a virtual defined resource, and now - you must realize the entire defined resource, rather than just - the contained resource. - - Fixed #1030 - class and definition evaluation has been significantly - refactored, fixing this problem and making the whole interplay - between the classes, definitions, and nodes, and the Compile class much - cleaner. - - Exec resources must now have unique names, although the commands can still - be duplicated. This is easily accomplished by just specifying a unique - name with whatever (unique or otherwise) command you need. - - Fixed #989 -- missing CRL files are correctly ignored, and the - value should be set to 'false' to explicitly not look for these - files. - - Fixed #1017 -- environment-specific modulepath is no longer ignored. - - Fixing #794 -- consolidating the gentoo configuration files. - - Fixing #976 -- both the full name of qualified classes and - the class parts are now added as tags. I've also - created a Tagging module that we should push throughout - the rest of the system that uses tags. - - Fixing #995 -- puppetd no longer dies at startup if the server - is not running. - - Fixing #977 -- the rundir is again set to 1777. - - Fixed #971 -- classes can once again be included multiple - times. - - Added builtin support for Nagios types using - Naginator to parse and generate the files. - -0.24.1 - Updated vim filetype detection. (#900 and #963) - - Default resources like schedules no longer conflict with - managed resources. (#965) - - Removing the ability to disable http keep-alive, since - it didn't really work anyway and it should no longer - be necessary. - - Refactored http keep-alive so it actually works again. - This should be sufficient enough that we no longer need the - ability to disable keep-alive. There is now a central - module responsible for managing HTTP instances, along with - all certificates in those instances. - - Fixed a backward compatibility issue when running 0.23.x - clients against 0.24.0 servers -- relationships would - consistently not work. (#967) - - Closing existing http connections when opening a new one, - and closing all connections after each run. (#961) - - Removed warning about deprecated explicit plugins mounts. - -0.24.0 (misspiggy) - Modifying the behaviour of the certdnsnames setting. It now defaults - to an empty string, and will only be used if it is set to something - else. If it is set, then the host's FQDN will also be added as - an alias. The default behaviour is now to add 'puppet' and - 'puppet.$domain' as DNS aliases when the name for the cert being - signed is equal to the signing machine's name, which will only - be the case for CA servers. This should result in servers always - having the alias set up and no one else, but you can still override - the aliases if you want. - - External node support now requires that you set the 'node_terminus' - setting to 'exec'. See the IndirectionReference on the wiki for more - information. - - http_enable_post_connection_check added as a configuration - option for puppetd. This defaults to true, which validates the server - SSL certificate against the requested host name in new versions of ruby. - See #896 for more information. - - Mounts no longer remount swap filesystems. - - Slightly modifying how services manage their list of paths - (and adding documention for it). Services now default - to the paths specified by the provider classes. - - Removed 'type' as a valid attribute for services, since it's been - deprecated since the creation of providers. - - Removed 'running' as a valid attribute for services, since it's - been deprecated since February 2006. - - Added modified patch by Matt Palmer which adds a 'plugins' mount, - fixing #891. See PluginsInModules on the wiki for information on - usage. - - Empty dbserver and dbpassword settings will now be ignored when - initializing Rails connections (patch by womble). - - Configuration settings can now be blank (patch by womble). - - Added calls to endpwent/endgrent when searching for user and group IDs, - which fixes #791. - - Obviated 'target' in interfaces, as all file paths were automatically - calculated anyway. The parameter is still there, but it's - not used and just generates a warning. - - Fixing some of the problems with interface management on Red Hat. - Puppet now uses the :netmask property and does not try to set - the bootproto (#762). - - You now must specify an environment and you are required to specify - the valid environments for your site. (#911) - - Certificates now always specify a subjectAltName, but it defaults - to '*', meaning that it doesn't require DNS names to match. You - can override that behaviour by specifying a value for - 'certdnsnames', which will then require that hostname as a match (#896). - - Relationship metaparams (:notify, :require, :subscribe, and - :before) now stack when they are collecting metaparam values - from their containers (#446). For instance, if a resource - inside a definition has a value set for 'require', and you call - the definition with 'require', the resource gets both requires, - where before it would only retain its initial value. - - Changed the behavior of --debug to include Mongrel client - debugging information. Mongrel output will be written to - the terminal only, not to the puppet debug log. This should - help anyone working with reverse HTTP SSL proxies. (#905) - - Fixed #800 -- invalid configurations are no longer - cached. This was done partially by adding a relationship - validation step once the entire configuration is created, - but it also required the previously-mentioned changes - to how the configuration retrieval process works. - - Removed some functionality from the Master client, - since the local functionality has been replaced - with the Indirector already, and rearranging how configuration - retrieval is done to fix ordering and caching bugs. - - The node scope is now above all other scopes besides - the 'main' scope, which should help make its variables - visible to other classes, assuming those classes were - not included in the node's parent. - - Replaced GRATR::Digraph with Puppet::SimpleGraph as - the base class for Puppet's graphing. Functionality - should be equivalent but with dramatically better - performance. - - The --use-nodes and --no-nodes options are now obsolete. - Puppet automatically detects when nodes are defined, and if - they are defined it will require that a node be found, - else it will not look for a node nor will it fail if it - fails to find one. - - Fixed #832. Added the '--no-daemonize' option to puppetd and - puppetmasterd. NOTE: The default behavior of 'verbose' and - 'debug' no longer cause puppetd and puppetmasterd to not - daemonize. - - Added k5login type. (#759) - - Fixed CA race condition. (#693) - - Added shortname support to config.rb and refactored addargs - -0.23.2 - Fixed the problem in cron jobs where environment settings - tended to multiple. (#749) - - Collection of resources now correctly only collects exported - resources again. This was broken in 0.23.0. (#731) - - 'gen_config' now generates a configuration with - all parameters under a heading that matches the - process name, rather than keeping section headings. - - Refactored how the parser and interpreter relate, - so parsing is now effectively an atomic process (thus - fixing #314 and #729). This makes the interpreter less - prone to error and less prone to show the error to the - clients. Note that this means that if a configuration - fails to parse, then the previous, parseable configuration - will be used instead, so the client will not know that - the configuration failed to parse. - - Added support for managing interfaces, thanks to work - by Paul Rose. - - Fixed #652, thanks to a patch by emerose; --fqdn again - works with puppetd. - - Added an extra check to the Mongrel support so that - Apache can be used with optional cert checking, instead - of mandatory, thus allowing Mongrel to function as the CA. - This is thanks to work done by Marcin Owsiany. - -0.23.1 (beaker) - You can now specify relationships to classes, which work - exactly like relationships to defined types: - require => Class[myclass] - This works with qualified classes, too. - - You can now do simple queries in a collection of - exported resources. You still cannot do multi-condition queries, - though. (#703) - - puppetca now exits with a non-zero code if it cannot - find any host certificates to clean. (Patch by Dean - Wilson.) - - Fully-qualified resources can now have defaults. (#589) - - Resource references can now be fully-qualified names, - meaning you can list definitions with a namespace as - dependencies. (#468) - - Files modified using a FileType instance, as ParsedFile - does, will now automatically get backed up to the filebucket - named "puppet". - - Added a 'maillist' type for managing mailing lists. - - Added a 'mailalias' type for managing mail aliases. - - Added patch by Valentin Vidic that adds the '+>' syntax to - resources, so parameter values can be added to. - - The configuration client now pulls libraries down to $libdir, - and all autoloading is done from there with full support - for any reloadable file, such as types and providers. (#621) - Note that this is not backward compatible -- if you're using - pluginsync right now, you'll need to disable it on your clients - until you can upgrade them. - - The Rails log level can now be set via (shockingly!) the - 'rails_loglevel' parameter (#710). Note that this isn't - exactly the feature asked for, but I could not find a - way to directly copy ActiveRecord's concept of an environment. - - External node sources can now return undefined classes (#687). - - Puppet clients now have http proxy support (#701). - - The parser now throws an error when a resource reference - is created for an unknown type. Also, resource references - look up defined types and translate their type accordingly. (#706) - - Hostnames can now be double quoted. - - Adding module autoloading (#596) -- you can now 'include' classes - from modules without ever needing to specifically load them. - - Class names and node names now conflict (#620). - -0.23.0 - Modified the fileserver to cache file information, so that - each file isn't being read on every connection. Also, - added londo's patch from #678 to avoid reading entire files - into memory. - - Fixed environment handling in the crontab provider (#669). - - Added patch by trombik in #572, supporting old-style - freebsd init scripts with '.sh' endings. - - Added fink package provider (#642), as provided by 'do'. - - Marked the dpkg package provider as versionable (#647). - - Applied patches by trombik to fix FreeBSD ports (#624 and #628). - - Fixed the CA server so that it refuses to send back a certificate - whose public key doesn't match the CSR. Instead, it tells the - user to run 'puppetca --clean'. - - Invalid certificates are no longer written to disk (#578). - - Added a package provider (appdmg) able to install .app packages - on .dmg files on OS X (#641). - - Applied the patch from #667 to hopefully kill the client hanging - problems (permanently, this time). - - Fixed functions so that they accept most other rvalues as valid values - (#548). - - COMPATIBILITY ALERT: - Significantly reworked external node support, in a way that's NOT - backward-compatible: - - Only ONE node source can be used -- you can use LDAP, code, or - an external node program, but not more than one. - - LDAP node support has two changes: First, the "ldapattrs" attribute is - now used for setting the attributes to retrieve from the server (in - addition to required attriutes), and second, all retrieved attributes - are set as variables in the top scope. This means you can set attributes - on your LDAP nodes and they will automatically appear as variables - in your configurations. - - External node support has been completely rewritten. These programs must - now generate a YAML dump of a hash, with "classes" and "parameters" keys. - The classes should be an array, and the parameters should be a hash. The - external node program has no support for parent nodes -- the script must - handle that on its own. - - Reworked the database schema used to store configurations with the - storeconfigs option. - - Replaced the obsolete RRD ruby library with the maintained - RubyRRDtool library (which requires rrdtool2) (#659). - - The Portage package provider now calls eix-update automatically - when eix's database is absent or out of sync (#666). - - Mounts now correctly handle existing fstabs with no pass or dump values - (#550). - - Mounts now default to 0 for pass and dump (#112). - - Added urpmi support (#592). - - Finishing up the type => provider interface work. Basically, package - providers now return lists of provider instances. In the proces, - I rewrote the interface between package types and providers, and also - enabled prefetching on all packages. This should significantly speed - up most package operations. - - Hopefully fixing the file descriptor/open port problems, with patches - from Valentin Vidic. - - Significantly reworked the type => provider interface with respect to - listing existing provider instances. The class method on both - class heirarchies has been renamed to 'instances', to start. Providers - are now expected to return provider instances, instead of creating - resources, and the resource's 'instances' method is expected to - find the matching resource, if any, and set the resource's - provider appropriately. This *significantly* reduces the reliance on - effectively global state (resource references in the resource classes). - This global state will go away soon. - - Along with this change, the 'prefetch' class method on providers now - accepts the list of resources for prefetching. This again reduces - reliance on global state, and makes the execution path much easier - to follow. - - Fixed #532 -- reparsing config files now longer throws an exception. - - Added some warnings and logs to the service type so - users will be encouraged to specify either "ensure" - or "enabled" and added debugging to indicate why - restarting is skipped when it is. - - Changed the location of the classes.txt to the state - directory. - - Added better error reporting on unmatched brackets. - - Moved puppetd and puppetmasterd to sbin in svn and fixed install.rb - to copy them into sbin on the local system appropriately. (#323) - - Added a splay option (#501). It's disabled when running under - --test in puppetd. The value is random but cached. It defaults - to the runinterval but can be tuned with --splaylimit - - Changing the notify type so that it always uses - the loglevel. - - Fixing #568 - nodes can inherit from quoted node names. - - Tags (and thus definitions and classes) can now be a single - character. (#566) - - Added an 'undef' keyword (#629), which will evaluate to "" - within strings but when used as a resource parameter value - will cause that parameter to be evaluated as undefined. - - Changed the topological sort algorithm (#507) so it will always - fail on cycles. - - Added a 'dynamicfacts' configuration option; any facts in that - comma-separated list will be ignored when comparing facts to - see if they have changed and thus whether a recompile is necessary. - - Renamed some poorly named internal variables: - @models in providers are now either @resource or - @resource_type (#605). - - @children is no longer used except by components (#606). - - @parent is now @resource within parameters (#607). - - The old variables are still set for backward compatibility. - - Significantly reworking configuration parsing. Executables all now - look for 'puppet.conf' (#206), although they will parse the old-style - configuration files if they are present, although they throw a deprecation - warning. Also, file parameters (owner, mode, group) are now set on the - same line as the parameter, in brackets. (#422) - - Added transaction summaries (available with the --summarize option), - useful for getting a quick idea of what happened in a transaction. - Currently only useful on the client or with the puppet interpreter. - - Changed the interal workings for retrieve and removed the :is attribute - from Property. The retrieve methods now return the current value of - the property for the system. - - Removed acts_as_taggable from the rails models. - -0.22.4 - Execs now autorequire the user they run as, as long as the user - is specified by name. (#430) - - Files on the local machine but not on the remote server during - a source copy are now purged if purge => true. (#594) - - Providers can now specify that some commands are optional (#585). - Also, the 'command' method returns nil on missing commands, - rather than throwing an error, so the presence of commands - be tested. - - The 'useradd' provider for Users can now manage passwords. - No other providers can, at this point. - - Parameters can now declare a dependency on specific - features, and parameters that require missing features - will not be instantiated. This is most useful for - properties. - - FileParsing classes can now use instance_eval to add - many methods at once to a record type. - - Modules no longer return directories in the list of found - manifests (#588). - - The crontab provider now defaults to root when there is no - USER set in the environment. - - Puppetd once again correctly responds to HUP. - - Added a syntax for referring to variables defined in - other classes (e.g., $puppet::server). - - STDIN, STDOUT, STDERR are now redirected to /dev/null in - service providers descending from base. - - Certificates are now valid starting one day before they are - created, to help handle small amounts of clock skew. - - Files are no longer considered out of sync if some properties - are out of sync but they have no properties that can create - the file. - -0.22.3 - Fixed backward compatibility for logs and metrics from older clients. - - Fixed the location of the authconfig parameters so there aren't - loading order issues. - - Enabling attribute validation on the providers that subclass - 'nameservice', so we can verify that an integer is passed to - UID and GID. - - Added a stand-alone filebucket client, named 'filebucket'. - - Fixed the new nested paths for filebuckets; the entire md5 sum was - not being stored. - - Fixing #553; -M is no longer added when home directories are being - managed on Red Hat. - -0.22.2 (grover) - Users can now manage their home directories, using the managehome - parameter, partially using patches provided by Tim Stoop and - Matt Palmer. (#432) - - Added 'ralsh' (formerly x2puppet) to the svn tree. When possible it - should be added to the packages. - - The 'notify' type now defaults to its message being the same as its name. - - Reopening $stdin to read from /dev/null during execution, in hopes that - init scripts will stop hanging. - - Changed the 'servername' fact set on the server to use the server's fqdn, - instead of the short-name. - - Changing the location of the configuration cache. It now defaults to being - in the state directory, rather than in the configuration directory. - - All parameter instances are stored in a single @parameters instance variable - hash within resource type instances. We used to use separate hashes for - each parameter type. - - Added the concept of provider features. Eventually these should be able - to express the full range of provider functionality, but for now they can - test a provider to see what methods it has set and determine what features it - provides as a result. These features are integrated into the doc generation - system so that you get feature documentation automatically. - - Switched apt/aptitide to using "apt-cache policy" instead of "apt-cache showpkg" - for determining the latest available version. (#487) - - FileBuckets now use a deeply nested structure for storing files, so - you do not end up with hundreds or thousands of files in the same - directory. (#447) - - Facts are now cached in the state file, and when they change the configuration - is always recompiled. (#519) - - Added 'ignoreimport' setting for use in commit hooks. This causes the - parser to ignore import statements so a single file can be parse-checked. (#544) - - Import statements can now specify multiple comma-separated arguments. - - Definitions now support both 'name' and 'title', just like any other - resource type. (#539) - - Added a generate() command, which sets values to the result of an external - command. (#541) - - Added a file() command to read in files with no interpolation. The first - found file has its content returned. - - puppetd now exits if no cert is present in onetime mode. (#533) - - The client configuration cache can be safely removed and the client - will correctly realize the client is not in sync. - - Resources can now be freely deleted, thus fixing many problems introduced - when deletion of required resources was forbidden when purging was introduced. - Only resources being purged will not be deleted. - - Facts and plugins now download even in noop mode (#540). - - Resources in noop mode now log when they would have responded to an event (#542). - - Refactored cron support entirely. Cron now uses providers, and there - is a single 'crontab' provider that handles user crontabs. While this - refactor does not include providers for /etc/crontab or cron.d, it should - now be straightforward to write those providers. - - Changed the parameter sorting so that the provider parameter comes - right after name, so the provider is available when the other parameters - and properties are being created. - - Redid some of the internals of the ParsedFile provider base class. - It now passes a FileRecord around instead of a hash. - - Fixing a bug related to link recursion that caused link directories - to always be considered out of sync. - - The bind address for puppetmasterd can now be specified with - --bindaddress. - - Added (probably experimental) mongrel support. At this point you're - still responsible for starting each individual process, and you have to - set up a proxy in front of it. - - Redesigned the 'network' tree to support multiple web servers, including - refactoring most of the structural code so it's much clearer and more - reusable now. - - Set up the CA client to default to ca_server and ca_port, so you can - easily run a separate CA. - - Supporting hosts with no domain name, thanks to a patch from - Dennis Jacobfeuerborn. - - Added an 'ignorecache' option to tell puppetd to force a recompile, thanks to - a patch by Chris McEniry. - - Made up2date the default for RHEL < 4 and yum the default for the rest. - - The yum provider now supports versions. - - Case statements correctly match when multiple values are provided, - thanks to a patch by David Schmitt. - - Functions can now be called with no arguments. - - String escapes parse correctly in all cases now, thanks to a patch by - cstorey. - - Subclasses again search parent classes for defaults. - - You can now purge apt and dpkg packages. - - When doing file recursion, 'ensure' only affects the top-level directory. - - States have been renamed to Properties. - -0.22.1 (kermit) -- Mostly a bugfix release - Compile times now persist between restarts of puppetd. - - Timeouts have been added to many parts of Puppet, reducing the likelihood - if it hanging forever on broken scripts or servers. - - All of the documentation and recipes have been moved to the wiki by Peter - Abrahamsen and Ben Kite has moved the FAQ to the wiki. - - Explicit relationships now override automatic relationships, allowing you - to manually specify deletion order when removing resources. - - Resources with dependencies can now be deleted as long as all of their - dependencies are also being deleted. - - Namespaces for both classes and definitions now work much more consistently. - You should now be able to specify a class or definition with a namespace - everywhere you would normally expect to be able to specify one without. - - Downcasing of facts can be selectively disabled. - - Cyclic dependency graphs are now checked for and forbidden. - - The netinfo mounts provider was commented out, because it really doesn't - work at all. Stupid NetInfo stores mount information with the device as - the key, which doesn't work with my current NetInfo code. - - Otherwise, lots and lots of bugfixes. Check the tickets associated with the - 'kermit' milestone. - -0.22.0 - Integrated the GRATR graph library into Puppet, for handling resource - relationships. - - Lots of bug-fixes (see bugs tickets associated with the 'minor' milestone). - - Added new 'resources' metatype, which currently only includes the ability - to purge unmanaged resources. - - Added better ability to generate new resource objects during transactions - (using 'generate' and 'eval_generate' methods). - - Rewrote all Rails support with a much better database design. Export/collect - now works, although the database is incompatible with previous versions. - - Removed downcasing of facts and made most of the language case-insensitive. - - Added support for printing the graphs built during transactions. - - Reworked how paths are built for logging. - - Switched all providers to directly executing commands instead of going through - a subshell, which removes the need to quote or escape arguments. - -0.20.1 - Mostly a bug-fix release, with the most important fix being the - multiple-definition error. - - Completely rewrote the ParsedFile system; each provider is now much - shorter and much more maintainable. However, fundamental problems - were found with the 'port' type, so it was disabled. Also, added - a NetInfo provider for 'host' and an experimental NetInfo provider - for 'mount'. - - Made the RRDGraph report *much* better and added reference - generation for reports and functions. - -0.20.0 - Significantly refactored the parser. Resource overrides now consistently - work anywhere in a class hierarchy. - - The language was also modified somewhat. The previous export/collect syntax - is now used for handling virtual objects, and export/collect (which is still - experimental) now uses double sigils (@@ and <<| |>>). - - Resource references (e.g., File["/etc/passwd"]) now have to be capitalized, - in fitting in with capitalizing type operations. - - As usual, lots of other smaller fixes, but most of the work was in the language. - -0.19.3 - Fixing a bug in server/master.rb that causes the hostname - not to be available in locally-executed manifests. - -0.19.2 - Fixing a few smaller bugs, notably in the reports system. - - Refreshed objects now generate an event, which can result in further - refreshes of other objects. - -0.19.1 - Fixing two critical bugs: User management works again and cron jobs are - no longer added to all user accounts. - -0.19.0 - Added provider support. - - Added support for %h, %H, and %d expansion in fileserver.conf. - - Added Certificate Revocation support. - - Made dynamic loading pervasive -- nearly every aspect of Puppet will now - automatically load new instances (e.g., types, providers, and reports). - - Added support for automatic distribution of facts and plugins (custom types). - -0.18.4 - Another bug-fix release. The most import bug fixed is that - cronjobs again work even with initially empty crontabs. - -0.18.3 - Mostly a bug-fix release; fixed small bugs in the functionality added in - 0.18.2. - -0.18.2 - Added templating support. - - Added reporting. - - Added gem and blastwave packaging support. - -0.18.1 - Added signal handlers for HUP, so both client and server deal correctly with it. - - Added signal handler for USR1, which triggers a run on the client. - - As usual, fixed many bugs. - - Significant fixes to puppetrun -- it should behave much more correctly now. - - Added "fail" function which throws a syntax error if it's encountered. - - Added plugin downloading from the central server to the client. It must be - enabled with --pluginsync. - - Added support for FreeBSD's special "@daily" cron schedules. - - Correctly handling spaces in file sources. - - Moved documentation into svn tree. - -0.18.0 - Added support for a "default" node. - - When multiple nodes are specified, they must now be comma-separated (this - introduces a language incompatibility). - - Failed dependencies cause dependent objects within the same transaction - not to run. - - Many updates to puppetrun - - Many bug fixes - - Function names are no longer reserved words. - - Links can now replace files. - -0.17.2 - Added "puppetrun" application and associated runner server and client classes. - - Fixed cron support so it better supports valid values and environment settings. - -0.17.1 - Fixing a bug requiring rails on all Debian boxes - - Fixing a couple of other small bugs - -0.17.0 - Adding ActiveRecord integration on the server - - Adding export/collect functionality - - Fixing many bugs - -0.16.5 - Fixing a critical bug in importing classes from other files - - Fixing nodename handling to actually allow dashes - -0.16.4 - Fixing a critical bug in puppetd when acquiring a certificate for the first - time - -0.16.3 - Some significant bug fixes - - Modified puppetd so that it can now function as an agent independent - of a puppetmasterd process, e.g., using the PuppetShow web application. - -0.16.2 - Modified some of the AST classes so that class names, definition names, and - node names are all set within the code being evaluated, so 'tagged(name)' returns - true while evaluating 'name', for instance. - - Added '--clean' argument to puppetca to remove all traces of a given - client. - -0.16.1 - Added 'tagged' and 'defined' functions. - - Moved all functions to a general framework that makes it very easy to add new - functions. - -0.16.0 - Added 'tag' keyword/function. - - Added FreeBSD Ports support - - Added 'pelement' server for sending or receiving Puppet objects, although - none of the executables use it yet. - -0.15.3 - Fixed many bugs in :exec, including adding support for arrays of checks - - Added autoloading for types and service variants (e.g., you can now - just create a new type in the appropriate location and use it in Puppet, - without modifying the core Puppet libs). - -0.15.2 - Added darwinport, Apple .pkg, and freebsd package types - Added 'mount type - Host facts are now set at the top scope (Bug #103) - Added -e (inline exection) flag to 'puppet' executable - Many small bug fixes - -0.15.1 - Fixed 'yum' installs so that they successfully upgrade packages. - Fixed puppetmasterd.conf file so group settings take. - -0.15.0 - Upped the minor release because the File server is incompatible with 0.14, - because it now handles links. - - The 'symlink' type is deprecated (but still present), in favor of using - files with the 'target' parameter. - - Unset variables no longer throw an error, they just return an empty string - - You can now specify tags to restrict which objects run during a given run. - - You can also specify to skip running against the cached copy when there's - a failure, which is useful for testing new configurations. - - RPMs and Sun packages can now install, as long as they specify a package - location, and they'll automatically upgrade if you point them to a new - file with an upgrade. - Multiple bug fixes. - - -0.14.1 - Fixed a couple of small logging bugs - Fixed a bug with handling group ownership of links - -0.14.0 - Added some ability to selectively manage symlinks when doing file management - Many bug fixes - Variables can now be used as the test values in case statements and selectors - Bumping a minor release number because 0.13.4 introduced a protocol - incompatibility and should have had a minor rev bump - -0.13.6 - Many, many small bug fixes - FreeBSD user/group support has been added - The configuration system has been rewritten so that daemons can now generate - and repair the files and directories they need. (Fixed bug #68.) - Fixed the element override issues; now only subclasses can override values. - -0.13.5 - Fixed packages so types can be specified - Added 'enable' state to services, although it does not work everywhere yet - -0.13.4 - A few important bug fixes, mostly in the parser. - -0.13.3 - Changed transactions to be one-stage instead of two - Changed all types to use self[:name] instead of self.name, to support - the symbolic naming implemented in 0.13.1 - -0.13.2 - Changed package[answerfile] to package[adminfile], and added package[responsefile] - Fixed a bunch of internal functions to behave more consistently and usefully - -0.13.1 - Fixed RPM spec files to create puppet user and group (lutter) - Fixed crontab reading and writing (luke) - Added symbolic naming in the language (luke) - -0.13.0 - Added support for configuration files. - Even more bug fixes, including the infamous 'frozen object' bug, which was a - problem with 'waitforcert'. - David Lutterkort got RPM into good shape. - -0.12.0 - Added Scheduling, and many bug fixes, of course. - -0.11.2 - Fixed bugs related to specifying arrays of requirements - Fixed a key bug in retrieving checksums - Fixed lots of usability bugs - Added 'fail' methods that automatically add file and line info when possible, - and converted many errors to use that method - -0.11.1 - Fixed bug with recursive copying with 'ignore' set. - Added OpenBSD package support. - -0.11.0 - Added 'ensure' state to many elements. - Modified puppetdoc to correctly handle indentation and such. - Significantly rewrote much of the builtin documentation to take advantage - of the new features in puppetdoc, including many examples. - -0.10.2 - Added SMF support - Added autorequire functionality, with specific support for exec and file - Exec elements autorequire any mentioned files, including the scripts, - along with their CWDs. - Files autorequire any parent directories. - Added 'alias' metaparam. - Fixed dependencies so they don't depend on file order. - -0.10.1 - Added Solaris package support and changed puppetmasterd to run as - a non-root user. - -0.10.0 - Significant refactoring of how types, states, and parameters work, including - breaking out parameters into a separate class. This refactoring did not - introduce much new functionality, but made extension of Puppet significantly - easier - - Also, fixed the bug with 'waitforcert' in puppetd. - -0.9.4 - Small fix to wrap the StatusServer class in the checks for required classes. - -0.9.3 - Fixed some significant bugs in cron job management. - -0.9.2 - Second Public Beta - -0.9.0 - First Public Beta diff --git a/COPYING b/COPYING deleted file mode 100644 index 3912109b5..000000000 --- a/COPYING +++ /dev/null @@ -1,340 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 2, June 1991 - - Copyright (C) 1989, 1991 Free Software Foundation, Inc. - 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -License is intended to guarantee your freedom to share and change free -software--to make sure the software is free for all its users. This -General Public License applies to most of the Free Software -Foundation's software and to any other program whose authors commit to -using it. (Some other Free Software Foundation software is covered by -the GNU Library General Public License instead.) You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -this service if you wish), that you receive source code or can get it -if you want it, that you can change the software or use pieces of it -in new free programs; and that you know you can do these things. - - To protect your rights, we need to make restrictions that forbid -anyone to deny you these rights or to ask you to surrender the rights. -These restrictions translate to certain responsibilities for you if you -distribute copies of the software, or if you modify it. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must give the recipients all the rights that -you have. You must make sure that they, too, receive or can get the -source code. And you must show them these terms so they know their -rights. - - We protect your rights with two steps: (1) copyright the software, and -(2) offer you this license which gives you legal permission to copy, -distribute and/or modify the software. - - Also, for each author's protection and ours, we want to make certain -that everyone understands that there is no warranty for this free -software. If the software is modified by someone else and passed on, we -want its recipients to know that what they have is not the original, so -that any problems introduced by others will not reflect on the original -authors' reputations. - - Finally, any free program is threatened constantly by software -patents. We wish to avoid the danger that redistributors of a free -program will individually obtain patent licenses, in effect making the -program proprietary. To prevent this, we have made it clear that any -patent must be licensed for everyone's free use or not licensed at all. - - The precise terms and conditions for copying, distribution and -modification follow. - - GNU GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License applies to any program or other work which contains -a notice placed by the copyright holder saying it may be distributed -under the terms of this General Public License. The "Program", below, -refers to any such program or work, and a "work based on the Program" -means either the Program or any derivative work under copyright law: -that is to say, a work containing the Program or a portion of it, -either verbatim or with modifications and/or translated into another -language. (Hereinafter, translation is included without limitation in -the term "modification".) Each licensee is addressed as "you". - -Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running the Program is not restricted, and the output from the Program -is covered only if its contents constitute a work based on the -Program (independent of having been made by running the Program). -Whether that is true depends on what the Program does. - - 1. You may copy and distribute verbatim copies of the Program's -source code as you receive it, in any medium, provided that you -conspicuously and appropriately publish on each copy an appropriate -copyright notice and disclaimer of warranty; keep intact all the -notices that refer to this License and to the absence of any warranty; -and give any other recipients of the Program a copy of this License -along with the Program. - -You may charge a fee for the physical act of transferring a copy, and -you may at your option offer warranty protection in exchange for a fee. - - 2. You may modify your copy or copies of the Program or any portion -of it, thus forming a work based on the Program, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) You must cause the modified files to carry prominent notices - stating that you changed the files and the date of any change. - - b) You must cause any work that you distribute or publish, that in - whole or in part contains or is derived from the Program or any - part thereof, to be licensed as a whole at no charge to all third - parties under the terms of this License. - - c) If the modified program normally reads commands interactively - when run, you must cause it, when started running for such - interactive use in the most ordinary way, to print or display an - announcement including an appropriate copyright notice and a - notice that there is no warranty (or else, saying that you provide - a warranty) and that users may redistribute the program under - these conditions, and telling the user how to view a copy of this - License. (Exception: if the Program itself is interactive but - does not normally print such an announcement, your work based on - the Program is not required to print an announcement.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Program, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Program, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Program. - -In addition, mere aggregation of another work not based on the Program -with the Program (or with a work based on the Program) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may copy and distribute the Program (or a work based on it, -under Section 2) in object code or executable form under the terms of -Sections 1 and 2 above provided that you also do one of the following: - - a) Accompany it with the complete corresponding machine-readable - source code, which must be distributed under the terms of Sections - 1 and 2 above on a medium customarily used for software interchange; or, - - b) Accompany it with a written offer, valid for at least three - years, to give any third party, for a charge no more than your - cost of physically performing source distribution, a complete - machine-readable copy of the corresponding source code, to be - distributed under the terms of Sections 1 and 2 above on a medium - customarily used for software interchange; or, - - c) Accompany it with the information you received as to the offer - to distribute corresponding source code. (This alternative is - allowed only for noncommercial distribution and only if you - received the program in object code or executable form with such - an offer, in accord with Subsection b above.) - -The source code for a work means the preferred form of the work for -making modifications to it. For an executable work, complete source -code means all the source code for all modules it contains, plus any -associated interface definition files, plus the scripts used to -control compilation and installation of the executable. However, as a -special exception, the source code distributed need not include -anything that is normally distributed (in either source or binary -form) with the major components (compiler, kernel, and so on) of the -operating system on which the executable runs, unless that component -itself accompanies the executable. - -If distribution of executable or object code is made by offering -access to copy from a designated place, then offering equivalent -access to copy the source code from the same place counts as -distribution of the source code, even though third parties are not -compelled to copy the source along with the object code. - - 4. You may not copy, modify, sublicense, or distribute the Program -except as expressly provided under this License. Any attempt -otherwise to copy, modify, sublicense or distribute the Program is -void, and will automatically terminate your rights under this License. -However, parties who have received copies, or rights, from you under -this License will not have their licenses terminated so long as such -parties remain in full compliance. - - 5. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Program or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Program (or any work based on the -Program), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Program or works based on it. - - 6. Each time you redistribute the Program (or any work based on the -Program), the recipient automatically receives a license from the -original licensor to copy, distribute or modify the Program subject to -these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties to -this License. - - 7. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Program at all. For example, if a patent -license would not permit royalty-free redistribution of the Program by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Program. - -If any portion of this section is held invalid or unenforceable under -any particular circumstance, the balance of the section is intended to -apply and the section as a whole is intended to apply in other -circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system, which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 8. If the distribution and/or use of the Program is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Program under this License -may add an explicit geographical distribution limitation excluding -those countries, so that distribution is permitted only in or among -countries not thus excluded. In such case, this License incorporates -the limitation as if written in the body of this License. - - 9. The Free Software Foundation may publish revised and/or new versions -of the General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - -Each version is given a distinguishing version number. If the Program -specifies a version number of this License which applies to it and "any -later version", you have the option of following the terms and conditions -either of that version or of any later version published by the Free -Software Foundation. If the Program does not specify a version number of -this License, you may choose any version ever published by the Free Software -Foundation. - - 10. If you wish to incorporate parts of the Program into other free -programs whose distribution conditions are different, write to the author -to ask for permission. For software which is copyrighted by the Free -Software Foundation, write to the Free Software Foundation; we sometimes -make exceptions for this. Our decision will be guided by the two goals -of preserving the free status of all derivatives of our free software and -of promoting the sharing and reuse of software generally. - - NO WARRANTY - - 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY -FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN -OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES -PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED -OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS -TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE -PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, -REPAIR OR CORRECTION. - - 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR -REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, -INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING -OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED -TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY -YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER -PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE -POSSIBILITY OF SUCH DAMAGES. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - <one line to give the program's name and a brief idea of what it does.> - Copyright (C) <year> <name of author> - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - - -Also add information on how to contact you by electronic and paper mail. - -If the program is interactive, make it output a short notice like this -when it starts in an interactive mode: - - Gnomovision version 69, Copyright (C) year name of author - Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, the commands you use may -be called something other than `show w' and `show c'; they could even be -mouse-clicks or menu items--whatever suits your program. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the program, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the program - `Gnomovision' (which makes passes at compilers) written by James Hacker. - - <signature of Ty Coon>, 1 April 1989 - Ty Coon, President of Vice - -This General Public License does not permit incorporating your program into -proprietary programs. If your program is a subroutine library, you may -consider it more useful to permit linking proprietary applications with the -library. If this is what you want to do, use the GNU Library General -Public License instead of this License. @@ -1,17 +1,17 @@ -Puppet - Automating Configuration Management. Copyright (C) 2005 Puppet Labs LLC + Puppet - Automating Configuration Management. -Puppet Labs can be contacted at: info@puppetlabs.com + Copyright (C) 2011 Puppet Labs Inc -This program and entire repository is free software; you can -redistribute it and/or modify it under the terms of the GNU -General Public License Version 2 as published by the Free Software -Foundation. + Puppet Labs can be contacted at: info@puppetlabs.com -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. + 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 -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + 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/README b/README deleted file mode 100644 index d6b7d66bc..000000000 --- a/README +++ /dev/null @@ -1,31 +0,0 @@ -Documentation (and detailed install instructions) can be found -online at http://docs.puppetlabs.com/. - -Additional documentation can also be found at the Puppet Wiki: - -http://projects.puppetlabs.com/projects/puppet/wiki/ - -Generally, you need the following things installed: - -* Ruby >= 1.8.1 (earlier releases might work but probably not) - -* The Ruby OpenSSL library. For some reason, this often isn't included - in the main ruby distributions. You can test for it by running - 'ruby -ropenssl -e "puts :yep"'. If that errors out, you're missing the - library. - - If your distribution doesn't come with the necessary library (e.g., on Debian - and Ubuntu you need to install libopenssl-ruby), then you'll probably have to - compile Ruby yourself, since it's part of the standard library and not - available separately. You could probably just compile and install that one - library, though. - -* The Ruby XMLRPC client and server libraries. For some reason, this often - isn't included in the main ruby distributions. You can test for it by - running 'ruby -rxmlrpc/client -e "puts :yep"'. If that errors out, you're missing - the library. - -* Facter => 1.5.1 - You can get this from < http://puppetlabs.com/projects/facter > - -$Id$ @@ -5,10 +5,8 @@ Puppet, an automated administrative engine for your Linux and Unix systems, perf administrative tasks (such as adding users, installing packages, and updating server configurations) based on a centralized specification. -Documentation (and detailed install instructions) can be found online at the -`Puppet Documentation`_ site. - -Additional documentation can also be found at the `Puppet Wiki`_. +Documentation (and detailed installation instructions) can be found online at the +[Puppet Docs site](http://docs.puppetlabs.com). Installation ------------ @@ -28,14 +26,15 @@ Generally, you need the following things installed: available separately. You could probably just compile and install that one library, though. -* The Ruby XMLRPC client and server libraries. For some reason, this often - isn't included in the main ruby distributions. You can test for it by - running 'ruby -rxmlrpc/client -e "puts :yep"'. If that errors out, you're missing - the library. +* Facter => 1.5.1 (available via your package manager or from the [Facter site](http://puppetlabs.com/projects/facter). + +License +------- + +See LICENSE file. + +Support +------- -* Facter => 1.5.1 - You can get this from your package management system or the `Facter site`_ +Please log tickets and issues at our [Projects site](http://projects.puppetlabs.com) -.. _Puppet Documentation: http://docs.puppetlabs.com -.. _Puppet Wiki: http://projects.puppetlabs.com/projects/puppet/wiki/ -.. _Facter site: http://puppetlabs.com/projects/facter diff --git a/README.queueing b/README.queueing deleted file mode 100644 index 83a8e19c0..000000000 --- a/README.queueing +++ /dev/null @@ -1,126 +0,0 @@ -*PUPPET QUEUEING - -Puppet Queueing is a feature which is designed to take some load -off of the PuppetMaster by transferring the task of updating the -database to a separate program which is named puppetqd (Puppet -Queue Daemon). - -Currently this is only supported for "Storeconfigs" which is -documented at: - -http://projects.puppetlabs.com/projects/1/wiki/Using_Stored_Configuration - -In the future this feature can be extended to any new puppet -data which involves storage in a database. - -*OPERATION - -In a nutshell: - - puppetmasterd -> stomp -> service -> stomp -> puppetqd -> database - -At the moment the only messaging protocol supported is "stomp". Although -others could be implemented, stomp is considered by many as the -default queueing mechanism for Ruby and Rails applications. It is -distributed as a Ruby gem and is easily installed. - -(The queueing code inside Puppet has been written so that when other -interfaces and protocols are implemented they will be easy to use by -changing settings in puppet.conf). - -The "service" in the diagram above is any queueing service that supports -the Stomp API. For details refer to: - - http://xircles.codehaus.org/projects/stomp - -Both puppetmasterd and puppetqd subscribe to the same queueing service -using the stomp interface. As puppetmasterd posts data to the queue, -puppetqd receives it and stores it. The details of how to connect to -the service and the name of the queue to use are set in puppet.conf: - - [main] - queue_type = stomp - queue_source = stomp://localhost:61613 - [puppetmasterd] - async_storeconfigs = true - -Note: since puppetmasterd needs to recover the data being stored at a -later time, both puppetmasterd and puppetqd need to work with the same -database as defined in the STORECONFIGS setup. - -*QUEUEING SERVICES - -As mentioned previously any queueing service that supports the Stomp -protocol can be used. Which one you use depends on your needs. We have -tested with two of the most popular services - StompServer and ActiveMQ. - -+ StompServer - - http://rubyforge.org/projects/stompserver/ - -StompServer is a lightweight queueing service written in Ruby which is -suitable for testing or low volume puppet usage. Works well when both -puppetmasterd and puppetd are running on the same machine that it's running -on but we encountered some problems when using it from multiple machines. - -Just install the stompserver gem and run 'stompserver'. - -+ Apache ActiveMQ - - http://activemq.apache.org - -Considered by many to be the most popular message service in use today, -ActiveMQ has hundreds of features for scaling, persistence and so on. - -Although installation is fairly simple, the configuration can seem quite -intimidating, but for our use a one line change to the standard configuration -is all that is required and is explained at: - - http://activemq.apache.org/stomp.html - -Other customization of the internal workings of ActiveMQ, if any, will depend -on your needs and deployment. A quick skimming of the ActiveMQ documentation -will give you enough info to decide. - -Others - -We have looked at but not tried some other queuing services which are -compatible with the Stomp API: - -+ POE Component Message Queue -+ JBoss Messaging (with 3rd party support for Stomp) - -*SCALING - -For StoreConfigs you basically need to have the catalog for a node stored -in the database before the next time the node connects and asks for a -new catalog. - -If the puppetd on your nodes is set to check every 30 minutes, -then it would seem that there is no problem. However if you have 3000 -nodes you have a LOT of catalogs to store and it is possible you will -not get a catalog saved in time. - -Running puppetmaster, your queueing service and puppetqd on the same -machine means that they are all competing for the same CPU cycles. Bumping -up the power of the server they are running on may be enough to handle -even fairly large deployments. - -However since most queueing services (even StompServer) are designed to -deliver messages from a "queue" to whoever asks for the next message you -can split things up between machines: - - puppetmaster1 --\ /-- puppetqd1 -\ - puppetmaster2 ----> ActiveMQ ---> puppetqd2 ---> database - puppetmaster3 --/ \-- puppetqd33 -/ - \- puppetqd4-/ - -This is, of course a totally contrived example, but it gets the point -across. As long as the data gets to the database, it doesn't matter -which machines or services it goes through. - -Although for StoreConfigs absolute reliability is not a requirement as -a new catalog will be sent the next time a node connects, some amount -of persistence should some process crash may be desirable. Both ActiveMQ -and MySQL (and other databases) have these kind of features built in -which can be activated as needed. diff --git a/conf/redhat/puppet.spec b/conf/redhat/puppet.spec index e51af0a6b..26b2c9ba0 100644 --- a/conf/redhat/puppet.spec +++ b/conf/redhat/puppet.spec @@ -8,7 +8,7 @@ Name: puppet Version: 2.6.0 Release: 1%{?dist} Summary: A network tool for managing many disparate systems -License: GPLv2+ +License: Apache 2.0 URL: http://puppetlabs.com Source0: http://puppetlabs.com/downloads/%{name}/%{name}-%{version}.tar.gz Source1: http://puppetlabs.com/downloads/%{name}/%{name}-%{version}.tar.gz.sign diff --git a/conf/solaris/pkginfo b/conf/solaris/pkginfo index 7f7bb9736..14a2f0a79 100644 --- a/conf/solaris/pkginfo +++ b/conf/solaris/pkginfo @@ -1,7 +1,6 @@ PKG=CSWpuppet NAME=puppet - System Automation Framework -VERSION=0.23.0 +VERSION=2.7.0 CATEGORY=application -VENDOR=http://reductivelabs.com/projects/puppet -HOTLINE=http://reductivelabs.com/cgi-bin/puppet.cgi -EMAIL=luke@madstop.com +VENDOR=http://projects.puppetlabs.com/projects/puppet +EMAIL=luke@puppetlabs.com diff --git a/conf/suse/puppet.spec b/conf/suse/puppet.spec index 777f6a4b6..2a5b9f4db 100644 --- a/conf/suse/puppet.spec +++ b/conf/suse/puppet.spec @@ -6,7 +6,7 @@ Summary: A network tool for managing many disparate systems Name: puppet Version: 2.6.1 Release: 1%{?dist} -License: GPL +License: Apache 2.0 Group: Productivity/Networking/System URL: http://puppetlabs.com/projects/puppet/ diff --git a/ext/nagios/naggen b/ext/nagios/naggen index c6ca15a55..16dbe6ce4 100755 --- a/ext/nagios/naggen +++ b/ext/nagios/naggen @@ -57,14 +57,21 @@ # # naggen --storeconfigs --confdir /foo --compare # -# = Author # -# Luke Kanies +# = License +# Copyright 2011 Luke Kanies # -# = Copyright +# 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 # -# Copyright (c) 2009 Puppet Labs, LLC -# Licensed under the GPL 2 +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. require 'puppet' require 'puppet/rails' diff --git a/ext/puppet-test b/ext/puppet-test index f2648c9ee..affb01249 100755 --- a/ext/puppet-test +++ b/ext/puppet-test @@ -84,14 +84,20 @@ # # puppet-test --retrieve /module/path/to/file # -# = Author +# = License +# Copyright 2011 Luke Kanies # -# Luke Kanies +# 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 # -# = Copyright +# http://www.apache.org/licenses/LICENSE-2.0 # -# Copyright (c) 2005, 2006 Puppet Labs, LLC -# Licensed under the GNU Public License +# 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. # Do an initial trap, so that cancels don't get a stack trace. trap(:INT) do diff --git a/ext/yaml_nodes.rb b/ext/yaml_nodes.rb index 2174da09d..3c7077c13 100755 --- a/ext/yaml_nodes.rb +++ b/ext/yaml_nodes.rb @@ -23,14 +23,20 @@ # yamldir:: # Specify where the yaml is found. Defaults to 'yaml' in the current directory. # -# = Author +# = License +# Copyright 2011 Luke Kanies # -# Luke Kanies +# 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 # -# = Copyright +# http://www.apache.org/licenses/LICENSE-2.0 # -# Copyright (c) 2009 Puppet Labs, Inc. -# Licensed under the GPL2 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. require 'yaml' require 'optparse' diff --git a/lib/puppet/application/agent.rb b/lib/puppet/application/agent.rb index 2ee40227e..fc8616817 100644 --- a/lib/puppet/application/agent.rb +++ b/lib/puppet/application/agent.rb @@ -288,8 +288,7 @@ Luke Kanies COPYRIGHT --------- -Copyright (c) 2005, 2006 Puppet Labs, LLC Licensed under the GNU Public -License +Copyright (c) 2011 Puppet Labs, LLC Licensed under the Apache 2.0 License HELP end diff --git a/lib/puppet/application/apply.rb b/lib/puppet/application/apply.rb index 2b7c9f8fb..bf7b8a988 100644 --- a/lib/puppet/application/apply.rb +++ b/lib/puppet/application/apply.rb @@ -117,8 +117,7 @@ Luke Kanies COPYRIGHT --------- -Copyright (c) 2005 Puppet Labs, LLC Licensed under the GNU Public -License +Copyright (c) 2011 Puppet Labs, LLC Licensed under the Apache 2.0 License HELP end diff --git a/lib/puppet/application/cert.rb b/lib/puppet/application/cert.rb index f02fc893c..cbd6fd610 100644 --- a/lib/puppet/application/cert.rb +++ b/lib/puppet/application/cert.rb @@ -163,8 +163,7 @@ Luke Kanies COPYRIGHT --------- -Copyright (c) 2005 Puppet Labs, LLC Licensed under the GNU Public -License +Copyright (c) 2011 Puppet Labs, LLC Licensed under the Apache 2.0 License HELP exit diff --git a/lib/puppet/application/describe.rb b/lib/puppet/application/describe.rb index 79643159e..8ce20b652 100644 --- a/lib/puppet/application/describe.rb +++ b/lib/puppet/application/describe.rb @@ -228,8 +228,7 @@ David Lutterkort COPYRIGHT --------- -Copyright (c) 2005 Puppet Labs, LLC Licensed under the GNU Public -License +Copyright (c) 2011 Puppet Labs, LLC Licensed under the Apache 2.0 License HELP end diff --git a/lib/puppet/application/doc.rb b/lib/puppet/application/doc.rb index 74811919e..a88f27c78 100644 --- a/lib/puppet/application/doc.rb +++ b/lib/puppet/application/doc.rb @@ -136,8 +136,7 @@ Luke Kanies COPYRIGHT --------- -Copyright (c) 2005-2007 Puppet Labs, LLC Licensed under the GNU Public -License +Copyright (c) 2011 Puppet Labs, LLC Licensed under the Apache 2.0 License HELP end diff --git a/lib/puppet/application/faces.rb b/lib/puppet/application/faces.rb index 904a0cccc..a7b227e23 100644 --- a/lib/puppet/application/faces.rb +++ b/lib/puppet/application/faces.rb @@ -10,6 +10,12 @@ class Puppet::Application::Faces < Puppet::Application Puppet::Util::Log.level = :debug end + option("--help", "-h") do |arg| + puts "Usage: puppet faces [actions|terminuses] +Lists all available interfaces, and by default includes all available terminuses and actions. +" + end + option("--verbose", "-v") do Puppet::Util::Log.level = :info end @@ -44,11 +50,10 @@ class Puppet::Application::Faces < Puppet::Application end end - attr_accessor :verb, :name, :arguments + attr_accessor :name, :arguments def main - # Call the method associated with the provided action (e.g., 'find'). - send(verb, *arguments) + list(*arguments) end def setup @@ -56,20 +61,8 @@ class Puppet::Application::Faces < Puppet::Application load_applications # Call this to load all of the apps - @verb, @arguments = command_line.args + @arguments = command_line.args @arguments ||= [] - - validate - end - - def validate - unless verb - raise "You must specify 'find', 'search', 'save', or 'destroy' as a verb; 'save' probably does not work right now" - end - - unless respond_to?(verb) - raise "Command '#{verb}' not found for 'faces'" - end end def faces diff --git a/lib/puppet/application/filebucket.rb b/lib/puppet/application/filebucket.rb index 063d97db8..6d59ae40b 100644 --- a/lib/puppet/application/filebucket.rb +++ b/lib/puppet/application/filebucket.rb @@ -108,8 +108,7 @@ Luke Kanies COPYRIGHT --------- -Copyright (c) 2005 Puppet Labs, LLC Licensed under the GNU Public -License +Copyright (c) 2011 Puppet Labs, LLC Licensed under the Apache 2.0 License HELP end diff --git a/lib/puppet/application/inspect.rb b/lib/puppet/application/inspect.rb index e448cb9e8..30865cfc1 100644 --- a/lib/puppet/application/inspect.rb +++ b/lib/puppet/application/inspect.rb @@ -68,9 +68,7 @@ Puppet Labs COPYRIGHT --------- - -Copyright (c) 2011 Puppet Labs, LLC -Licensed under the GNU General Public License version 2 +Copyright (c) 2011 Puppet Labs, LLC Licensed under the Apache 2.0 License HELP end diff --git a/lib/puppet/application/kick.rb b/lib/puppet/application/kick.rb index da93c0182..536699442 100644 --- a/lib/puppet/application/kick.rb +++ b/lib/puppet/application/kick.rb @@ -172,8 +172,7 @@ Luke Kanies COPYRIGHT --------- -Copyright (c) 2005 Puppet Labs, LLC Licensed under the GNU Public -License +Copyright (c) 2011 Puppet Labs, LLC Licensed under the Apache 2.0 License HELP end diff --git a/lib/puppet/application/master.rb b/lib/puppet/application/master.rb index 78499a92a..f93894d99 100644 --- a/lib/puppet/application/master.rb +++ b/lib/puppet/application/master.rb @@ -105,8 +105,7 @@ Luke Kanies COPYRIGHT --------- -Copyright (c) 2005 Puppet Labs, LLC Licensed under the GNU Public -License +Copyright (c) 2011 Puppet Labs, LLC Licensed under the Apache 2.0 License HELP end diff --git a/lib/puppet/application/queue.rb b/lib/puppet/application/queue.rb index de8aea32a..e56fde281 100644 --- a/lib/puppet/application/queue.rb +++ b/lib/puppet/application/queue.rb @@ -104,8 +104,7 @@ Luke Kanies COPYRIGHT --------- -Copyright (c) 2009 Puppet Labs, LLC Licensed under the GNU Public -License +Copyright (c) 2011 Puppet Labs, LLC Licensed under the Apache 2.0 License HELP end diff --git a/lib/puppet/application/resource.rb b/lib/puppet/application/resource.rb index 3995c285b..6ef87d68f 100644 --- a/lib/puppet/application/resource.rb +++ b/lib/puppet/application/resource.rb @@ -132,8 +132,7 @@ Luke Kanies COPYRIGHT --------- -Copyright (c) 2005-2007 Puppet Labs, LLC Licensed under the GNU Public -License +Copyright (c) 2011 Puppet Labs, LLC Licensed under the Apache 2.0 License HELP end diff --git a/lib/puppet/feature/ssh.rb b/lib/puppet/feature/ssh.rb new file mode 100644 index 000000000..82fe19882 --- /dev/null +++ b/lib/puppet/feature/ssh.rb @@ -0,0 +1,4 @@ +require 'puppet/util/feature' + +Puppet.features.rubygems? +Puppet.features.add(:ssh, :libs => %{net/ssh}) diff --git a/lib/puppet/indirector/couch.rb b/lib/puppet/indirector/couch.rb index fae934fd8..243d33dd4 100644 --- a/lib/puppet/indirector/couch.rb +++ b/lib/puppet/indirector/couch.rb @@ -1,6 +1,3 @@ -raise "Couch terminus not supported without couchrest gem" unless Puppet.features.couchdb? - -require 'couchrest' class Puppet::Indirector::Couch < Puppet::Indirector::Terminus # The CouchRest database instance. One database instance per Puppet runtime @@ -13,6 +10,11 @@ class Puppet::Indirector::Couch < Puppet::Indirector::Terminus attributes_of get(request) end + def initialize(*args) + raise "Couch terminus not supported without couchrest gem" unless Puppet.features.couchdb? + super + end + # Create or update the couchdb document with the request's data hash. # def save(request) diff --git a/lib/puppet/interface/face_collection.rb b/lib/puppet/interface/face_collection.rb index 9f7a499c2..84296582c 100644 --- a/lib/puppet/interface/face_collection.rb +++ b/lib/puppet/interface/face_collection.rb @@ -12,9 +12,7 @@ module Puppet::Interface::FaceCollection $LOAD_PATH.each do |dir| next unless FileTest.directory?(dir) Dir.chdir(dir) do - # REVISIT: This is wrong!!!! We don't name files like that ever, - # so we should no longer match things like this. Damnit!!! --daniel 2011-04-07 - Dir.glob("puppet/faces/v*/*.rb").collect { |f| f.sub(/\.rb/, '') }.each do |file| + Dir.glob("puppet/faces/*.rb").collect { |f| f.sub(/\.rb/, '') }.each do |file| iname = file.sub(/\.rb/, '') begin require iname diff --git a/lib/puppet/network/http_server/mongrel.rb b/lib/puppet/network/http_server/mongrel.rb index 9bd949a08..ce0401ad2 100644 --- a/lib/puppet/network/http_server/mongrel.rb +++ b/lib/puppet/network/http_server/mongrel.rb @@ -4,26 +4,6 @@ # # Copyright (c) 2006 Manuel Holtgrewe, 2007 Luke Kanies # -# 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. - # This file is based heavily on a file retrieved from # http://ttt.ggnore.net/2006/11/15/xmlrpc-with-mongrel-and-ruby-off-rails/ diff --git a/lib/puppet/provider/augeas/augeas.rb b/lib/puppet/provider/augeas/augeas.rb index 5488c6674..a16f54bd7 100644 --- a/lib/puppet/provider/augeas/augeas.rb +++ b/lib/puppet/provider/augeas/augeas.rb @@ -1,21 +1,17 @@ -#-- -# Copyright (C) 2008 Red Hat Inc. # -# This library is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public -# License as published by the Free Software Foundation; either -# version 2 of the License, or (at your option) any later version. +# Copyright 2011 Bryan Kearney <bkearney@redhat.com> # -# This library is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. +# 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 # -# You should have received a copy of the GNU General Public -# License along with this library; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# http://www.apache.org/licenses/LICENSE-2.0 # -# Author: Bryan Kearney <bkearney@redhat.com> +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. require 'augeas' if Puppet.features.augeas? require 'strscan' diff --git a/lib/puppet/provider/group/directoryservice.rb b/lib/puppet/provider/group/directoryservice.rb index 97fee883d..e11284898 100644 --- a/lib/puppet/provider/group/directoryservice.rb +++ b/lib/puppet/provider/group/directoryservice.rb @@ -1,17 +1,3 @@ -# Created by Jeff McCune on 2007-07-22 -# Copyright (c) 2007. All rights reserved. -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation (version 2 of the License) -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston MA 02110-1301 USA - require 'puppet/provider/nameservice/directoryservice' Puppet::Type.type(:group).provide :directoryservice, :parent => Puppet::Provider::NameService::DirectoryService do diff --git a/lib/puppet/provider/interface/base.rb b/lib/puppet/provider/interface/base.rb new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/lib/puppet/provider/interface/base.rb diff --git a/lib/puppet/provider/interface/cisco.rb b/lib/puppet/provider/interface/cisco.rb new file mode 100644 index 000000000..f3bd202e9 --- /dev/null +++ b/lib/puppet/provider/interface/cisco.rb @@ -0,0 +1,33 @@ +require 'puppet/util/network_device/cisco/device' +require 'puppet/provider/network_device' + +Puppet::Type.type(:interface).provide :cisco, :parent => Puppet::Provider::NetworkDevice do + + desc "Cisco switch/router provider for interface." + + mk_resource_methods + + def self.lookup(url, name) + interface = nil + network_gear = Puppet::Util::NetworkDevice::Cisco::Device.new(url) + network_gear.command do |ng| + interface = network_gear.interface(name) + end + interface + end + + def initialize(*args) + super + end + + def flush + device.command do |device| + device.new_interface(name).update(former_properties, properties) + end + super + end + + def device + @device ||= Puppet::Util::NetworkDevice::Cisco::Device.new(resource[:device_url]) + end +end diff --git a/lib/puppet/provider/mcx/mcxcontent.rb b/lib/puppet/provider/mcx/mcxcontent.rb index 3ad437b53..0c0061278 100644 --- a/lib/puppet/provider/mcx/mcxcontent.rb +++ b/lib/puppet/provider/mcx/mcxcontent.rb @@ -1,22 +1,3 @@ -#-- -# Copyright (C) 2008 Jeffrey J McCune. - -# This program and entire repository is free software; you can -# redistribute it and/or modify it under the terms of the GNU -# General Public License as published by the Free Software -# Foundation; either version 2 of the License, or any later version. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - -# Author: Jeff McCune <mccune.jeff@gmail.com> - require 'tempfile' Puppet::Type.type(:mcx).provide :mcxcontent, :parent => Puppet::Provider do diff --git a/lib/puppet/provider/nameservice/directoryservice.rb b/lib/puppet/provider/nameservice/directoryservice.rb index 2e3480985..c1139a679 100644 --- a/lib/puppet/provider/nameservice/directoryservice.rb +++ b/lib/puppet/provider/nameservice/directoryservice.rb @@ -1,17 +1,3 @@ -# Created by Jeff McCune on 2007-07-22 -# Copyright (c) 2007. All rights reserved. -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation (version 2 of the License) -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston MA 02110-1301 USA - require 'puppet' require 'puppet/provider/nameservice' require 'facter/util/plist' diff --git a/lib/puppet/provider/network_device.rb b/lib/puppet/provider/network_device.rb new file mode 100644 index 000000000..58865fddc --- /dev/null +++ b/lib/puppet/provider/network_device.rb @@ -0,0 +1,59 @@ + +# This is the base class of all prefetched network device provider +class Puppet::Provider::NetworkDevice < Puppet::Provider + + def self.lookup(url, name) + raise "This provider doesn't implement the necessary lookup method" + end + + def self.prefetch(resources) + resources.each do |name, resource| + if result = lookup(resource[:device_url], name) + result[:ensure] = :present + resource.provider = new(result) + else + resource.provider = new(:ensure => :absent) + end + end + end + + def exists? + @property_hash[:ensure] != :absent + end + + def initialize(*args) + super + + # Make a duplicate, so that we have a copy for comparison + # at the end. + @properties = @property_hash.dup + end + + def create + @property_hash[:ensure] = :present + self.class.resource_type.validproperties.each do |property| + if val = resource.should(property) + @property_hash[property] = val + end + end + end + + def destroy + @property_hash[:ensure] = :absent + end + + def flush + @property_hash.clear + end + + def self.instances + end + + def former_properties + @properties.dup + end + + def properties + @property_hash.dup + end +end
\ No newline at end of file diff --git a/lib/puppet/provider/package/darwinport.rb b/lib/puppet/provider/package/darwinport.rb deleted file mode 100755 index c5f9ba28f..000000000 --- a/lib/puppet/provider/package/darwinport.rb +++ /dev/null @@ -1,86 +0,0 @@ -require 'puppet/provider/package' - -Puppet::Type.type(:package).provide :darwinport, :parent => Puppet::Provider::Package do - desc "Package management using DarwinPorts on OS X." - - confine :operatingsystem => :darwin - commands :port => "/opt/local/bin/port" - - def self.eachpkgashash - # list out all of the packages - open("| #{command(:port)} list installed") { |process| - regex = %r{(\S+)\s+@(\S+)\s+(\S+)} - fields = [:name, :ensure, :location] - hash = {} - - # now turn each returned line into a package object - process.each { |line| - hash.clear - - if match = regex.match(line) - fields.zip(match.captures) { |field,value| - hash[field] = value - } - - hash.delete :location - hash[:provider] = self.name - yield hash.dup - else - raise Puppet::DevError, - "Failed to match dpkg line #{line}" - end - } - } - end - - def self.instances - packages = [] - - eachpkgashash do |hash| - packages << new(hash) - end - - packages - end - - def install - should = @resource.should(:ensure) - - # Seems like you can always say 'upgrade' - output = port "upgrade", @resource[:name] - if output =~ /^Error: No port/ - raise Puppet::ExecutionFailure, "Could not find package #{@resource[:name]}" - end - end - - def query - version = nil - self.class.eachpkgashash do |hash| - return hash if hash[:name] == @resource[:name] - end - - nil - end - - def latest - info = port :search, "^#{@resource[:name]}$" - - if $CHILD_STATUS != 0 or info =~ /^Error/ - return nil - end - - ary = info.split(/\s+/) - version = ary[2].sub(/^@/, '') - - version - end - - def uninstall - port :uninstall, @resource[:name] - end - - def update - install - end -end - diff --git a/lib/puppet/provider/package/pkgdmg.rb b/lib/puppet/provider/package/pkgdmg.rb index 39e377d66..662d05c8f 100644 --- a/lib/puppet/provider/package/pkgdmg.rb +++ b/lib/puppet/provider/package/pkgdmg.rb @@ -1,21 +1,4 @@ # -# pkgdmg.rb -# -# Install Installer.app packages wrapped up inside a DMG image file. -# -# Copyright (C) 2007 Jeff McCune Jeff McCune <jeff@northstarlabs.net> -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation (version 2 of the License) -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston MA 02110-1301 USA -# # Motivation: DMG files provide a true HFS file system # and are easier to manage and .pkg bundles. # diff --git a/lib/puppet/provider/user/directoryservice.rb b/lib/puppet/provider/user/directoryservice.rb index 4b62a6ae7..a2c561039 100644 --- a/lib/puppet/provider/user/directoryservice.rb +++ b/lib/puppet/provider/user/directoryservice.rb @@ -1,17 +1,3 @@ -# Created by Jeff McCune on 2007-07-22 -# Copyright (c) 2007. All rights reserved. -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation (version 2 of the License) -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston MA 02110-1301 USA - require 'puppet/provider/nameservice/directoryservice' Puppet::Type.type(:user).provide :directoryservice, :parent => Puppet::Provider::NameService::DirectoryService do diff --git a/lib/puppet/provider/vlan/cisco.rb b/lib/puppet/provider/vlan/cisco.rb new file mode 100644 index 000000000..46e172c73 --- /dev/null +++ b/lib/puppet/provider/vlan/cisco.rb @@ -0,0 +1,34 @@ +require 'puppet/util/network_device/cisco/device' +require 'puppet/provider/network_device' + +Puppet::Type.type(:vlan).provide :cisco, :parent => Puppet::Provider::NetworkDevice do + + desc "Cisco switch/router provider for vlans." + + mk_resource_methods + + def self.lookup(url, id) + vlans = {} + device = Puppet::Util::NetworkDevice::Cisco::Device.new(url) + device.command do |d| + vlans = d.parse_vlans || {} + end + vlans[id] + end + + def initialize(*args) + super + end + + # Clear out the cached values. + def flush + device.command do |device| + device.update_vlan(resource[:name], former_properties, properties) + end + super + end + + def device + @device ||= Puppet::Util::NetworkDevice::Cisco::Device.new(resource[:device_url]) + end +end diff --git a/lib/puppet/rails/fact_name.rb b/lib/puppet/rails/fact_name.rb index 4273399e5..08301d9f0 100644 --- a/lib/puppet/rails/fact_name.rb +++ b/lib/puppet/rails/fact_name.rb @@ -1,3 +1,4 @@ +require 'puppet/rails' require 'puppet/rails/fact_value' class Puppet::Rails::FactName < ActiveRecord::Base diff --git a/lib/puppet/type/augeas.rb b/lib/puppet/type/augeas.rb index a8fb1f15f..f4d3c43e1 100644 --- a/lib/puppet/type/augeas.rb +++ b/lib/puppet/type/augeas.rb @@ -1,21 +1,17 @@ -#-- -# Copyright (C) 2008 Red Hat Inc. # -# This library is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public -# License as published by the Free Software Foundation; either -# version 2 of the License, or (at your option) any later version. +# Copyright 2011 Bryan Kearney <bkearney@redhat.com> # -# This library is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. +# 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 # -# You should have received a copy of the GNU General Public -# License along with this library; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# http://www.apache.org/licenses/LICENSE-2.0 # -# Author: Bryan Kearney <bkearney@redhat.com> +# 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. Puppet::Type.newtype(:augeas) do include Puppet::Util diff --git a/lib/puppet/type/interface.rb b/lib/puppet/type/interface.rb new file mode 100644 index 000000000..7560a0552 --- /dev/null +++ b/lib/puppet/type/interface.rb @@ -0,0 +1,107 @@ +# +# Manages an interface on a given router or switch +# + +require 'puppet/util/network_device/ipcalc' + +Puppet::Type.newtype(:interface) do + + @doc = "This represents a router or switch interface. It is possible to manage + interface mode (access or trunking, native vlan and encapsulation), + switchport characteristics (speed, duplex)." + + ensurable do + defaultvalues + + aliasvalue :shutdown, :absent + aliasvalue :no_shutdown, :present + + defaultto { :no_shutdown } + end + + newparam(:name) do + desc "Interface name" + end + + newparam(:device_url) do + desc "Url to connect to a router or switch." + end + + newproperty(:description) do + desc "Interface description." + + defaultto { @resource[:name] } + end + + newproperty(:speed) do + desc "Interface speed." + newvalues(:auto, /^\d+/) + end + + newproperty(:duplex) do + desc "Interface duplex." + newvalues(:auto, :full, :half) + end + + newproperty(:native_vlan) do + desc "Interface native vlan (for access mode only)." + newvalues(/^\d+/) + end + + newproperty(:encapsulation) do + desc "Interface switchport encapsulation." + newvalues(:none, :dot1q, :isl ) + end + + newproperty(:mode) do + desc "Interface switchport mode." + newvalues(:access, :trunk) + end + + newproperty(:allowed_trunk_vlans) do + desc "Allowed list of Vlans that this trunk can forward." + newvalues(:all, /./) + end + + newproperty(:etherchannel) do + desc "Channel group this interface is part of." + newvalues(/^\d+/) + end + + newproperty(:ipaddress, :array_matching => :all) do + include Puppet::Util::NetworkDevice::IPCalc + + desc "IP Address of this interface (it might not be possible to set an interface IP address + it depends on the interface type and device type). + Valid format of ip addresses are: + * IPV4, like 127.0.0.1 + * IPV4/prefixlength like 127.0.1.1/24 + * IPV6/prefixlength like FE80::21A:2FFF:FE30:ECF0/128 + * an optional suffix for IPV6 addresses from this list: eui-64, link-local + It is also possible to use an array of values. + " + + validate do |values| + values = [values] unless values.is_a?(Array) + values.each do |value| + self.fail "Invalid interface ip address" unless parse(value.gsub(/\s*(eui-64|link-local)\s*$/,'')) + end + end + + munge do |value| + option = value =~ /eui-64|link-local/i ? value.gsub(/^.*?\s*(eui-64|link-local)\s*$/,'\1') : nil + [parse(value.gsub(/\s*(eui-64|link-local)\s*$/,'')), option].flatten + end + + def value_to_s(value) + value = [value] unless value.is_a?(Array) + value.map{ |v| "#{v[1].to_s}/#{v[0]} #{v[2]}"}.join(",") + end + + def change_to_s(currentvalue, newvalue) + currentvalue = value_to_s(currentvalue) if currentvalue != :absent + newvalue = value_to_s(newvalue) + super(currentvalue, newvalue) + end + end +end diff --git a/lib/puppet/type/mcx.rb b/lib/puppet/type/mcx.rb index 07c9348dd..d0306ca46 100644 --- a/lib/puppet/type/mcx.rb +++ b/lib/puppet/type/mcx.rb @@ -1,22 +1,3 @@ -#-- -# Copyright (C) 2008 Jeffrey J McCune. - -# This program and entire repository is free software; you can -# redistribute it and/or modify it under the terms of the GNU -# General Public License as published by the Free Software -# Foundation; either version 2 of the License, or any later version. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - -# Author: Jeff McCune <mccune.jeff@gmail.com> - Puppet::Type.newtype(:mcx) do @doc = "MCX object management using DirectoryService on OS X. @@ -81,9 +62,9 @@ MCX settings refer to, the MCX resource will autorequire that user, group, or co newproperty(:content, :required_features => :manages_content) do desc "The XML Plist. The value of MCXSettings in DirectoryService. This is the standard output from the system command: - + dscl localhost -mcxexport /Local/Default/<ds_type>/ds_name - + Note that `ds_type` is capitalized and plural in the dscl command." end diff --git a/lib/puppet/type/router.rb b/lib/puppet/type/router.rb new file mode 100644 index 000000000..648389d39 --- /dev/null +++ b/lib/puppet/type/router.rb @@ -0,0 +1,14 @@ +# +# Manage a router abstraction +# + +module Puppet + newtype(:router) do + @doc = "Manages connected router." + + newparam(:url) do + desc "An URL to access the router of the form (ssh|telnet)://user:pass:enable@host/." + isnamevar + end + end +end diff --git a/lib/puppet/type/vlan.rb b/lib/puppet/type/vlan.rb new file mode 100644 index 000000000..6708ea4f5 --- /dev/null +++ b/lib/puppet/type/vlan.rb @@ -0,0 +1,24 @@ +# +# Manages a Vlan on a given router or switch +# + +Puppet::Type.newtype(:vlan) do + @doc = "This represents a router or switch vlan." + + ensurable + + newparam(:name) do + desc "Vlan id. It must be a number" + isnamevar + + newvalues(/^\d+/) + end + + newproperty(:description) do + desc "Vlan name" + end + + newparam(:device_url) do + desc "Url to connect to a router or switch." + end +end
\ No newline at end of file diff --git a/lib/puppet/util/network_device.rb b/lib/puppet/util/network_device.rb new file mode 100644 index 000000000..bca66016b --- /dev/null +++ b/lib/puppet/util/network_device.rb @@ -0,0 +1,2 @@ +module Puppet::Util::NetworkDevice +end
\ No newline at end of file diff --git a/lib/puppet/util/network_device/base.rb b/lib/puppet/util/network_device/base.rb new file mode 100644 index 000000000..ff96c8693 --- /dev/null +++ b/lib/puppet/util/network_device/base.rb @@ -0,0 +1,29 @@ +require 'puppet/util/autoload' +require 'uri' +require 'puppet/util/network_device/transport' +require 'puppet/util/network_device/transport/base' + +module Puppet::Util::NetworkDevice + class Base + + attr_accessor :url, :transport + + def initialize(url) + @url = URI.parse(url) + + @autoloader = Puppet::Util::Autoload.new( + self, + "puppet/util/network_device/transport", + :wrap => false + ) + + if @autoloader.load(@url.scheme) + @transport = Puppet::Util::NetworkDevice::Transport.const_get(@url.scheme.capitalize).new + @transport.host = @url.host + @transport.port = @url.port || case @url.scheme ; when "ssh" ; 22 ; when "telnet" ; 23 ; end + @transport.user = @url.user + @transport.password = @url.password + end + end + end +end
\ No newline at end of file diff --git a/lib/puppet/util/network_device/cisco.rb b/lib/puppet/util/network_device/cisco.rb new file mode 100644 index 000000000..c03a00104 --- /dev/null +++ b/lib/puppet/util/network_device/cisco.rb @@ -0,0 +1,4 @@ + +module Puppet::Util::NetworkDevice::Cisco + +end
\ No newline at end of file diff --git a/lib/puppet/util/network_device/cisco/device.rb b/lib/puppet/util/network_device/cisco/device.rb new file mode 100644 index 000000000..1f350991a --- /dev/null +++ b/lib/puppet/util/network_device/cisco/device.rb @@ -0,0 +1,246 @@ +require 'puppet' +require 'puppet/util' +require 'puppet/util/network_device/base' +require 'puppet/util/network_device/ipcalc' +require 'puppet/util/network_device/cisco/interface' +require 'ipaddr' + +class Puppet::Util::NetworkDevice::Cisco::Device < Puppet::Util::NetworkDevice::Base + + include Puppet::Util::NetworkDevice::IPCalc + + attr_accessor :enable_password + + def initialize(url, options = {}) + super(url) + @enable_password = options[:enable_password] || parse_enable(@url.query) + transport.default_prompt = /[#>]\s?\z/n + end + + def parse_enable(query) + return $1 if query =~ /enable=(.*)/ + end + + def command(cmd=nil) + Puppet.debug("command #{cmd}") + transport.connect + login + transport.command("terminal length 0") do |out| + enable if out =~ />\s?\z/n + end + find_capabilities + out = execute(cmd) if cmd + yield self if block_given? + transport.close + out + end + + def execute(cmd) + transport.command(cmd) + end + + def login + return if transport.handles_login? + if @url.user != '' + transport.command(@url.user, :prompt => /^Password:/) + else + transport.expect(/^Password:/) + end + transport.command(@url.password) + end + + def enable + raise "Can't issue \"enable\" to enter privileged, no enable password set" unless enable_password + transport.command("enable", :prompt => /^Password:/) + transport.command(enable_password) + end + + def support_vlan_brief? + !! @support_vlan_brief + end + + def find_capabilities + out = transport.command("sh vlan brief") + lines = out.split("\n") + lines.shift; lines.pop + + @support_vlan_brief = ! (lines.first =~ /^%/) + end + + IF={ + :FastEthernet => %w{FastEthernet FastEth Fast FE Fa F}, + :GigEthernet => %w{GigabitEthernet GigEthernet GigEth GE Gi G}, + :Ethernet => %w{Ethernet Eth E}, + :Serial => %w{Serial Se S}, + :PortChannel => %w{PortChannel Port-Channel Po}, + :POS => %w{POS P}, + :VLAN => %w{VLAN VL V}, + :Loopback => %w{Loopback Loop Lo}, + :ATM => %w{ATM AT A}, + :Dialer => %w{Dialer Dial Di D}, + :VirtualAccess => %w{Virtual-Access Virtual-A Virtual Virt} + } + + def canonalize_ifname(interface) + IF.each do |k,ifnames| + if found = ifnames.find { |ifname| interface =~ /^#{ifname}\s*\d/i } + interface =~ /^#{found}(.+)\b/i + return "#{k.to_s}#{$1}".gsub(/\s+/,'') + end + end + interface + end + + def interface(name) + ifname = canonalize_ifname(name) + interface = parse_interface(ifname) + return { :ensure => :absent } if interface.empty? + interface.merge!(parse_trunking(ifname)) + interface.merge!(parse_interface_config(ifname)) + end + + def new_interface(name) + Puppet::Util::NetworkDevice::Cisco::Interface.new(canonalize_ifname(name), transport) + end + + def parse_interface(name) + resource = {} + out = transport.command("sh interface #{name}") + lines = out.split("\n") + lines.shift; lines.pop + lines.each do |l| + if l =~ /#{name} is (.+), line protocol is / + resource[:ensure] = ($1 == 'up' ? :present : :absent); + end + if l =~ /Auto Speed \(.+\),/ or l =~ /Auto Speed ,/ or l =~ /Auto-speed/ + resource[:speed] = :auto + end + if l =~ /, (.+)Mb\/s/ + resource[:speed] = $1 + end + if l =~ /\s+Auto-duplex \((.{4})\),/ + resource[:duplex] = :auto + end + if l =~ /\s+(.+)-duplex/ + resource[:duplex] = $1 == "Auto" ? :auto : $1.downcase.to_sym + end + if l =~ /Description: (.+)/ + resource[:description] = $1 + end + end + resource + end + + def parse_interface_config(name) + resource = Hash.new { |hash, key| hash[key] = Array.new ; } + out = transport.command("sh running-config interface #{name} | begin interface") + lines = out.split("\n") + lines.shift; lines.pop + lines.each do |l| + if l =~ /ip address (#{IP}) (#{IP})\s+secondary\s*$/ + resource[:ipaddress] << [prefix_length(IPAddr.new($2)), IPAddr.new($1), 'secondary'] + end + if l =~ /ip address (#{IP}) (#{IP})\s*$/ + resource[:ipaddress] << [prefix_length(IPAddr.new($2)), IPAddr.new($1), nil] + end + if l =~ /ipv6 address (#{IP})\/(\d+) (eui-64|link-local)/ + resource[:ipaddress] << [$2.to_i, IPAddr.new($1), $3] + end + if l =~ /channel-group\s+(\d+)/ + resource[:etherchannel] = $1 + end + end + resource + end + + def parse_vlans + vlans = {} + out = transport.command(support_vlan_brief? ? "sh vlan brief" : "sh vlan-switch brief") + lines = out.split("\n") + lines.shift; lines.shift; lines.shift; lines.pop + vlan = nil + lines.each do |l| + case l + # vlan name status + when /^(\d+)\s+(\w+)\s+(\w+)\s+([a-zA-Z0-9,\/. ]+)\s*$/ + vlan = { :name => $1, :description => $2, :status => $3, :interfaces => [] } + if $4.strip.length > 0 + vlan[:interfaces] = $4.strip.split(/\s*,\s*/).map{ |ifn| canonalize_ifname(ifn) } + end + vlans[vlan[:name]] = vlan + when /^\s+([a-zA-Z0-9,\/. ]+)\s*$/ + raise "invalid sh vlan summary output" unless vlan + if $1.strip.length > 0 + vlan[:interfaces] += $1.strip.split(/\s*,\s*/).map{ |ifn| canonalize_ifname(ifn) } + end + else + end + end + vlans + end + + def update_vlan(id, is = {}, should = {}) + if should[:ensure] == :absent + Puppet.info "Removing #{id} from device vlan" + transport.command("conf t") + transport.command("no vlan #{id}") + transport.command("exit") + return + end + + # We're creating or updating an entry + transport.command("conf t") + transport.command("vlan #{id}") + [is.keys, should.keys].flatten.uniq.each do |property| + Puppet.debug("trying property: #{property}: #{should[property]}") + next if property != :description + transport.command("name #{should[property]}") + end + transport.command("exit") + transport.command("exit") + end + + def parse_trunking(interface) + trunking = {} + out = transport.command("sh interface #{interface} switchport") + lines = out.split("\n") + lines.shift; lines.pop + lines.each do |l| + case l + when /^Administrative mode:\s+(.*)$/i + case $1 + when "trunk" + trunking[:mode] = :trunk + when "static access" + trunking[:mode] = :access + else + raise "Unknown switchport mode: #{$1} for #{interface}" + end + when /^Administrative Trunking Encapsulation:\s+(.*)$/ + case $1 + when "dot1q","isl" + trunking[:encapsulation] = $1.to_sym if trunking[:mode] == :trunk + else + raise "Unknown switchport encapsulation: #{$1} for #{interface}" + end + when /^Access Mode VLAN:\s+(.*) \(\(Inactive\)\)$/ + # nothing + when /^Access Mode VLAN:\s+(.*) \(.*\)$/ + trunking[:native_vlan] = $1 if trunking[:mode] == :access + when /^Trunking VLANs Enabled:\s+(.*)$/ + next if trunking[:mode] == :access + vlans = $1 + trunking[:allowed_trunk_vlans] = case vlans + when /all/i + :all + when /none/i + :none + else + vlans + end + end + end + trunking + end + +end diff --git a/lib/puppet/util/network_device/cisco/interface.rb b/lib/puppet/util/network_device/cisco/interface.rb new file mode 100644 index 000000000..63d5492a7 --- /dev/null +++ b/lib/puppet/util/network_device/cisco/interface.rb @@ -0,0 +1,82 @@ +require 'puppet/util/network_device/cisco' +require 'puppet/util/network_device/ipcalc' + +# this manages setting properties to an interface in a cisco switch or router +class Puppet::Util::NetworkDevice::Cisco::Interface + + include Puppet::Util::NetworkDevice::IPCalc + extend Puppet::Util::NetworkDevice::IPCalc + + attr_reader :transport, :name + + def initialize(name, transport) + @name = name + @transport = transport + end + + COMMANDS = { + # property => order, ios command/block/array + :description => [1, "description %s"], + :speed => [2, "speed %s"], + :duplex => [3, "duplex %s"], + :native_vlan => [4, "switchport access vlan %s"], + :encapsulation => [5, "switchport trunk encapsulation %s"], + :mode => [6, "switchport mode %s"], + :allowed_trunk_vlans => [7, "switchport trunk allowed vlan %s"], + :etherchannel => [8, ["channel-group %s", "port group %s"]], + :ipaddress => [9, + lambda do |prefix,ip,option| + ip.ipv6? ? "ipv6 address #{ip.to_s}/#{prefix} #{option}" : + "ip address #{ip.to_s} #{netmask(Socket::AF_INET,prefix)}" + end], + :ensure => [10, lambda { |value| value == :present ? "no shutdown" : "shutdown" } ] + } + + def update(is={}, should={}) + Puppet.debug("Updating interface #{name}") + command("conf t") + command("interface #{name}") + + # apply changes in a defined orders for cisco IOS devices + [is.keys, should.keys].flatten.uniq.sort {|a,b| COMMANDS[a][0] <=> COMMANDS[b][0] }.each do |property| + # They're equal, so do nothing. + next if is[property] == should[property] + + # We're deleting it + if should[property] == :absent or should[property].nil? + execute(property, is[property], "no ") + next + end + + # We're replacing an existing value or creating a new one + execute(property, should[property]) + end + + command("exit") + command("exit") + end + + def execute(property, value, prefix='') + case COMMANDS[property][1] + when Array + COMMANDS[property][1].each do |command| + transport.command(prefix + command % value) do |out| + break unless out =~ /^%/ + end + end + when String + command(prefix + COMMANDS[property][1] % value) + when Proc + value = [value] unless value.is_a?(Array) + value.each do |value| + command(prefix + COMMANDS[property][1].call(*value)) + end + end + end + + def command(command) + transport.command(command) do |out| + Puppet.err "Error while executing #{command}, device returned #{out}" if out =~ /^%/mo + end + end +end
\ No newline at end of file diff --git a/lib/puppet/util/network_device/ipcalc.rb b/lib/puppet/util/network_device/ipcalc.rb new file mode 100644 index 000000000..2b4f360b7 --- /dev/null +++ b/lib/puppet/util/network_device/ipcalc.rb @@ -0,0 +1,68 @@ + +require 'puppet/util/network_device' +module Puppet::Util::NetworkDevice::IPCalc + + # This is a rip-off of authstore + Octet = '(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])' + IPv4 = "#{Octet}\.#{Octet}\.#{Octet}\.#{Octet}" + IPv6_full = "_:_:_:_:_:_:_:_|_:_:_:_:_:_::_?|_:_:_:_:_::((_:)?_)?|_:_:_:_::((_:){0,2}_)?|_:_:_::((_:){0,3}_)?|_:_::((_:){0,4}_)?|_::((_:){0,5}_)?|::((_:){0,6}_)?" + IPv6_partial = "_:_:_:_:_:_:|_:_:_:_::(_:)?|_:_::(_:){0,2}|_::(_:){0,3}" + IP = "#{IPv4}|#{IPv6_full}".gsub(/_/,'([0-9a-fA-F]{1,4})').gsub(/\(/,'(?:') + + def parse(value) + case value + when /^(#{IP})\/(\d+)$/ # 12.34.56.78/24, a001:b002::efff/120, c444:1000:2000::9:192.168.0.1/112 + [$2.to_i,IPAddr.new($1)] + when /^(#{IP})$/ # 10.20.30.40, + value = IPAddr.new(value) + [bits(value.family),value] + end + end + + def bits(family) + family == Socket::AF_INET6 ? 128 : 32 + end + + def fullmask(family) + (1 << bits(family)) - 1 + end + + def mask(family, length) + (1 << (bits(family) - length)) - 1 + end + + # returns ip address netmask from prefix length + def netmask(family, length) + IPAddr.new(fullmask(family) & ~mask(family, length) , family) + end + + # returns an IOS wildmask + def wildmask(family, length) + IPAddr.new(mask(family, length) , family) + end + + # returns ip address prefix length from netmask + def prefix_length(netmask) + mask_addr = netmask.to_i + return 0 if mask_addr == 0 + length=32 + if (netmask.ipv6?) + length=128 + end + + mask = mask_addr < 2**length ? length : 128 + + mask.times do + if ((mask_addr & 1) == 1) + break + end + mask_addr = mask_addr >> 1 + mask = mask - 1 + end + mask + end + + def linklocal?(ip) + end + +end
\ No newline at end of file diff --git a/lib/puppet/util/network_device/transport.rb b/lib/puppet/util/network_device/transport.rb new file mode 100644 index 000000000..e64fe9b69 --- /dev/null +++ b/lib/puppet/util/network_device/transport.rb @@ -0,0 +1,5 @@ +# stub +module Puppet::Util::NetworkDevice + module Transport + end +end
\ No newline at end of file diff --git a/lib/puppet/util/network_device/transport/base.rb b/lib/puppet/util/network_device/transport/base.rb new file mode 100644 index 000000000..1d62209cb --- /dev/null +++ b/lib/puppet/util/network_device/transport/base.rb @@ -0,0 +1,26 @@ + +require 'puppet/util/network_device' +require 'puppet/util/network_device/transport' + +class Puppet::Util::NetworkDevice::Transport::Base + attr_accessor :user, :password, :host, :port + attr_accessor :default_prompt, :timeout + + def initialize + @timeout = 10 + end + + def send(cmd) + end + + def expect(prompt) + end + + def command(cmd, options = {}) + send(cmd) + expect(options[:prompt] || default_prompt) do |output| + yield output if block_given? + end + end + +end
\ No newline at end of file diff --git a/lib/puppet/util/network_device/transport/ssh.rb b/lib/puppet/util/network_device/transport/ssh.rb new file mode 100644 index 000000000..b3cf51b8a --- /dev/null +++ b/lib/puppet/util/network_device/transport/ssh.rb @@ -0,0 +1,115 @@ + +require 'puppet/util/network_device' +require 'puppet/util/network_device/transport' +require 'puppet/util/network_device/transport/base' +require 'net/ssh' + +# This is an adaptation/simplification of gem net-ssh-telnet, which aims to have +# a sane interface to Net::SSH. Credits goes to net-ssh-telnet authors +class Puppet::Util::NetworkDevice::Transport::Ssh < Puppet::Util::NetworkDevice::Transport::Base + + attr_accessor :buf, :ssh, :channel, :verbose + + def initialize + super + end + + def handles_login? + true + end + + def eof? + !! @eof + end + + def connect(&block) + @output = [] + @channel_data = "" + + begin + Puppet.debug("connecting to #{host} as #{user}") + @ssh = Net::SSH.start(host, user, :port => port, :password => password, :timeout => timeout) + rescue TimeoutError + raise TimeoutError, "timed out while opening an ssh connection to the host" + end + + @buf = "" + @eof = false + @channel = nil + @ssh.open_channel do |channel| + channel.request_pty { |ch,success| raise "failed to open pty" unless success } + + channel.send_channel_request("shell") do |ch, success| + raise "failed to open ssh shell channel" unless success + + ch.on_data { |ch,data| @buf << data } + ch.on_extended_data { |ch,type,data| @buf << data if type == 1 } + ch.on_close { @eof = true } + + @channel = ch + expect(default_prompt, &block) + # this is a little bit unorthodox, we're trying to escape + # the ssh loop there while still having the ssh connection up + # otherwise we wouldn't be able to return ssh stdout/stderr + # for a given call of command. + return + end + + end + @ssh.loop + + end + + def close + @channel.close if @channel + @channel = nil + @ssh.close if @ssh + end + + def expect(prompt) + line = '' + sock = @ssh.transport.socket + + while not @eof + break if line =~ prompt and @buf == '' + break if sock.closed? + + IO::select([sock], [sock], nil, nil) + + process_ssh + + # at this point we have accumulated some data in @buf + # or the channel has been closed + if @buf != "" + line += @buf.gsub(/\r\n/no, "\n") + @buf = '' + yield line if block_given? + elsif @eof + # channel has been closed + break if line =~ prompt + if line == '' + line = nil + yield nil if block_given? + end + break + end + end + Puppet.debug("ssh: expected #{line}") if @verbose + line + end + + def send(line) + Puppet.debug("ssh: send #{line}") if @verbose + @channel.send_data(line + "\n") + end + + def process_ssh + while @buf == "" and not eof? + begin + @channel.connection.process(0.1) + rescue IOError + @eof = true + end + end + end +end
\ No newline at end of file diff --git a/lib/puppet/util/network_device/transport/telnet.rb b/lib/puppet/util/network_device/transport/telnet.rb new file mode 100644 index 000000000..e55079e06 --- /dev/null +++ b/lib/puppet/util/network_device/transport/telnet.rb @@ -0,0 +1,42 @@ +require 'puppet/util/network_device' +require 'puppet/util/network_device/transport' +require 'puppet/util/network_device/transport/base' +require 'net/telnet' + +class Puppet::Util::NetworkDevice::Transport::Telnet < Puppet::Util::NetworkDevice::Transport::Base + def initialize + super + end + + def handles_login? + false + end + + def connect + @telnet = Net::Telnet::new("Host" => host, "Port" => port || 23, + "Timeout" => 10, + "Prompt" => default_prompt, "Output_log" => "/tmp/out.log") + end + + def close + @telnet.close if @telnet + @telnet = nil + end + + def expect(prompt) + @telnet.waitfor(prompt) do |out| + yield out if block_given? + end + end + + def command(cmd, options = {}) + send(cmd) + expect(options[:prompt] || default_prompt) do |output| + yield output if block_given? + end + end + + def send(line) + @telnet.puts(line) + end +end
\ No newline at end of file diff --git a/spec/integration/application/apply_spec.rb b/spec/integration/application/apply_spec.rb index 876f55568..33b00a1f6 100755 --- a/spec/integration/application/apply_spec.rb +++ b/spec/integration/application/apply_spec.rb @@ -1,9 +1,7 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') - +require 'spec_helper' require 'puppet_spec/files' - require 'puppet/application/apply' describe "apply" do diff --git a/spec/integration/application/doc_spec.rb b/spec/integration/application/doc_spec.rb index f0b9d7db0..bcff8f756 100644..100755 --- a/spec/integration/application/doc_spec.rb +++ b/spec/integration/application/doc_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') +require 'spec_helper' require 'puppet_spec/files' describe Puppet::Application::Doc do diff --git a/spec/integration/configurer_spec.rb b/spec/integration/configurer_spec.rb index 05b3d6146..f826b0f5d 100755 --- a/spec/integration/configurer_spec.rb +++ b/spec/integration/configurer_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../spec_helper') +require 'spec_helper' require 'puppet/configurer' diff --git a/spec/integration/defaults_spec.rb b/spec/integration/defaults_spec.rb index ee0a43d07..c9b41d331 100755 --- a/spec/integration/defaults_spec.rb +++ b/spec/integration/defaults_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../spec_helper') +require 'spec_helper' require 'puppet/defaults' require 'puppet/rails' diff --git a/spec/integration/file_serving/content_spec.rb b/spec/integration/file_serving/content_spec.rb index 207720d56..d9d79ec4f 100755 --- a/spec/integration/file_serving/content_spec.rb +++ b/spec/integration/file_serving/content_spec.rb @@ -3,7 +3,7 @@ # Created by Luke Kanies on 2007-10-18. # Copyright (c) 2007. All rights reserved. -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') +require 'spec_helper' require 'puppet/file_serving/content' require 'shared_behaviours/file_serving' diff --git a/spec/integration/file_serving/fileset_spec.rb b/spec/integration/file_serving/fileset_spec.rb index f607aa203..858186794 100755 --- a/spec/integration/file_serving/fileset_spec.rb +++ b/spec/integration/file_serving/fileset_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') +require 'spec_helper' require 'puppet/file_serving/fileset' diff --git a/spec/integration/file_serving/metadata_spec.rb b/spec/integration/file_serving/metadata_spec.rb index 627369ff8..f5ae616e1 100755 --- a/spec/integration/file_serving/metadata_spec.rb +++ b/spec/integration/file_serving/metadata_spec.rb @@ -3,7 +3,7 @@ # Created by Luke Kanies on 2007-10-18. # Copyright (c) 2007. All rights reserved. -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') +require 'spec_helper' require 'puppet/file_serving/metadata' require 'shared_behaviours/file_serving' diff --git a/spec/integration/file_serving/terminus_helper_spec.rb b/spec/integration/file_serving/terminus_helper_spec.rb index 615b24c87..650ae4d7b 100755 --- a/spec/integration/file_serving/terminus_helper_spec.rb +++ b/spec/integration/file_serving/terminus_helper_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') +require 'spec_helper' require 'puppet/file_serving/terminus_helper' diff --git a/spec/integration/indirector/catalog/compiler_spec.rb b/spec/integration/indirector/catalog/compiler_spec.rb index dafa1af7c..054b0377a 100755 --- a/spec/integration/indirector/catalog/compiler_spec.rb +++ b/spec/integration/indirector/catalog/compiler_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') +require 'spec_helper' require 'puppet/resource/catalog' diff --git a/spec/integration/indirector/catalog/queue_spec.rb b/spec/integration/indirector/catalog/queue_spec.rb index 237e489f9..5c781c1ae 100755 --- a/spec/integration/indirector/catalog/queue_spec.rb +++ b/spec/integration/indirector/catalog/queue_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') +require 'spec_helper' require 'puppet/resource/catalog' diff --git a/spec/integration/indirector/direct_file_server_spec.rb b/spec/integration/indirector/direct_file_server_spec.rb index 627733b09..6ab3e4d83 100755 --- a/spec/integration/indirector/direct_file_server_spec.rb +++ b/spec/integration/indirector/direct_file_server_spec.rb @@ -3,7 +3,7 @@ # Created by Luke Kanies on 2007-10-19. # Copyright (c) 2007. All rights reserved. -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') +require 'spec_helper' require 'puppet/indirector/file_content/file' diff --git a/spec/integration/indirector/file_content/file_server_spec.rb b/spec/integration/indirector/file_content/file_server_spec.rb index 9268ef067..e1eb28f91 100755 --- a/spec/integration/indirector/file_content/file_server_spec.rb +++ b/spec/integration/indirector/file_content/file_server_spec.rb @@ -3,7 +3,7 @@ # Created by Luke Kanies on 2007-10-18. # Copyright (c) 2007. All rights reserved. -require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') +require 'spec_helper' require 'puppet/indirector/file_content/file_server' require 'shared_behaviours/file_server_terminus' diff --git a/spec/integration/indirector/file_metadata/file_server_spec.rb b/spec/integration/indirector/file_metadata/file_server_spec.rb index 069e7af08..7a973fcca 100755 --- a/spec/integration/indirector/file_metadata/file_server_spec.rb +++ b/spec/integration/indirector/file_metadata/file_server_spec.rb @@ -3,7 +3,7 @@ # Created by Luke Kanies on 2007-10-18. # Copyright (c) 2007. All rights reserved. -require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') +require 'spec_helper' require 'puppet/indirector/file_metadata/file_server' require 'shared_behaviours/file_server_terminus' diff --git a/spec/integration/indirector/node/ldap_spec.rb b/spec/integration/indirector/node/ldap_spec.rb index 3da6d0e73..9891702bd 100755 --- a/spec/integration/indirector/node/ldap_spec.rb +++ b/spec/integration/indirector/node/ldap_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') +require 'spec_helper' require 'puppet/indirector/node/ldap' diff --git a/spec/integration/network/client_spec.rb b/spec/integration/network/client_spec.rb index 07a491b1b..574da6a78 100755 --- a/spec/integration/network/client_spec.rb +++ b/spec/integration/network/client_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') +require 'spec_helper' require 'puppet/network/client' diff --git a/spec/integration/network/formats_spec.rb b/spec/integration/network/formats_spec.rb index 8eb963e19..44f153d33 100755 --- a/spec/integration/network/formats_spec.rb +++ b/spec/integration/network/formats_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') +require 'spec_helper' require 'puppet/network/formats' diff --git a/spec/integration/network/handler_spec.rb b/spec/integration/network/handler_spec.rb index a3095c125..5012d3ab9 100755 --- a/spec/integration/network/handler_spec.rb +++ b/spec/integration/network/handler_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') +require 'spec_helper' require 'puppet/network/client' diff --git a/spec/integration/network/server/mongrel_spec.rb b/spec/integration/network/server/mongrel_spec.rb index aeaaad6ae..2a18cb569 100755 --- a/spec/integration/network/server/mongrel_spec.rb +++ b/spec/integration/network/server/mongrel_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') +require 'spec_helper' require 'puppet/network/server' require 'socket' diff --git a/spec/integration/network/server/webrick_spec.rb b/spec/integration/network/server/webrick_spec.rb index 0e1bb4580..b39dd2378 100755 --- a/spec/integration/network/server/webrick_spec.rb +++ b/spec/integration/network/server/webrick_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') +require 'spec_helper' require 'puppet/network/server' require 'puppet/ssl/certificate_authority' require 'socket' diff --git a/spec/integration/node/environment_spec.rb b/spec/integration/node/environment_spec.rb index abf0108fa..1610e2efc 100755 --- a/spec/integration/node/environment_spec.rb +++ b/spec/integration/node/environment_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') +require 'spec_helper' require 'puppet_spec/files' diff --git a/spec/integration/node/facts_spec.rb b/spec/integration/node/facts_spec.rb index ee956a6b1..a1f35a233 100755 --- a/spec/integration/node/facts_spec.rb +++ b/spec/integration/node/facts_spec.rb @@ -3,7 +3,7 @@ # Created by Luke Kanies on 2008-4-8. # Copyright (c) 2008. All rights reserved. -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') +require 'spec_helper' describe Puppet::Node::Facts do describe "when using the indirector" do diff --git a/spec/integration/node_spec.rb b/spec/integration/node_spec.rb index 4c8a2c2b1..afcb1cda5 100755 --- a/spec/integration/node_spec.rb +++ b/spec/integration/node_spec.rb @@ -3,7 +3,7 @@ # Created by Luke Kanies on 2007-9-23. # Copyright (c) 2007. All rights reserved. -require File.expand_path(File.dirname(__FILE__) + '/../spec_helper') +require 'spec_helper' require 'puppet/node' diff --git a/spec/integration/parser/collector_spec.rb b/spec/integration/parser/collector_spec.rb index c72e605cf..148d105bf 100755 --- a/spec/integration/parser/collector_spec.rb +++ b/spec/integration/parser/collector_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') +require 'spec_helper' require 'puppet/parser/collector' diff --git a/spec/integration/parser/compiler_spec.rb b/spec/integration/parser/compiler_spec.rb index 097e8b03a..2eb91ec7d 100755 --- a/spec/integration/parser/compiler_spec.rb +++ b/spec/integration/parser/compiler_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') +require 'spec_helper' describe Puppet::Parser::Compiler do before :each do diff --git a/spec/integration/parser/functions/require_spec.rb b/spec/integration/parser/functions/require_spec.rb index 737efcce8..c9eb0ae32 100755 --- a/spec/integration/parser/functions/require_spec.rb +++ b/spec/integration/parser/functions/require_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') +require 'spec_helper' describe "The require function" do before :each do diff --git a/spec/integration/parser/functions_spec.rb b/spec/integration/parser/functions_spec.rb index 504d1fe5e..397576182 100644..100755 --- a/spec/integration/parser/functions_spec.rb +++ b/spec/integration/parser/functions_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') +require 'spec_helper' describe Puppet::Parser::Functions do before :each do @@ -18,4 +18,4 @@ describe Puppet::Parser::Functions do }.should_not raise_error threads.each { |t| t.join } end -end
\ No newline at end of file +end diff --git a/spec/integration/parser/parser_spec.rb b/spec/integration/parser/parser_spec.rb index b7dfcc3e0..1526be049 100755 --- a/spec/integration/parser/parser_spec.rb +++ b/spec/integration/parser/parser_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') +require 'spec_helper' describe Puppet::Parser::Parser do module ParseMatcher diff --git a/spec/integration/parser/ruby_manifest_spec.rb b/spec/integration/parser/ruby_manifest_spec.rb index 110898206..6955e89e5 100644..100755 --- a/spec/integration/parser/ruby_manifest_spec.rb +++ b/spec/integration/parser/ruby_manifest_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') +require 'spec_helper' require 'tempfile' require 'puppet_spec/files' diff --git a/spec/integration/provider/mailalias/aliases_spec.rb b/spec/integration/provider/mailalias/aliases_spec.rb index 19e430ba1..ac8095ac7 100755 --- a/spec/integration/provider/mailalias/aliases_spec.rb +++ b/spec/integration/provider/mailalias/aliases_spec.rb @@ -1,5 +1,5 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') +require 'spec_helper' require 'shared_behaviours/all_parsedfile_providers' provider_class = Puppet::Type.type(:mailalias).provider(:aliases) diff --git a/spec/integration/provider/mount_spec.rb b/spec/integration/provider/mount_spec.rb index 646862050..4af0dca4a 100644 --- a/spec/integration/provider/mount_spec.rb +++ b/spec/integration/provider/mount_spec.rb @@ -1,4 +1,4 @@ -require File.dirname(__FILE__) + '/../../spec_helper' +require 'spec_helper' require 'puppet/file_bucket/dipper' diff --git a/spec/integration/provider/package_spec.rb b/spec/integration/provider/package_spec.rb index cc03c57a7..00c52fc89 100755 --- a/spec/integration/provider/package_spec.rb +++ b/spec/integration/provider/package_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') +require 'spec_helper' describe "Package Provider" do Puppet::Type.type(:package).providers.each do |name| diff --git a/spec/integration/provider/service/init_spec.rb b/spec/integration/provider/service/init_spec.rb index c74ce29fe..17b74ed0a 100755 --- a/spec/integration/provider/service/init_spec.rb +++ b/spec/integration/provider/service/init_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') +require 'spec_helper' provider = Puppet::Type.type(:service).provider(:init) diff --git a/spec/integration/reference/providers_spec.rb b/spec/integration/reference/providers_spec.rb index d6e19cb59..23b22aae1 100755 --- a/spec/integration/reference/providers_spec.rb +++ b/spec/integration/reference/providers_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') +require 'spec_helper' require 'puppet/util/reference' diff --git a/spec/integration/reports_spec.rb b/spec/integration/reports_spec.rb index a721d75d8..b9a57bb17 100755 --- a/spec/integration/reports_spec.rb +++ b/spec/integration/reports_spec.rb @@ -3,7 +3,7 @@ # Created by Luke Kanies on 2007-10-12. # Copyright (c) 2007. All rights reserved. -require File.expand_path(File.dirname(__FILE__) + '/../spec_helper') +require 'spec_helper' require 'puppet/reports' diff --git a/spec/integration/resource/catalog_spec.rb b/spec/integration/resource/catalog_spec.rb index 21162655e..5f646d4ad 100755 --- a/spec/integration/resource/catalog_spec.rb +++ b/spec/integration/resource/catalog_spec.rb @@ -3,7 +3,7 @@ # Created by Luke Kanies on 2007-4-8. # Copyright (c) 2008. All rights reserved. -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') +require 'spec_helper' describe Puppet::Resource::Catalog do describe "when pson is available", :if => Puppet.features.pson? do diff --git a/spec/integration/resource/type_collection_spec.rb b/spec/integration/resource/type_collection_spec.rb index f6ba9c7af..7d9f25a39 100755 --- a/spec/integration/resource/type_collection_spec.rb +++ b/spec/integration/resource/type_collection_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') +require 'spec_helper' require 'puppet_spec/files' require 'puppet/resource/type_collection' diff --git a/spec/integration/ssl/certificate_authority_spec.rb b/spec/integration/ssl/certificate_authority_spec.rb index 17b56ea98..a29fc0275 100755 --- a/spec/integration/ssl/certificate_authority_spec.rb +++ b/spec/integration/ssl/certificate_authority_spec.rb @@ -3,7 +3,7 @@ # Created by Luke Kanies on 2008-4-17. # Copyright (c) 2008. All rights reserved. -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') +require 'spec_helper' require 'puppet/ssl/certificate_authority' require 'tempfile' diff --git a/spec/integration/ssl/certificate_request_spec.rb b/spec/integration/ssl/certificate_request_spec.rb index f1040055b..eeb1a1ad8 100755 --- a/spec/integration/ssl/certificate_request_spec.rb +++ b/spec/integration/ssl/certificate_request_spec.rb @@ -3,7 +3,7 @@ # Created by Luke Kanies on 2008-4-17. # Copyright (c) 2008. All rights reserved. -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') +require 'spec_helper' require 'puppet/ssl/certificate_request' require 'tempfile' diff --git a/spec/integration/ssl/certificate_revocation_list_spec.rb b/spec/integration/ssl/certificate_revocation_list_spec.rb index ddf7952f3..24693cb27 100755 --- a/spec/integration/ssl/certificate_revocation_list_spec.rb +++ b/spec/integration/ssl/certificate_revocation_list_spec.rb @@ -3,7 +3,7 @@ # Created by Luke Kanies on 2008-5-5. # Copyright (c) 2008. All rights reserved. -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') +require 'spec_helper' require 'puppet/ssl/certificate_revocation_list' require 'tempfile' diff --git a/spec/integration/ssl/host_spec.rb b/spec/integration/ssl/host_spec.rb index 84160b019..2ea1d1bc6 100755 --- a/spec/integration/ssl/host_spec.rb +++ b/spec/integration/ssl/host_spec.rb @@ -3,7 +3,7 @@ # Created by Luke Kanies on 2008-4-17. # Copyright (c) 2008. All rights reserved. -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') +require 'spec_helper' require 'puppet/ssl/host' require 'tempfile' diff --git a/spec/integration/transaction/report_spec.rb b/spec/integration/transaction/report_spec.rb index c38f31081..b4efbd754 100755 --- a/spec/integration/transaction/report_spec.rb +++ b/spec/integration/transaction/report_spec.rb @@ -3,7 +3,7 @@ # Created by Luke Kanies on 2008-4-8. # Copyright (c) 2008. All rights reserved. -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') +require 'spec_helper' describe Puppet::Transaction::Report do describe "when using the indirector" do diff --git a/spec/integration/transaction_spec.rb b/spec/integration/transaction_spec.rb index e608faa27..cb5d22c0d 100755 --- a/spec/integration/transaction_spec.rb +++ b/spec/integration/transaction_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../spec_helper') +require 'spec_helper' require 'puppet_spec/files' require 'puppet/transaction' diff --git a/spec/integration/type/file_spec.rb b/spec/integration/type/file_spec.rb index 513b96e41..44d90a50b 100755 --- a/spec/integration/type/file_spec.rb +++ b/spec/integration/type/file_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') +require 'spec_helper' require 'puppet_spec/files' diff --git a/spec/integration/type/package_spec.rb b/spec/integration/type/package_spec.rb index 8e852f261..191abd259 100755 --- a/spec/integration/type/package_spec.rb +++ b/spec/integration/type/package_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') +require 'spec_helper' describe Puppet::Type.type(:package), "when choosing a default package provider" do before do diff --git a/spec/integration/type/tidy_spec.rb b/spec/integration/type/tidy_spec.rb index 084ebac6d..f1b74c039 100755 --- a/spec/integration/type/tidy_spec.rb +++ b/spec/integration/type/tidy_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') +require 'spec_helper' require 'puppet_spec/files' require 'puppet/file_bucket/dipper' diff --git a/spec/integration/type_spec.rb b/spec/integration/type_spec.rb index 62f8fb7d2..0a141924b 100755 --- a/spec/integration/type_spec.rb +++ b/spec/integration/type_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../spec_helper') +require 'spec_helper' require 'puppet/type' diff --git a/spec/integration/util/autoload_spec.rb b/spec/integration/util/autoload_spec.rb index f9b913502..8ae8339fe 100755 --- a/spec/integration/util/autoload_spec.rb +++ b/spec/integration/util/autoload_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') +require 'spec_helper' require 'puppet/util/autoload' require 'fileutils' diff --git a/spec/integration/util/feature_spec.rb b/spec/integration/util/feature_spec.rb index b038cf308..6a5433efe 100755 --- a/spec/integration/util/feature_spec.rb +++ b/spec/integration/util/feature_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') +require 'spec_helper' require 'puppet/util/feature' require 'puppet_spec/files' diff --git a/spec/integration/util/file_locking_spec.rb b/spec/integration/util/file_locking_spec.rb index 1914fadf7..6582a336c 100755 --- a/spec/integration/util/file_locking_spec.rb +++ b/spec/integration/util/file_locking_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') +require 'spec_helper' require 'puppet/util/file_locking' diff --git a/spec/integration/util/rdoc/parser_spec.rb b/spec/integration/util/rdoc/parser_spec.rb index 9cb0c9e4a..b76846fae 100755 --- a/spec/integration/util/rdoc/parser_spec.rb +++ b/spec/integration/util/rdoc/parser_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') +require 'spec_helper' require 'puppet/resource/type_collection' require 'puppet/util/rdoc/parser' diff --git a/spec/integration/util/settings_spec.rb b/spec/integration/util/settings_spec.rb index d3b5ec594..f5bdb790f 100755 --- a/spec/integration/util/settings_spec.rb +++ b/spec/integration/util/settings_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') +require 'spec_helper' require 'puppet_spec/files' diff --git a/spec/lib/puppet_spec/files.rb b/spec/lib/puppet_spec/files.rb index 38c51a572..30fb4fc42 100644 --- a/spec/lib/puppet_spec/files.rb +++ b/spec/lib/puppet_spec/files.rb @@ -3,41 +3,51 @@ require 'tempfile' # A support module for testing files. module PuppetSpec::Files + # This code exists only to support tests that run as root, pretty much. + # Once they have finally been eliminated this can all go... --daniel 2011-04-08 + if Puppet.features.posix? then + def self.in_tmp(path) + path =~ /^\/tmp/ or path =~ /^\/var\/folders/ + end + elsif Puppet.features.microsoft_windows? + def self.in_tmp(path) + tempdir = File.expand_path(File.join(Dir::LOCAL_APPDATA, "Temp")) + path =~ /^#{tempdir}/ + end + else + fail "Help! Can't find in_tmp for this platform" + end + def self.cleanup - if defined?($tmpfiles) - $tmpfiles.each do |file| - file = File.expand_path(file) - if Puppet.features.posix? and file !~ /^\/tmp/ and file !~ /^\/var\/folders/ - puts "Not deleting tmpfile #{file} outside of /tmp or /var/folders" - next - elsif Puppet.features.microsoft_windows? - tempdir = File.expand_path(File.join(Dir::LOCAL_APPDATA, "Temp")) - if file !~ /^#{tempdir}/ - puts "Not deleting tmpfile #{file} outside of #{tempdir}" - next - end - end - if FileTest.exist?(file) - system("chmod -R 755 '#{file}'") - system("rm -rf '#{file}'") - end + $global_tempfiles ||= [] + while path = $global_tempfiles.pop do + fail "Not deleting tmpfile #{path} outside regular tmpdir" unless in_tmp(path) + + begin + FileUtils.rm_r path, :secure => true + rescue Errno::ENOENT + # nothing to do end - $tmpfiles.clear end end def tmpfile(name) + # Generate a temporary file, just for the name... source = Tempfile.new(name) path = source.path source.close! - $tmpfiles ||= [] - $tmpfiles << path + + # ...record it for cleanup, + $global_tempfiles ||= [] + $global_tempfiles << File.expand_path(path) + + # ...and bam. path end def tmpdir(name) - file = tmpfile(name) - FileUtils.mkdir_p(file) - file + path = tmpfile(name) + FileUtils.mkdir_p(path) + path end end diff --git a/spec/spec.opts b/spec/spec.opts index 91cd6427e..425f0edd3 100644 --- a/spec/spec.opts +++ b/spec/spec.opts @@ -1,6 +1,4 @@ --format s --colour ---loadby -mtime --backtrace diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index fc63c6d19..d28cb2504 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,11 +1,5 @@ -unless defined?(SPEC_HELPER_IS_LOADED) -SPEC_HELPER_IS_LOADED = 1 - dir = File.expand_path(File.dirname(__FILE__)) - -$LOAD_PATH.unshift("#{dir}/") -$LOAD_PATH.unshift("#{dir}/lib") # a spec-specific test lib dir -$LOAD_PATH.unshift("#{dir}/../lib") +$LOAD_PATH.unshift File.join(dir, 'lib') # Don't want puppet getting the command line arguments for rake or autotest ARGV.clear @@ -38,6 +32,8 @@ RSpec.configure do |config| config.mock_with :mocha config.before :each do + GC.disable + # these globals are set by Application $puppet_application_mode = nil $puppet_application_name = nil @@ -65,8 +61,7 @@ RSpec.configure do |config| @logs.clear Puppet::Util::Log.close_all - end -end -# close of the "don't evaluate twice" mess. + GC.enable + end end diff --git a/spec/unit/agent/locker_spec.rb b/spec/unit/agent/locker_spec.rb index e7c8929c7..c1eb9bbbb 100755 --- a/spec/unit/agent/locker_spec.rb +++ b/spec/unit/agent/locker_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') +require 'spec_helper' require 'puppet/agent' require 'puppet/agent/locker' diff --git a/spec/unit/agent_spec.rb b/spec/unit/agent_spec.rb index a3a54bf7d..78fb5fde6 100755 --- a/spec/unit/agent_spec.rb +++ b/spec/unit/agent_spec.rb @@ -3,7 +3,7 @@ # Created by Luke Kanies on 2007-11-12. # Copyright (c) 2007. All rights reserved. -require File.expand_path(File.dirname(__FILE__) + '/../spec_helper') +require 'spec_helper' require 'puppet/agent' class AgentTestClient diff --git a/spec/unit/application/agent_spec.rb b/spec/unit/application/agent_spec.rb index 804057868..ad2748b7f 100755 --- a/spec/unit/application/agent_spec.rb +++ b/spec/unit/application/agent_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') +require 'spec_helper' require 'puppet/agent' require 'puppet/application/agent' diff --git a/spec/unit/application/apply_spec.rb b/spec/unit/application/apply_spec.rb index 0c6df2cf8..b4141fc17 100755 --- a/spec/unit/application/apply_spec.rb +++ b/spec/unit/application/apply_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') +require 'spec_helper' require 'puppet/application/apply' require 'puppet/file_bucket/dipper' diff --git a/spec/unit/application/cert_spec.rb b/spec/unit/application/cert_spec.rb index 4315bb8d8..5b25ab7b8 100755 --- a/spec/unit/application/cert_spec.rb +++ b/spec/unit/application/cert_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') +require 'spec_helper' require 'puppet/application/cert' diff --git a/spec/unit/application/config_spec.rb b/spec/unit/application/config_spec.rb index 066df6a51..0c1279630 100755 --- a/spec/unit/application/config_spec.rb +++ b/spec/unit/application/config_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper.rb') +require 'spec_helper' require 'puppet/application/config' describe Puppet::Application::Config do diff --git a/spec/unit/application/configurer_spec.rb b/spec/unit/application/configurer_spec.rb index 0fcd31518..2db07565c 100755 --- a/spec/unit/application/configurer_spec.rb +++ b/spec/unit/application/configurer_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper.rb') +require 'spec_helper' require 'puppet/application/configurer' require 'puppet/indirector/catalog/rest' require 'puppet/indirector/report/rest' diff --git a/spec/unit/application/describe_spec.rb b/spec/unit/application/describe_spec.rb index 47b98a17b..f1eb77869 100755 --- a/spec/unit/application/describe_spec.rb +++ b/spec/unit/application/describe_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') +require 'spec_helper' require 'puppet/application/describe' diff --git a/spec/unit/application/doc_spec.rb b/spec/unit/application/doc_spec.rb index f432184d3..b5d1a39d4 100755 --- a/spec/unit/application/doc_spec.rb +++ b/spec/unit/application/doc_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') +require 'spec_helper' require 'puppet/application/doc' require 'puppet/util/reference' diff --git a/spec/unit/application/faces_base_spec.rb b/spec/unit/application/faces_base_spec.rb index 6d8815f44..b7a11ad56 100755 --- a/spec/unit/application/faces_base_spec.rb +++ b/spec/unit/application/faces_base_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper.rb') +require 'spec_helper' require 'puppet/application/faces_base' require 'tmpdir' @@ -59,6 +59,13 @@ describe Puppet::Application::FacesBase do describe "parsing the command line" do context "with just an action" do before :all do + # We have to stub Signal.trap to avoid a crazy mess where we take + # over signal handling and make it impossible to cancel the test + # suite run. + # + # It would be nice to fix this elsewhere, but it is actually hard to + # capture this in rspec 2.5 and all. :( --daniel 2011-04-08 + Signal.stubs(:trap) app.command_line.stubs(:args).returns %w{foo} app.preinit end diff --git a/spec/unit/application/faces_spec.rb b/spec/unit/application/faces_spec.rb index d945c40b5..c4d15a297 100755 --- a/spec/unit/application/faces_spec.rb +++ b/spec/unit/application/faces_spec.rb @@ -1,10 +1,16 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper.rb') +require 'spec_helper' require 'puppet/application/faces' describe Puppet::Application::Faces do it "should be an application" do Puppet::Application::Faces.superclass.should equal(Puppet::Application) end + + it "should always call 'list'" do + faces = Puppet::Application::Faces.new + faces.expects(:list) + faces.main + end end diff --git a/spec/unit/application/filebucket_spec.rb b/spec/unit/application/filebucket_spec.rb index 013e358d8..1ee12d89c 100644..100755 --- a/spec/unit/application/filebucket_spec.rb +++ b/spec/unit/application/filebucket_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') +require 'spec_helper' require 'puppet/application/filebucket' require 'puppet/file_bucket/dipper' diff --git a/spec/unit/application/indirection_base_spec.rb b/spec/unit/application/indirection_base_spec.rb index a73cf4fca..10ebe8e3d 100755 --- a/spec/unit/application/indirection_base_spec.rb +++ b/spec/unit/application/indirection_base_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper.rb') +require 'spec_helper' require 'puppet/application/indirection_base' require 'puppet/faces/indirector' diff --git a/spec/unit/application/inspect_spec.rb b/spec/unit/application/inspect_spec.rb index a9a793117..f1518299a 100755 --- a/spec/unit/application/inspect_spec.rb +++ b/spec/unit/application/inspect_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../spec_helper' +require 'spec_helper' require 'puppet/application/inspect' require 'puppet/resource/catalog' diff --git a/spec/unit/application/kick_spec.rb b/spec/unit/application/kick_spec.rb index ce0e0c7d0..8481ec227 100755 --- a/spec/unit/application/kick_spec.rb +++ b/spec/unit/application/kick_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') +require 'spec_helper' require 'puppet/application/kick' diff --git a/spec/unit/application/master_spec.rb b/spec/unit/application/master_spec.rb index 14478a61a..ca4c5d0bc 100644..100755 --- a/spec/unit/application/master_spec.rb +++ b/spec/unit/application/master_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') +require 'spec_helper' require 'puppet/application/master' require 'puppet/daemon' diff --git a/spec/unit/application/queue_spec.rb b/spec/unit/application/queue_spec.rb index bb485ac3c..8a2e25b25 100755 --- a/spec/unit/application/queue_spec.rb +++ b/spec/unit/application/queue_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') +require 'spec_helper' require 'puppet/application/queue' require 'puppet/indirector/catalog/queue' diff --git a/spec/unit/application/resource_spec.rb b/spec/unit/application/resource_spec.rb index 3e3f8296b..a97fdc953 100755 --- a/spec/unit/application/resource_spec.rb +++ b/spec/unit/application/resource_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') +require 'spec_helper' require 'puppet/application/resource' diff --git a/spec/unit/application_spec.rb b/spec/unit/application_spec.rb index befc4f510..d8491bb75 100755 --- a/spec/unit/application_spec.rb +++ b/spec/unit/application_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../spec_helper') +require 'spec_helper' require 'puppet/application' require 'puppet' diff --git a/spec/unit/configurer/downloader_spec.rb b/spec/unit/configurer/downloader_spec.rb index 266a96b03..8c455cb5b 100755 --- a/spec/unit/configurer/downloader_spec.rb +++ b/spec/unit/configurer/downloader_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') +require 'spec_helper' require 'puppet/configurer/downloader' diff --git a/spec/unit/configurer/fact_handler_spec.rb b/spec/unit/configurer/fact_handler_spec.rb index 71645225f..c7d061ad1 100755 --- a/spec/unit/configurer/fact_handler_spec.rb +++ b/spec/unit/configurer/fact_handler_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') +require 'spec_helper' require 'puppet/configurer' require 'puppet/configurer/fact_handler' diff --git a/spec/unit/configurer/plugin_handler_spec.rb b/spec/unit/configurer/plugin_handler_spec.rb index 04a479665..bd2ed3855 100755 --- a/spec/unit/configurer/plugin_handler_spec.rb +++ b/spec/unit/configurer/plugin_handler_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') +require 'spec_helper' require 'puppet/configurer' require 'puppet/configurer/plugin_handler' diff --git a/spec/unit/configurer_spec.rb b/spec/unit/configurer_spec.rb index d21d86ecf..c2482e6be 100755 --- a/spec/unit/configurer_spec.rb +++ b/spec/unit/configurer_spec.rb @@ -3,7 +3,7 @@ # Created by Luke Kanies on 2007-11-12. # Copyright (c) 2007. All rights reserved. -require File.expand_path(File.dirname(__FILE__) + '/../spec_helper') +require 'spec_helper' require 'puppet/configurer' describe Puppet::Configurer do diff --git a/spec/unit/daemon_spec.rb b/spec/unit/daemon_spec.rb index 4de76b728..7b01f831b 100755 --- a/spec/unit/daemon_spec.rb +++ b/spec/unit/daemon_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../spec_helper') +require 'spec_helper' require 'puppet/daemon' def without_warnings diff --git a/spec/unit/dsl/resource_api_spec.rb b/spec/unit/dsl/resource_api_spec.rb index 13aa6a437..30273affe 100755 --- a/spec/unit/dsl/resource_api_spec.rb +++ b/spec/unit/dsl/resource_api_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') +require 'spec_helper' require 'puppet/dsl/resource_api' diff --git a/spec/unit/dsl/resource_type_api_spec.rb b/spec/unit/dsl/resource_type_api_spec.rb index 795ce2868..c8f6cca52 100755 --- a/spec/unit/dsl/resource_type_api_spec.rb +++ b/spec/unit/dsl/resource_type_api_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') +require 'spec_helper' require 'puppet/dsl/resource_type_api' diff --git a/spec/unit/faces/config_spec.rb b/spec/unit/faces/config_spec.rb index 2eb04a81b..b71995e9f 100755 --- a/spec/unit/faces/config_spec.rb +++ b/spec/unit/faces/config_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper.rb') +require 'spec_helper' describe Puppet::Faces[:config, '0.0.1'] do it "should use Settings#print_config_options when asked to print" do diff --git a/spec/unit/faces/configurer_spec.rb b/spec/unit/faces/configurer_spec.rb index 5e2b11fe1..6982c00ae 100755 --- a/spec/unit/faces/configurer_spec.rb +++ b/spec/unit/faces/configurer_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper.rb') +require 'spec_helper' require 'puppet/indirector/catalog/rest' require 'tempfile' diff --git a/spec/unit/faces/facts_spec.rb b/spec/unit/faces/facts_spec.rb index 480f463e4..46496a839 100755 --- a/spec/unit/faces/facts_spec.rb +++ b/spec/unit/faces/facts_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper.rb') +require 'spec_helper' describe Puppet::Faces[:facts, '0.0.1'] do it "should define an 'upload' fact" do diff --git a/spec/unit/faces/indirector_spec.rb b/spec/unit/faces/indirector_spec.rb index 3ed64bc01..c1aed9617 100755 --- a/spec/unit/faces/indirector_spec.rb +++ b/spec/unit/faces/indirector_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper.rb') +require 'spec_helper' require 'puppet/faces/indirector' describe Puppet::Faces::Indirector do diff --git a/spec/unit/faces/node_spec.rb b/spec/unit/faces/node_spec.rb index 4639bdf63..c6ed71f59 100755 --- a/spec/unit/faces/node_spec.rb +++ b/spec/unit/faces/node_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper.rb') +require 'spec_helper' describe Puppet::Faces[:node, '0.0.1'] do it "should set its default format to :yaml" do diff --git a/spec/unit/file_bucket/dipper_spec.rb b/spec/unit/file_bucket/dipper_spec.rb index 4dabb722b..e218e8616 100755 --- a/spec/unit/file_bucket/dipper_spec.rb +++ b/spec/unit/file_bucket/dipper_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') +require 'spec_helper' require 'pathname' diff --git a/spec/unit/file_bucket/file_spec.rb b/spec/unit/file_bucket/file_spec.rb index d79345736..d7dfb8d70 100644..100755 --- a/spec/unit/file_bucket/file_spec.rb +++ b/spec/unit/file_bucket/file_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require ::File.dirname(__FILE__) + '/../../spec_helper' +require 'spec_helper' require 'puppet/file_bucket/file' require 'digest/md5' diff --git a/spec/unit/file_collection/lookup_spec.rb b/spec/unit/file_collection/lookup_spec.rb index 138949a96..2ab6b56c0 100755 --- a/spec/unit/file_collection/lookup_spec.rb +++ b/spec/unit/file_collection/lookup_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') +require 'spec_helper' require 'puppet/file_collection/lookup' class LookupTester diff --git a/spec/unit/file_collection_spec.rb b/spec/unit/file_collection_spec.rb index 09888f425..69b1ede93 100755 --- a/spec/unit/file_collection_spec.rb +++ b/spec/unit/file_collection_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../spec_helper') +require 'spec_helper' require 'puppet/file_collection' diff --git a/spec/unit/file_serving/base_spec.rb b/spec/unit/file_serving/base_spec.rb index 3449c8d0e..0323490c1 100755 --- a/spec/unit/file_serving/base_spec.rb +++ b/spec/unit/file_serving/base_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') +require 'spec_helper' require 'puppet/file_serving/base' diff --git a/spec/unit/file_serving/configuration/parser_spec.rb b/spec/unit/file_serving/configuration/parser_spec.rb index 46cdc1c45..1321eafc4 100755 --- a/spec/unit/file_serving/configuration/parser_spec.rb +++ b/spec/unit/file_serving/configuration/parser_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') +require 'spec_helper' require 'puppet/file_serving/configuration/parser' diff --git a/spec/unit/file_serving/configuration_spec.rb b/spec/unit/file_serving/configuration_spec.rb index 3c6113165..4aba165e2 100755 --- a/spec/unit/file_serving/configuration_spec.rb +++ b/spec/unit/file_serving/configuration_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') +require 'spec_helper' require 'puppet/file_serving/configuration' diff --git a/spec/unit/file_serving/content_spec.rb b/spec/unit/file_serving/content_spec.rb index 576cbde1f..806515a63 100755 --- a/spec/unit/file_serving/content_spec.rb +++ b/spec/unit/file_serving/content_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') +require 'spec_helper' require 'puppet/file_serving/content' diff --git a/spec/unit/file_serving/fileset_spec.rb b/spec/unit/file_serving/fileset_spec.rb index 3b12c953e..6a83621d2 100755 --- a/spec/unit/file_serving/fileset_spec.rb +++ b/spec/unit/file_serving/fileset_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') +require 'spec_helper' require 'puppet/file_serving/fileset' diff --git a/spec/unit/file_serving/indirection_hooks_spec.rb b/spec/unit/file_serving/indirection_hooks_spec.rb index 1c7f55da8..0ee2de5ea 100755 --- a/spec/unit/file_serving/indirection_hooks_spec.rb +++ b/spec/unit/file_serving/indirection_hooks_spec.rb @@ -3,7 +3,7 @@ # Created by Luke Kanies on 2007-10-18. # Copyright (c) 2007. All rights reserved. -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') +require 'spec_helper' require 'puppet/file_serving/indirection_hooks' diff --git a/spec/unit/file_serving/metadata_spec.rb b/spec/unit/file_serving/metadata_spec.rb index 34794cca9..24761027c 100755 --- a/spec/unit/file_serving/metadata_spec.rb +++ b/spec/unit/file_serving/metadata_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') +require 'spec_helper' require 'puppet/file_serving/metadata' diff --git a/spec/unit/file_serving/mount/file_spec.rb b/spec/unit/file_serving/mount/file_spec.rb index 792ce951c..5af680188 100755 --- a/spec/unit/file_serving/mount/file_spec.rb +++ b/spec/unit/file_serving/mount/file_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') +require 'spec_helper' require 'puppet/file_serving/mount/file' module FileServingMountTesting diff --git a/spec/unit/file_serving/mount/modules_spec.rb b/spec/unit/file_serving/mount/modules_spec.rb index 1213f4fa5..27c56e6f8 100755 --- a/spec/unit/file_serving/mount/modules_spec.rb +++ b/spec/unit/file_serving/mount/modules_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') +require 'spec_helper' require 'puppet/file_serving/mount/modules' describe Puppet::FileServing::Mount::Modules do diff --git a/spec/unit/file_serving/mount/plugins_spec.rb b/spec/unit/file_serving/mount/plugins_spec.rb index 6aa9ae927..0ba8d489e 100755 --- a/spec/unit/file_serving/mount/plugins_spec.rb +++ b/spec/unit/file_serving/mount/plugins_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') +require 'spec_helper' require 'puppet/file_serving/mount/plugins' describe Puppet::FileServing::Mount::Plugins do diff --git a/spec/unit/file_serving/mount_spec.rb b/spec/unit/file_serving/mount_spec.rb index 2bfe643f6..1586984de 100755 --- a/spec/unit/file_serving/mount_spec.rb +++ b/spec/unit/file_serving/mount_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') +require 'spec_helper' require 'puppet/file_serving/mount' describe Puppet::FileServing::Mount do diff --git a/spec/unit/file_serving/terminus_helper_spec.rb b/spec/unit/file_serving/terminus_helper_spec.rb index 36cf0daf3..cd669109f 100755 --- a/spec/unit/file_serving/terminus_helper_spec.rb +++ b/spec/unit/file_serving/terminus_helper_spec.rb @@ -3,7 +3,7 @@ # Created by Luke Kanies on 2007-10-22. # Copyright (c) 2007. All rights reserved. -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') +require 'spec_helper' require 'puppet/file_serving/terminus_helper' diff --git a/spec/unit/indirector/active_record_spec.rb b/spec/unit/indirector/active_record_spec.rb index 4fab17da2..376822c9d 100755 --- a/spec/unit/indirector/active_record_spec.rb +++ b/spec/unit/indirector/active_record_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') +require 'spec_helper' require 'puppet/rails' require 'puppet/indirector/active_record' diff --git a/spec/unit/indirector/catalog/active_record_spec.rb b/spec/unit/indirector/catalog/active_record_spec.rb index da1d77582..ddf6548fb 100755 --- a/spec/unit/indirector/catalog/active_record_spec.rb +++ b/spec/unit/indirector/catalog/active_record_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') +require 'spec_helper' describe "Puppet::Resource::Catalog::ActiveRecord", :if => Puppet.features.rails? do diff --git a/spec/unit/indirector/catalog/compiler_spec.rb b/spec/unit/indirector/catalog/compiler_spec.rb index a2ab0c6f4..f6cb8f7bb 100755 --- a/spec/unit/indirector/catalog/compiler_spec.rb +++ b/spec/unit/indirector/catalog/compiler_spec.rb @@ -3,7 +3,7 @@ # Created by Luke Kanies on 2007-9-23. # Copyright (c) 2007. All rights reserved. -require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') +require 'spec_helper' require 'puppet/indirector/catalog/compiler' require 'puppet/rails' diff --git a/spec/unit/indirector/catalog/queue_spec.rb b/spec/unit/indirector/catalog/queue_spec.rb index 866113631..5b24bee1a 100755 --- a/spec/unit/indirector/catalog/queue_spec.rb +++ b/spec/unit/indirector/catalog/queue_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') +require 'spec_helper' require 'puppet/indirector/catalog/queue' diff --git a/spec/unit/indirector/catalog/rest_spec.rb b/spec/unit/indirector/catalog/rest_spec.rb index c887504a2..498084dce 100755 --- a/spec/unit/indirector/catalog/rest_spec.rb +++ b/spec/unit/indirector/catalog/rest_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') +require 'spec_helper' require 'puppet/indirector/catalog/rest' diff --git a/spec/unit/indirector/catalog/yaml_spec.rb b/spec/unit/indirector/catalog/yaml_spec.rb index 3bf5b4640..1c6fb7df3 100755 --- a/spec/unit/indirector/catalog/yaml_spec.rb +++ b/spec/unit/indirector/catalog/yaml_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') +require 'spec_helper' require 'puppet/resource/catalog' require 'puppet/indirector/catalog/yaml' diff --git a/spec/unit/indirector/certificate/ca_spec.rb b/spec/unit/indirector/certificate/ca_spec.rb index 77384ddb8..2dc4f48e0 100755 --- a/spec/unit/indirector/certificate/ca_spec.rb +++ b/spec/unit/indirector/certificate/ca_spec.rb @@ -3,7 +3,7 @@ # Created by Luke Kanies on 2008-3-7. # Copyright (c) 2007. All rights reserved. -require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') +require 'spec_helper' require 'puppet/indirector/certificate/ca' diff --git a/spec/unit/indirector/certificate/file_spec.rb b/spec/unit/indirector/certificate/file_spec.rb index 45dd95cb5..e1960b8ec 100755 --- a/spec/unit/indirector/certificate/file_spec.rb +++ b/spec/unit/indirector/certificate/file_spec.rb @@ -3,7 +3,7 @@ # Created by Luke Kanies on 2008-3-7. # Copyright (c) 2007. All rights reserved. -require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') +require 'spec_helper' require 'puppet/indirector/certificate/file' diff --git a/spec/unit/indirector/certificate/rest_spec.rb b/spec/unit/indirector/certificate/rest_spec.rb index 8fd6bff9a..6efd50207 100755 --- a/spec/unit/indirector/certificate/rest_spec.rb +++ b/spec/unit/indirector/certificate/rest_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') +require 'spec_helper' require 'puppet/indirector/certificate/rest' diff --git a/spec/unit/indirector/certificate_request/ca_spec.rb b/spec/unit/indirector/certificate_request/ca_spec.rb index 38d8a1bb1..08055e08b 100755 --- a/spec/unit/indirector/certificate_request/ca_spec.rb +++ b/spec/unit/indirector/certificate_request/ca_spec.rb @@ -3,7 +3,7 @@ # Created by Luke Kanies on 2008-3-7. # Copyright (c) 2007. All rights reserved. -require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') +require 'spec_helper' require 'puppet/ssl/host' require 'puppet/sslcertificates' diff --git a/spec/unit/indirector/certificate_request/file_spec.rb b/spec/unit/indirector/certificate_request/file_spec.rb index 465d55d3c..c7a565491 100755 --- a/spec/unit/indirector/certificate_request/file_spec.rb +++ b/spec/unit/indirector/certificate_request/file_spec.rb @@ -3,7 +3,7 @@ # Created by Luke Kanies on 2008-3-7. # Copyright (c) 2007. All rights reserved. -require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') +require 'spec_helper' require 'puppet/indirector/certificate_request/file' diff --git a/spec/unit/indirector/certificate_request/rest_spec.rb b/spec/unit/indirector/certificate_request/rest_spec.rb index 9a8b87439..6e940b1f9 100755 --- a/spec/unit/indirector/certificate_request/rest_spec.rb +++ b/spec/unit/indirector/certificate_request/rest_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') +require 'spec_helper' require 'puppet/indirector/certificate_request/rest' diff --git a/spec/unit/indirector/certificate_revocation_list/ca_spec.rb b/spec/unit/indirector/certificate_revocation_list/ca_spec.rb index d72a3bb10..b6f814a9c 100755 --- a/spec/unit/indirector/certificate_revocation_list/ca_spec.rb +++ b/spec/unit/indirector/certificate_revocation_list/ca_spec.rb @@ -3,7 +3,7 @@ # Created by Luke Kanies on 2008-3-7. # Copyright (c) 2007. All rights reserved. -require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') +require 'spec_helper' require 'puppet/indirector/certificate_revocation_list/ca' diff --git a/spec/unit/indirector/certificate_revocation_list/file_spec.rb b/spec/unit/indirector/certificate_revocation_list/file_spec.rb index 3284bee35..cd047410c 100755 --- a/spec/unit/indirector/certificate_revocation_list/file_spec.rb +++ b/spec/unit/indirector/certificate_revocation_list/file_spec.rb @@ -3,7 +3,7 @@ # Created by Luke Kanies on 2008-3-7. # Copyright (c) 2007. All rights reserved. -require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') +require 'spec_helper' require 'puppet/indirector/certificate_revocation_list/file' diff --git a/spec/unit/indirector/certificate_revocation_list/rest_spec.rb b/spec/unit/indirector/certificate_revocation_list/rest_spec.rb index e47a0848c..c77992182 100755 --- a/spec/unit/indirector/certificate_revocation_list/rest_spec.rb +++ b/spec/unit/indirector/certificate_revocation_list/rest_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') +require 'spec_helper' require 'puppet/indirector/certificate_revocation_list/rest' diff --git a/spec/unit/indirector/certificate_status/file_spec.rb b/spec/unit/indirector/certificate_status/file_spec.rb index 6cc0bb547..72e9f5851 100644..100755 --- a/spec/unit/indirector/certificate_status/file_spec.rb +++ b/spec/unit/indirector/certificate_status/file_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper.rb') +require 'spec_helper' require 'puppet/ssl/host' require 'puppet/indirector/certificate_status' require 'tempfile' diff --git a/spec/unit/indirector/certificate_status/rest_spec.rb b/spec/unit/indirector/certificate_status/rest_spec.rb index f44eac671..5367c96c6 100644..100755 --- a/spec/unit/indirector/certificate_status/rest_spec.rb +++ b/spec/unit/indirector/certificate_status/rest_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper.rb') +require 'spec_helper' require 'puppet/ssl/host' require 'puppet/indirector/certificate_status' diff --git a/spec/unit/indirector/code_spec.rb b/spec/unit/indirector/code_spec.rb index 1c9e4d2f1..7fe7e2fb2 100755 --- a/spec/unit/indirector/code_spec.rb +++ b/spec/unit/indirector/code_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') +require 'spec_helper' require 'puppet/indirector/code' describe Puppet::Indirector::Code do diff --git a/spec/unit/indirector/direct_file_server_spec.rb b/spec/unit/indirector/direct_file_server_spec.rb index 5d9af626f..41ec85ec7 100755 --- a/spec/unit/indirector/direct_file_server_spec.rb +++ b/spec/unit/indirector/direct_file_server_spec.rb @@ -3,7 +3,7 @@ # Created by Luke Kanies on 2007-10-24. # Copyright (c) 2007. All rights reserved. -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') +require 'spec_helper' require 'puppet/indirector/direct_file_server' diff --git a/spec/unit/indirector/envelope_spec.rb b/spec/unit/indirector/envelope_spec.rb index 2715a2671..7f7540227 100755 --- a/spec/unit/indirector/envelope_spec.rb +++ b/spec/unit/indirector/envelope_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') +require 'spec_helper' require 'puppet/indirector/envelope' describe Puppet::Indirector::Envelope do diff --git a/spec/unit/indirector/exec_spec.rb b/spec/unit/indirector/exec_spec.rb index 5abb00ae9..147bb8a5c 100755 --- a/spec/unit/indirector/exec_spec.rb +++ b/spec/unit/indirector/exec_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') +require 'spec_helper' require 'puppet/indirector/exec' diff --git a/spec/unit/indirector/facts/active_record_spec.rb b/spec/unit/indirector/facts/active_record_spec.rb index 71e19e3ca..cccf1352c 100755 --- a/spec/unit/indirector/facts/active_record_spec.rb +++ b/spec/unit/indirector/facts/active_record_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') +require 'spec_helper' require 'puppet/rails' require 'puppet/node/facts' diff --git a/spec/unit/indirector/facts/couch_spec.rb b/spec/unit/indirector/facts/couch_spec.rb index 1f86b56f2..3ac085251 100644..100755 --- a/spec/unit/indirector/facts/couch_spec.rb +++ b/spec/unit/indirector/facts/couch_spec.rb @@ -1,97 +1,103 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') +require 'spec_helper' require 'puppet/node/facts' +require 'puppet/indirector/facts/couch' -describe "Puppet::Node::Facts::Couch", :if => Puppet.features.couchdb? do - require 'puppet/indirector/facts/couch' if Puppet.features.couchdb? - - before do - @mock_db = mock('couch db') - mock_document = CouchRest::Document.new(:_id => fake_request.key, :facts => fake_request.values) - mock_document.stubs(:database).returns(@mock_db) - @mock_db.stubs(:get).with(fake_request.key).returns(mock_document) - Puppet::Node::Facts::Couch.stubs(:db).returns(@mock_db) +describe "Puppet::Node::Facts::Couch" do + describe "when couchdb is not available", :unless => Puppet.features.couchdb? do + it "should fail to initialize" do + lambda { Puppet::Node::Facts::Couch.new }.should raise_error + end end - subject { Puppet::Node::Facts::Couch } - - describe "#find" do - describe "when the node document exists" do - it "should find the request by key" do - @mock_db.expects(:get).with(fake_request.key).returns({'_id' => fake_request.key, 'facts' => fake_request.instance.values}) - subject.new.find(fake_request).should == fake_request.instance - end + describe "when couchdb is available", :if => Puppet.features.couchdb? do + before do + @mock_db = mock('couch db') + mock_document = CouchRest::Document.new(:_id => fake_request.key, :facts => fake_request.values) + mock_document.stubs(:database).returns(@mock_db) + @mock_db.stubs(:get).with(fake_request.key).returns(mock_document) + Puppet::Node::Facts::Couch.stubs(:db).returns(@mock_db) end - describe "when the node document does not exist" do - before do - @mock_db.expects(:get). - with(fake_request.key). - raises(RestClient::ResourceNotFound) - end + subject { Puppet::Node::Facts::Couch } - it "should return nil" do - subject.new.find(fake_request).should be_nil + describe "#find" do + describe "when the node document exists" do + it "should find the request by key" do + @mock_db.expects(:get).with(fake_request.key).returns({'_id' => fake_request.key, 'facts' => fake_request.instance.values}) + subject.new.find(fake_request).should == fake_request.instance + end end - it "should send Puppet a debug message" do - Puppet.expects(:debug).with("No couchdb document with id: test.local") - subject.new.find(fake_request).should be_nil - end + describe "when the node document does not exist" do + before do + @mock_db.expects(:get). + with(fake_request.key). + raises(RestClient::ResourceNotFound) + end - end - end + it "should return nil" do + subject.new.find(fake_request).should be_nil + end - describe "#save" do - describe "with options" do - subject do - lambda { Puppet::Node::Facts::Couch.new.save(fake_request([1])) } - end + it "should send Puppet a debug message" do + Puppet.expects(:debug).with("No couchdb document with id: test.local") + subject.new.find(fake_request).should be_nil + end - it { should raise_error(ArgumentError, "PUT does not accept options") } + end end - it "should save the json to the CouchDB database" do - @mock_db.expects(:save_doc).at_least_once.returns({'ok' => true }) - subject.new.save(fake_request) - end + describe "#save" do + describe "with options" do + subject do + lambda { Puppet::Node::Facts::Couch.new.save(fake_request([1])) } + end - describe "when the document exists" do - before do - @doc = CouchRest::Document.new(:_id => fake_request.key, :facts => fake_request.instance.values) - @mock_db.expects(:get).with(fake_request.key).returns(@doc) + it { should raise_error(ArgumentError, "PUT does not accept options") } end - it "saves the document" do - @doc.expects(:save) + it "should save the json to the CouchDB database" do + @mock_db.expects(:save_doc).at_least_once.returns({'ok' => true }) subject.new.save(fake_request) end - end + describe "when the document exists" do + before do + @doc = CouchRest::Document.new(:_id => fake_request.key, :facts => fake_request.instance.values) + @mock_db.expects(:get).with(fake_request.key).returns(@doc) + end + + it "saves the document" do + @doc.expects(:save) + subject.new.save(fake_request) + end - describe "when the document does not exist" do - before do - @mock_db.expects(:get). - with(fake_request.key). - raises(RestClient::ResourceNotFound) end - it "saves the document" do - @mock_db.expects(:save_doc) - subject.new.save(fake_request) + describe "when the document does not exist" do + before do + @mock_db.expects(:get). + with(fake_request.key). + raises(RestClient::ResourceNotFound) + end + + it "saves the document" do + @mock_db.expects(:save_doc) + subject.new.save(fake_request) + end + end end + def fake_request(options={}) + facts = YAML.load_file(File.join(PuppetSpec::FIXTURE_DIR, 'yaml', 'test.local.yaml')) + Struct.new(:instance, :key, :options).new(facts, facts.name, options) + end + private :fake_request end - - def fake_request(options={}) - facts = YAML.load_file(File.join(PuppetSpec::FIXTURE_DIR, 'yaml', 'test.local.yaml')) - Struct.new(:instance, :key, :options).new(facts, facts.name, options) - end - private :fake_request - end diff --git a/spec/unit/indirector/facts/facter_spec.rb b/spec/unit/indirector/facts/facter_spec.rb index 3129f5ebf..76a1e29ce 100755 --- a/spec/unit/indirector/facts/facter_spec.rb +++ b/spec/unit/indirector/facts/facter_spec.rb @@ -3,7 +3,7 @@ # Created by Luke Kanies on 2007-9-23. # Copyright (c) 2007. All rights reserved. -require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') +require 'spec_helper' require 'puppet/indirector/facts/facter' diff --git a/spec/unit/indirector/facts/inventory_active_record_spec.rb b/spec/unit/indirector/facts/inventory_active_record_spec.rb index 43b9fa397..0d5573999 100644..100755 --- a/spec/unit/indirector/facts/inventory_active_record_spec.rb +++ b/spec/unit/indirector/facts/inventory_active_record_spec.rb @@ -1,7 +1,10 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../../spec_helper' -require 'sqlite3' rescue nil +require 'spec_helper' +begin + require 'sqlite3' +rescue LoadError +end require 'tempfile' require 'puppet/rails' @@ -29,6 +32,7 @@ describe "Puppet::Node::Facts::InventoryActiveRecord", :if => (Puppet.features.r after :each do Puppet::Rails.teardown + ActiveRecord::Base.remove_connection end describe "#save" do diff --git a/spec/unit/indirector/facts/rest_spec.rb b/spec/unit/indirector/facts/rest_spec.rb index 03bef4578..cf03d30bc 100755 --- a/spec/unit/indirector/facts/rest_spec.rb +++ b/spec/unit/indirector/facts/rest_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') +require 'spec_helper' require 'puppet/indirector/facts/rest' diff --git a/spec/unit/indirector/facts/yaml_spec.rb b/spec/unit/indirector/facts/yaml_spec.rb index c266df18f..45f5a1b67 100755 --- a/spec/unit/indirector/facts/yaml_spec.rb +++ b/spec/unit/indirector/facts/yaml_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') +require 'spec_helper' require 'puppet/node/facts' require 'puppet/indirector/facts/yaml' diff --git a/spec/unit/indirector/file_bucket_file/file_spec.rb b/spec/unit/indirector/file_bucket_file/file_spec.rb index 1423cb2e3..242018882 100755 --- a/spec/unit/indirector/file_bucket_file/file_spec.rb +++ b/spec/unit/indirector/file_bucket_file/file_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require ::File.dirname(__FILE__) + '/../../../spec_helper' +require 'spec_helper' require 'puppet/indirector/file_bucket_file/file' diff --git a/spec/unit/indirector/file_bucket_file/rest_spec.rb b/spec/unit/indirector/file_bucket_file/rest_spec.rb index d0f714751..61dab2935 100755 --- a/spec/unit/indirector/file_bucket_file/rest_spec.rb +++ b/spec/unit/indirector/file_bucket_file/rest_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') +require 'spec_helper' require 'puppet/indirector/file_bucket_file/rest' diff --git a/spec/unit/indirector/file_content/file_server_spec.rb b/spec/unit/indirector/file_content/file_server_spec.rb index 5bd88132c..6661e8786 100755 --- a/spec/unit/indirector/file_content/file_server_spec.rb +++ b/spec/unit/indirector/file_content/file_server_spec.rb @@ -3,7 +3,7 @@ # Created by Luke Kanies on 2007-10-18. # Copyright (c) 2007. All rights reserved. -require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') +require 'spec_helper' require 'puppet/indirector/file_content/file_server' diff --git a/spec/unit/indirector/file_content/file_spec.rb b/spec/unit/indirector/file_content/file_spec.rb index edead1c70..7ba01263f 100755 --- a/spec/unit/indirector/file_content/file_spec.rb +++ b/spec/unit/indirector/file_content/file_spec.rb @@ -3,7 +3,7 @@ # Created by Luke Kanies on 2007-10-18. # Copyright (c) 2007. All rights reserved. -require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') +require 'spec_helper' require 'puppet/indirector/file_content/file' diff --git a/spec/unit/indirector/file_content/rest_spec.rb b/spec/unit/indirector/file_content/rest_spec.rb index cf94d2ffd..dbcf7c2f8 100755 --- a/spec/unit/indirector/file_content/rest_spec.rb +++ b/spec/unit/indirector/file_content/rest_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') +require 'spec_helper' require 'puppet/indirector/file_content' diff --git a/spec/unit/indirector/file_metadata/file_server_spec.rb b/spec/unit/indirector/file_metadata/file_server_spec.rb index 99eb83d7f..507da16ef 100755 --- a/spec/unit/indirector/file_metadata/file_server_spec.rb +++ b/spec/unit/indirector/file_metadata/file_server_spec.rb @@ -3,7 +3,7 @@ # Created by Luke Kanies on 2007-10-18. # Copyright (c) 2007. All rights reserved. -require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') +require 'spec_helper' require 'puppet/indirector/file_metadata/file_server' diff --git a/spec/unit/indirector/file_metadata/file_spec.rb b/spec/unit/indirector/file_metadata/file_spec.rb index 74eff5b66..e3a766699 100755 --- a/spec/unit/indirector/file_metadata/file_spec.rb +++ b/spec/unit/indirector/file_metadata/file_spec.rb @@ -3,7 +3,7 @@ # Created by Luke Kanies on 2007-10-18. # Copyright (c) 2007. All rights reserved. -require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') +require 'spec_helper' require 'puppet/indirector/file_metadata/file' diff --git a/spec/unit/indirector/file_metadata/rest_spec.rb b/spec/unit/indirector/file_metadata/rest_spec.rb index 132d90d4f..9cdd2ee06 100755 --- a/spec/unit/indirector/file_metadata/rest_spec.rb +++ b/spec/unit/indirector/file_metadata/rest_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') +require 'spec_helper' require 'puppet/indirector/file_metadata' diff --git a/spec/unit/indirector/file_server_spec.rb b/spec/unit/indirector/file_server_spec.rb index 079eba0ae..9f677399f 100755 --- a/spec/unit/indirector/file_server_spec.rb +++ b/spec/unit/indirector/file_server_spec.rb @@ -3,7 +3,7 @@ # Created by Luke Kanies on 2007-10-19. # Copyright (c) 2007. All rights reserved. -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') +require 'spec_helper' require 'puppet/indirector/file_server' require 'puppet/file_serving/configuration' diff --git a/spec/unit/indirector/file_spec.rb b/spec/unit/indirector/file_spec.rb index 96d5b2ae7..50b1706bf 100755 --- a/spec/unit/indirector/file_spec.rb +++ b/spec/unit/indirector/file_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') +require 'spec_helper' require 'puppet/indirector/file' diff --git a/spec/unit/indirector/indirection_spec.rb b/spec/unit/indirector/indirection_spec.rb index 8795ae795..114062a20 100755 --- a/spec/unit/indirector/indirection_spec.rb +++ b/spec/unit/indirector/indirection_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') +require 'spec_helper' require 'puppet/indirector/indirection' diff --git a/spec/unit/indirector/inventory/yaml_spec.rb b/spec/unit/indirector/inventory/yaml_spec.rb index a4eb2ab7a..fddbf9d33 100644..100755 --- a/spec/unit/indirector/inventory/yaml_spec.rb +++ b/spec/unit/indirector/inventory/yaml_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') +require 'spec_helper' require 'puppet/node/inventory' require 'puppet/indirector/inventory/yaml' diff --git a/spec/unit/indirector/key/ca_spec.rb b/spec/unit/indirector/key/ca_spec.rb index 53bd380a6..033a70c3f 100755 --- a/spec/unit/indirector/key/ca_spec.rb +++ b/spec/unit/indirector/key/ca_spec.rb @@ -3,7 +3,7 @@ # Created by Luke Kanies on 2008-3-7. # Copyright (c) 2007. All rights reserved. -require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') +require 'spec_helper' require 'puppet/indirector/key/ca' diff --git a/spec/unit/indirector/key/file_spec.rb b/spec/unit/indirector/key/file_spec.rb index 715ceacda..a87c3b1d8 100755 --- a/spec/unit/indirector/key/file_spec.rb +++ b/spec/unit/indirector/key/file_spec.rb @@ -3,7 +3,7 @@ # Created by Luke Kanies on 2008-3-7. # Copyright (c) 2007. All rights reserved. -require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') +require 'spec_helper' require 'puppet/indirector/key/file' diff --git a/spec/unit/indirector/ldap_spec.rb b/spec/unit/indirector/ldap_spec.rb index ab5dab9ce..289d2fa0f 100755 --- a/spec/unit/indirector/ldap_spec.rb +++ b/spec/unit/indirector/ldap_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') +require 'spec_helper' require 'puppet/indirector/ldap' diff --git a/spec/unit/indirector/memory_spec.rb b/spec/unit/indirector/memory_spec.rb index 751adb1b6..4f0e6e9fe 100755 --- a/spec/unit/indirector/memory_spec.rb +++ b/spec/unit/indirector/memory_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') +require 'spec_helper' require 'puppet/indirector/memory' require 'shared_behaviours/memory_terminus' diff --git a/spec/unit/indirector/node/active_record_spec.rb b/spec/unit/indirector/node/active_record_spec.rb index 65b0e1fc9..ac53419ca 100755 --- a/spec/unit/indirector/node/active_record_spec.rb +++ b/spec/unit/indirector/node/active_record_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') +require 'spec_helper' require 'puppet/node' diff --git a/spec/unit/indirector/node/exec_spec.rb b/spec/unit/indirector/node/exec_spec.rb index e6d6ccb93..372b2df9b 100755 --- a/spec/unit/indirector/node/exec_spec.rb +++ b/spec/unit/indirector/node/exec_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') +require 'spec_helper' require 'puppet/indirector/node/exec' diff --git a/spec/unit/indirector/node/ldap_spec.rb b/spec/unit/indirector/node/ldap_spec.rb index 5d4086a1a..710951e9c 100755 --- a/spec/unit/indirector/node/ldap_spec.rb +++ b/spec/unit/indirector/node/ldap_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') +require 'spec_helper' require 'puppet/indirector/node/ldap' diff --git a/spec/unit/indirector/node/memory_spec.rb b/spec/unit/indirector/node/memory_spec.rb index 904ee1259..77cfa4af7 100755 --- a/spec/unit/indirector/node/memory_spec.rb +++ b/spec/unit/indirector/node/memory_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') +require 'spec_helper' require 'puppet/indirector/node/memory' diff --git a/spec/unit/indirector/node/plain_spec.rb b/spec/unit/indirector/node/plain_spec.rb index 40d5211db..9cdd8f35b 100755 --- a/spec/unit/indirector/node/plain_spec.rb +++ b/spec/unit/indirector/node/plain_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') +require 'spec_helper' require 'puppet/indirector/node/plain' diff --git a/spec/unit/indirector/node/rest_spec.rb b/spec/unit/indirector/node/rest_spec.rb index cb3012efa..8c91297d6 100755 --- a/spec/unit/indirector/node/rest_spec.rb +++ b/spec/unit/indirector/node/rest_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') +require 'spec_helper' require 'puppet/indirector/node/rest' diff --git a/spec/unit/indirector/node/yaml_spec.rb b/spec/unit/indirector/node/yaml_spec.rb index 649bde06d..ce196c221 100755 --- a/spec/unit/indirector/node/yaml_spec.rb +++ b/spec/unit/indirector/node/yaml_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') +require 'spec_helper' require 'puppet/node' require 'puppet/indirector/node/yaml' diff --git a/spec/unit/indirector/plain_spec.rb b/spec/unit/indirector/plain_spec.rb index dfaa701bd..8efdc7894 100755 --- a/spec/unit/indirector/plain_spec.rb +++ b/spec/unit/indirector/plain_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') +require 'spec_helper' require 'puppet/indirector/plain' describe Puppet::Indirector::Plain do diff --git a/spec/unit/indirector/queue_spec.rb b/spec/unit/indirector/queue_spec.rb index 6f5b44b4c..40c87e248 100755 --- a/spec/unit/indirector/queue_spec.rb +++ b/spec/unit/indirector/queue_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') +require 'spec_helper' require 'puppet/indirector/queue' class Puppet::Indirector::Queue::TestClient diff --git a/spec/unit/indirector/report/processor_spec.rb b/spec/unit/indirector/report/processor_spec.rb index adc2638fc..545294644 100755 --- a/spec/unit/indirector/report/processor_spec.rb +++ b/spec/unit/indirector/report/processor_spec.rb @@ -3,7 +3,7 @@ # Created by Luke Kanies on 2007-9-23. # Copyright (c) 2007. All rights reserved. -require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') +require 'spec_helper' require 'puppet/indirector/report/processor' diff --git a/spec/unit/indirector/report/rest_spec.rb b/spec/unit/indirector/report/rest_spec.rb index 67a98e334..1e7ac7732 100755 --- a/spec/unit/indirector/report/rest_spec.rb +++ b/spec/unit/indirector/report/rest_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') +require 'spec_helper' require 'puppet/indirector/report/rest' diff --git a/spec/unit/indirector/report/yaml_spec.rb b/spec/unit/indirector/report/yaml_spec.rb index e75fafe5e..d164bea54 100644..100755 --- a/spec/unit/indirector/report/yaml_spec.rb +++ b/spec/unit/indirector/report/yaml_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') +require 'spec_helper' require 'puppet/transaction/report' require 'puppet/indirector/report/yaml' diff --git a/spec/unit/indirector/request_spec.rb b/spec/unit/indirector/request_spec.rb index bef56b1e1..c1718bf11 100755 --- a/spec/unit/indirector/request_spec.rb +++ b/spec/unit/indirector/request_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') +require 'spec_helper' require 'puppet/indirector/request' describe Puppet::Indirector::Request do diff --git a/spec/unit/indirector/resource/ral_spec.rb b/spec/unit/indirector/resource/ral_spec.rb index 43deaa8eb..74acec536 100644..100755 --- a/spec/unit/indirector/resource/ral_spec.rb +++ b/spec/unit/indirector/resource/ral_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') +require 'spec_helper' describe "Puppet::Resource::Ral" do describe "find" do diff --git a/spec/unit/indirector/resource/rest_spec.rb b/spec/unit/indirector/resource/rest_spec.rb index 1285d338a..8857c552e 100755 --- a/spec/unit/indirector/resource/rest_spec.rb +++ b/spec/unit/indirector/resource/rest_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') +require 'spec_helper' require 'puppet/indirector/resource/rest' diff --git a/spec/unit/indirector/resource_type/parser_spec.rb b/spec/unit/indirector/resource_type/parser_spec.rb index f86b319f9..4eaf680a2 100755 --- a/spec/unit/indirector/resource_type/parser_spec.rb +++ b/spec/unit/indirector/resource_type/parser_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') +require 'spec_helper' require 'puppet/indirector/resource_type/parser' require 'puppet_spec/files' diff --git a/spec/unit/indirector/resource_type/rest_spec.rb b/spec/unit/indirector/resource_type/rest_spec.rb index dceb109b2..11071107a 100755 --- a/spec/unit/indirector/resource_type/rest_spec.rb +++ b/spec/unit/indirector/resource_type/rest_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') +require 'spec_helper' require 'puppet/indirector/resource_type/rest' diff --git a/spec/unit/indirector/rest_spec.rb b/spec/unit/indirector/rest_spec.rb index 326d85f9d..d9c3068e8 100755 --- a/spec/unit/indirector/rest_spec.rb +++ b/spec/unit/indirector/rest_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') +require 'spec_helper' require 'puppet/indirector/rest' shared_examples_for "a REST http call" do diff --git a/spec/unit/indirector/run/local_spec.rb b/spec/unit/indirector/run/local_spec.rb index cb012a0b0..1fbda7f34 100644..100755 --- a/spec/unit/indirector/run/local_spec.rb +++ b/spec/unit/indirector/run/local_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') +require 'spec_helper' require 'puppet/indirector/run/local' diff --git a/spec/unit/indirector/run/rest_spec.rb b/spec/unit/indirector/run/rest_spec.rb index cf90caa5b..3997d9c2f 100755 --- a/spec/unit/indirector/run/rest_spec.rb +++ b/spec/unit/indirector/run/rest_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') +require 'spec_helper' require 'puppet/indirector/run/rest' diff --git a/spec/unit/indirector/ssl_file_spec.rb b/spec/unit/indirector/ssl_file_spec.rb index ca97cf49e..011bdfa9c 100755 --- a/spec/unit/indirector/ssl_file_spec.rb +++ b/spec/unit/indirector/ssl_file_spec.rb @@ -3,7 +3,7 @@ # Created by Luke Kanies on 2008-3-10. # Copyright (c) 2007. All rights reserved. -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') +require 'spec_helper' require 'puppet/indirector/ssl_file' diff --git a/spec/unit/indirector/status/rest_spec.rb b/spec/unit/indirector/status/rest_spec.rb index 436c86881..24b10df07 100755 --- a/spec/unit/indirector/status/rest_spec.rb +++ b/spec/unit/indirector/status/rest_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') +require 'spec_helper' require 'puppet/indirector/status/rest' diff --git a/spec/unit/indirector/terminus_spec.rb b/spec/unit/indirector/terminus_spec.rb index bc255aa5b..2abdab4f6 100755 --- a/spec/unit/indirector/terminus_spec.rb +++ b/spec/unit/indirector/terminus_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') +require 'spec_helper' require 'puppet/defaults' require 'puppet/indirector' require 'puppet/indirector/file' diff --git a/spec/unit/indirector/yaml_spec.rb b/spec/unit/indirector/yaml_spec.rb index 188e300d6..d2d12e74f 100755 --- a/spec/unit/indirector/yaml_spec.rb +++ b/spec/unit/indirector/yaml_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') +require 'spec_helper' require 'puppet/indirector/yaml' diff --git a/spec/unit/indirector_spec.rb b/spec/unit/indirector_spec.rb index 7bab426c0..c7d42c707 100755 --- a/spec/unit/indirector_spec.rb +++ b/spec/unit/indirector_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../spec_helper') +require 'spec_helper' require 'puppet/defaults' require 'puppet/indirector' diff --git a/spec/unit/interface/action_builder_spec.rb b/spec/unit/interface/action_builder_spec.rb index ae9cc83d4..7d2710942 100755 --- a/spec/unit/interface/action_builder_spec.rb +++ b/spec/unit/interface/action_builder_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper.rb') +require 'spec_helper' require 'puppet/interface/action_builder' describe Puppet::Interface::ActionBuilder do diff --git a/spec/unit/interface/action_manager_spec.rb b/spec/unit/interface/action_manager_spec.rb index 50bea5f89..42daf763e 100755 --- a/spec/unit/interface/action_manager_spec.rb +++ b/spec/unit/interface/action_manager_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper.rb') +require 'spec_helper' # This is entirely an internal class for Interface, so we have to load it instead of our class. require 'puppet/interface' diff --git a/spec/unit/interface/action_spec.rb b/spec/unit/interface/action_spec.rb index 4801a3cc8..957198427 100755 --- a/spec/unit/interface/action_spec.rb +++ b/spec/unit/interface/action_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper.rb') +require 'spec_helper' require 'puppet/interface/action' describe Puppet::Interface::Action do diff --git a/spec/unit/interface/face_collection_spec.rb b/spec/unit/interface/face_collection_spec.rb index bf3801efd..b83bd50d3 100755 --- a/spec/unit/interface/face_collection_spec.rb +++ b/spec/unit/interface/face_collection_spec.rb @@ -1,5 +1,5 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper.rb') +require 'spec_helper' require 'tmpdir' require 'puppet/interface/face_collection' diff --git a/spec/unit/module_spec.rb b/spec/unit/module_spec.rb index f3120e16b..2daf85347 100755 --- a/spec/unit/module_spec.rb +++ b/spec/unit/module_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../spec_helper') +require 'spec_helper' require 'puppet_spec/files' describe Puppet::Module do diff --git a/spec/unit/network/authconfig_spec.rb b/spec/unit/network/authconfig_spec.rb index 9d69e99ac..99accefb2 100755 --- a/spec/unit/network/authconfig_spec.rb +++ b/spec/unit/network/authconfig_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') +require 'spec_helper' require 'puppet/network/authconfig' diff --git a/spec/unit/network/authstore_spec.rb b/spec/unit/network/authstore_spec.rb index d477ee301..535e1bdff 100644..100755 --- a/spec/unit/network/authstore_spec.rb +++ b/spec/unit/network/authstore_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') +require 'spec_helper' require 'puppet/network/authconfig' diff --git a/spec/unit/network/client_spec.rb b/spec/unit/network/client_spec.rb index 820f10f12..75825879f 100755 --- a/spec/unit/network/client_spec.rb +++ b/spec/unit/network/client_spec.rb @@ -3,7 +3,7 @@ # Created by Luke Kanies on 2008-3-24. # Copyright (c) 2008. All rights reserved. -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') +require 'spec_helper' require 'puppet/network/client' diff --git a/spec/unit/network/format_handler_spec.rb b/spec/unit/network/format_handler_spec.rb index 556fada80..25a988dbc 100755 --- a/spec/unit/network/format_handler_spec.rb +++ b/spec/unit/network/format_handler_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') +require 'spec_helper' require 'puppet/network/format_handler' diff --git a/spec/unit/network/format_spec.rb b/spec/unit/network/format_spec.rb index 658729e4c..c54fdfd31 100755 --- a/spec/unit/network/format_spec.rb +++ b/spec/unit/network/format_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') +require 'spec_helper' require 'puppet/network/format' diff --git a/spec/unit/network/formats_spec.rb b/spec/unit/network/formats_spec.rb index 30e88c578..34b83f3ed 100755 --- a/spec/unit/network/formats_spec.rb +++ b/spec/unit/network/formats_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') +require 'spec_helper' require 'puppet/network/formats' diff --git a/spec/unit/network/handler/fileserver_spec.rb b/spec/unit/network/handler/fileserver_spec.rb index 014b82e69..5d88edbf2 100644..100755 --- a/spec/unit/network/handler/fileserver_spec.rb +++ b/spec/unit/network/handler/fileserver_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') +require 'spec_helper' require 'puppet/network/handler/fileserver' diff --git a/spec/unit/network/http/api/v1_spec.rb b/spec/unit/network/http/api/v1_spec.rb index 257eec5de..3da8cbfae 100644..100755 --- a/spec/unit/network/http/api/v1_spec.rb +++ b/spec/unit/network/http/api/v1_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../../../spec_helper') +require 'spec_helper' require 'puppet/network/http/api/v1' diff --git a/spec/unit/network/http/compression_spec.rb b/spec/unit/network/http/compression_spec.rb index 85c62f358..32ffd6a72 100755 --- a/spec/unit/network/http/compression_spec.rb +++ b/spec/unit/network/http/compression_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') +require 'spec_helper' describe "http compression" do diff --git a/spec/unit/network/http/handler_spec.rb b/spec/unit/network/http/handler_spec.rb index 97d17fcf8..868efa72b 100755 --- a/spec/unit/network/http/handler_spec.rb +++ b/spec/unit/network/http/handler_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') +require 'spec_helper' require 'puppet/network/http/handler' require 'puppet/network/rest_authorization' diff --git a/spec/unit/network/http/mongrel/rest_spec.rb b/spec/unit/network/http/mongrel/rest_spec.rb index 086fec522..cd3a59994 100755 --- a/spec/unit/network/http/mongrel/rest_spec.rb +++ b/spec/unit/network/http/mongrel/rest_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../../../spec_helper') +require 'spec_helper' require 'puppet/network/http' diff --git a/spec/unit/network/http/mongrel_spec.rb b/spec/unit/network/http/mongrel_spec.rb index 5a67a3fae..a200de384 100755 --- a/spec/unit/network/http/mongrel_spec.rb +++ b/spec/unit/network/http/mongrel_spec.rb @@ -3,7 +3,7 @@ # Created by Rick Bradley on 2007-10-15. # Copyright (c) 2007. All rights reserved. -require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') +require 'spec_helper' require 'puppet/network/http' describe "Puppet::Network::HTTP::Mongrel", "after initializing", :if => Puppet.features.mongrel? do diff --git a/spec/unit/network/http/rack/rest_spec.rb b/spec/unit/network/http/rack/rest_spec.rb index dd49fa057..daa3af351 100755 --- a/spec/unit/network/http/rack/rest_spec.rb +++ b/spec/unit/network/http/rack/rest_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../../../spec_helper') +require 'spec_helper' require 'puppet/network/http/rack' if Puppet.features.rack? require 'puppet/network/http/rack/rest' diff --git a/spec/unit/network/http/rack/xmlrpc_spec.rb b/spec/unit/network/http/rack/xmlrpc_spec.rb index e8ae47bf7..4b3023a36 100755 --- a/spec/unit/network/http/rack/xmlrpc_spec.rb +++ b/spec/unit/network/http/rack/xmlrpc_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../../../spec_helper') +require 'spec_helper' require 'puppet/network/handler' require 'puppet/network/http/rack' if Puppet.features.rack? require 'puppet/network/http/rack/xmlrpc' if Puppet.features.rack? diff --git a/spec/unit/network/http/rack_spec.rb b/spec/unit/network/http/rack_spec.rb index 75d3fdb90..bf61a1355 100755 --- a/spec/unit/network/http/rack_spec.rb +++ b/spec/unit/network/http/rack_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') +require 'spec_helper' require 'puppet/network/handler' require 'puppet/network/http/rack' if Puppet.features.rack? diff --git a/spec/unit/network/http/webrick/rest_spec.rb b/spec/unit/network/http/webrick/rest_spec.rb index b1491e32e..c582ac046 100755 --- a/spec/unit/network/http/webrick/rest_spec.rb +++ b/spec/unit/network/http/webrick/rest_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../../../spec_helper') +require 'spec_helper' require 'puppet/network/http' require 'webrick' require 'puppet/network/http/webrick/rest' diff --git a/spec/unit/network/http/webrick_spec.rb b/spec/unit/network/http/webrick_spec.rb index b27a941ea..7b7f46c5d 100755 --- a/spec/unit/network/http/webrick_spec.rb +++ b/spec/unit/network/http/webrick_spec.rb @@ -3,7 +3,7 @@ # Created by Rick Bradley on 2007-10-15. # Copyright (c) 2007. All rights reserved. -require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') +require 'spec_helper' require 'puppet/network/handler' require 'puppet/network/http' require 'puppet/network/http/webrick' diff --git a/spec/unit/network/http_pool_spec.rb b/spec/unit/network/http_pool_spec.rb index 2cd96cea4..83f901f09 100755 --- a/spec/unit/network/http_pool_spec.rb +++ b/spec/unit/network/http_pool_spec.rb @@ -3,7 +3,7 @@ # Created by Luke Kanies on 2007-11-26. # Copyright (c) 2007. All rights reserved. -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') +require 'spec_helper' require 'puppet/network/http_pool' describe Puppet::Network::HttpPool do diff --git a/spec/unit/network/http_spec.rb b/spec/unit/network/http_spec.rb index 8422e2113..27b652c71 100755 --- a/spec/unit/network/http_spec.rb +++ b/spec/unit/network/http_spec.rb @@ -3,7 +3,7 @@ # Created by Rick Bradley on 2007-10-03. # Copyright (c) 2007. All rights reserved. -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') +require 'spec_helper' require 'puppet/network/http' diff --git a/spec/unit/network/rest_authconfig_spec.rb b/spec/unit/network/rest_authconfig_spec.rb index e0bcb5af0..736521b54 100755 --- a/spec/unit/network/rest_authconfig_spec.rb +++ b/spec/unit/network/rest_authconfig_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') +require 'spec_helper' require 'puppet/network/rest_authconfig' diff --git a/spec/unit/network/rights_spec.rb b/spec/unit/network/rights_spec.rb index 8ae03c56d..70e38ba24 100755 --- a/spec/unit/network/rights_spec.rb +++ b/spec/unit/network/rights_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') +require 'spec_helper' require 'puppet/network/rights' diff --git a/spec/unit/network/server_spec.rb b/spec/unit/network/server_spec.rb index 2a63cd4ec..f0f824272 100755 --- a/spec/unit/network/server_spec.rb +++ b/spec/unit/network/server_spec.rb @@ -3,7 +3,7 @@ # Created by Rick Bradley on 2007-10-03. # Copyright (c) 2007. All rights reserved. -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') +require 'spec_helper' require 'puppet/network/server' require 'puppet/network/handler' diff --git a/spec/unit/network/xmlrpc/client_spec.rb b/spec/unit/network/xmlrpc/client_spec.rb index 7498ca4cf..012907a00 100755 --- a/spec/unit/network/xmlrpc/client_spec.rb +++ b/spec/unit/network/xmlrpc/client_spec.rb @@ -1,7 +1,7 @@ #!/usr/bin/env ruby require 'puppet/network/client' -require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') +require 'spec_helper' describe Puppet::Network::XMLRPCClient do describe "when performing the rpc call" do diff --git a/spec/unit/node/environment_spec.rb b/spec/unit/node/environment_spec.rb index d34bdb000..b8e7f6890 100755 --- a/spec/unit/node/environment_spec.rb +++ b/spec/unit/node/environment_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') +require 'spec_helper' require 'puppet/node/environment' require 'puppet/util/execution' diff --git a/spec/unit/node/facts_spec.rb b/spec/unit/node/facts_spec.rb index 797009ae4..b548e4d99 100755 --- a/spec/unit/node/facts_spec.rb +++ b/spec/unit/node/facts_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') +require 'spec_helper' require 'puppet/node/facts' diff --git a/spec/unit/node_spec.rb b/spec/unit/node_spec.rb index ec1b65ee1..cd5fadada 100755 --- a/spec/unit/node_spec.rb +++ b/spec/unit/node_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../spec_helper') +require 'spec_helper' describe Puppet::Node do describe "when managing its environment" do diff --git a/spec/unit/other/selinux_spec.rb b/spec/unit/other/selinux_spec.rb index 7f908885f..a936fdf9d 100644..100755 --- a/spec/unit/other/selinux_spec.rb +++ b/spec/unit/other/selinux_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') +require 'spec_helper' require 'puppet/type/selboolean' require 'puppet/type/selmodule' diff --git a/spec/unit/other/transbucket_spec.rb b/spec/unit/other/transbucket_spec.rb index 6bc257897..8b8cdeb0f 100755 --- a/spec/unit/other/transbucket_spec.rb +++ b/spec/unit/other/transbucket_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') +require 'spec_helper' describe Puppet::TransBucket do before do diff --git a/spec/unit/other/transobject_spec.rb b/spec/unit/other/transobject_spec.rb index c2652a386..a56ecef9d 100755 --- a/spec/unit/other/transobject_spec.rb +++ b/spec/unit/other/transobject_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') +require 'spec_helper' require 'puppet/transportable' diff --git a/spec/unit/parameter/path_spec.rb b/spec/unit/parameter/path_spec.rb index 08a26de33..0826265c3 100644..100755 --- a/spec/unit/parameter/path_spec.rb +++ b/spec/unit/parameter/path_spec.rb @@ -1,5 +1,5 @@ #!/usr/bin/env ruby -require File.expand_path(File.join(File.dirname(__FILE__), '../../spec_helper')) +require 'spec_helper' require 'puppet/parameter/path' diff --git a/spec/unit/parameter/value_collection_spec.rb b/spec/unit/parameter/value_collection_spec.rb index 99e4302bc..7e85574a8 100755 --- a/spec/unit/parameter/value_collection_spec.rb +++ b/spec/unit/parameter/value_collection_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') +require 'spec_helper' require 'puppet/parameter' diff --git a/spec/unit/parameter/value_spec.rb b/spec/unit/parameter/value_spec.rb index cb44770b4..f874d7736 100755 --- a/spec/unit/parameter/value_spec.rb +++ b/spec/unit/parameter/value_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') +require 'spec_helper' require 'puppet/parameter' diff --git a/spec/unit/parameter_spec.rb b/spec/unit/parameter_spec.rb index c9ef32faf..714c391a8 100755 --- a/spec/unit/parameter_spec.rb +++ b/spec/unit/parameter_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../spec_helper') +require 'spec_helper' require 'puppet/parameter' diff --git a/spec/unit/parser/ast/arithmetic_operator_spec.rb b/spec/unit/parser/ast/arithmetic_operator_spec.rb index 381c5c629..6f57fd9b6 100755 --- a/spec/unit/parser/ast/arithmetic_operator_spec.rb +++ b/spec/unit/parser/ast/arithmetic_operator_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') +require 'spec_helper' describe Puppet::Parser::AST::ArithmeticOperator do diff --git a/spec/unit/parser/ast/astarray_spec.rb b/spec/unit/parser/ast/astarray_spec.rb index 01082b3f0..4429ab1fe 100755 --- a/spec/unit/parser/ast/astarray_spec.rb +++ b/spec/unit/parser/ast/astarray_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') +require 'spec_helper' describe Puppet::Parser::AST::ASTArray do before :each do diff --git a/spec/unit/parser/ast/asthash_spec.rb b/spec/unit/parser/ast/asthash_spec.rb index 83f604545..09033284e 100644..100755 --- a/spec/unit/parser/ast/asthash_spec.rb +++ b/spec/unit/parser/ast/asthash_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') +require 'spec_helper' describe Puppet::Parser::AST::ASTHash do before :each do diff --git a/spec/unit/parser/ast/boolean_operator_spec.rb b/spec/unit/parser/ast/boolean_operator_spec.rb index 529946694..2251d0827 100755 --- a/spec/unit/parser/ast/boolean_operator_spec.rb +++ b/spec/unit/parser/ast/boolean_operator_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') +require 'spec_helper' describe Puppet::Parser::AST::BooleanOperator do diff --git a/spec/unit/parser/ast/casestatement_spec.rb b/spec/unit/parser/ast/casestatement_spec.rb index bce3ad801..d507beb58 100755 --- a/spec/unit/parser/ast/casestatement_spec.rb +++ b/spec/unit/parser/ast/casestatement_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') +require 'spec_helper' describe Puppet::Parser::AST::CaseStatement do before :each do diff --git a/spec/unit/parser/ast/collection_spec.rb b/spec/unit/parser/ast/collection_spec.rb index 99abc998d..fd7bf75c1 100755 --- a/spec/unit/parser/ast/collection_spec.rb +++ b/spec/unit/parser/ast/collection_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') +require 'spec_helper' describe Puppet::Parser::AST::Collection do before :each do diff --git a/spec/unit/parser/ast/collexpr_spec.rb b/spec/unit/parser/ast/collexpr_spec.rb index 04ce69cd3..f5e340ce8 100755 --- a/spec/unit/parser/ast/collexpr_spec.rb +++ b/spec/unit/parser/ast/collexpr_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') +require 'spec_helper' describe Puppet::Parser::AST::CollExpr do diff --git a/spec/unit/parser/ast/comparison_operator_spec.rb b/spec/unit/parser/ast/comparison_operator_spec.rb index 03c9069cb..169d92d0a 100755 --- a/spec/unit/parser/ast/comparison_operator_spec.rb +++ b/spec/unit/parser/ast/comparison_operator_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') +require 'spec_helper' describe Puppet::Parser::AST::ComparisonOperator do before :each do diff --git a/spec/unit/parser/ast/definition_spec.rb b/spec/unit/parser/ast/definition_spec.rb index e7f55d258..f2a211ad2 100644..100755 --- a/spec/unit/parser/ast/definition_spec.rb +++ b/spec/unit/parser/ast/definition_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') +require 'spec_helper' describe Puppet::Parser::AST::Definition do it "should make its context available through an accessor" do diff --git a/spec/unit/parser/ast/function_spec.rb b/spec/unit/parser/ast/function_spec.rb index cd4b0f94e..6f9f33b8e 100644..100755 --- a/spec/unit/parser/ast/function_spec.rb +++ b/spec/unit/parser/ast/function_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') +require 'spec_helper' describe Puppet::Parser::AST::Function do before :each do diff --git a/spec/unit/parser/ast/hostclass_spec.rb b/spec/unit/parser/ast/hostclass_spec.rb index 390490788..9c320d1be 100644..100755 --- a/spec/unit/parser/ast/hostclass_spec.rb +++ b/spec/unit/parser/ast/hostclass_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') +require 'spec_helper' describe Puppet::Parser::AST::Hostclass do def ast diff --git a/spec/unit/parser/ast/ifstatement_spec.rb b/spec/unit/parser/ast/ifstatement_spec.rb index 6a2fed22c..24e07f5fe 100755 --- a/spec/unit/parser/ast/ifstatement_spec.rb +++ b/spec/unit/parser/ast/ifstatement_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') +require 'spec_helper' describe Puppet::Parser::AST::IfStatement do before :each do diff --git a/spec/unit/parser/ast/in_operator_spec.rb b/spec/unit/parser/ast/in_operator_spec.rb index 08c01582e..95349d45d 100644..100755 --- a/spec/unit/parser/ast/in_operator_spec.rb +++ b/spec/unit/parser/ast/in_operator_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') +require 'spec_helper' require 'puppet/parser/ast/in_operator' diff --git a/spec/unit/parser/ast/leaf_spec.rb b/spec/unit/parser/ast/leaf_spec.rb index 2119a27a8..3b8c14efa 100755 --- a/spec/unit/parser/ast/leaf_spec.rb +++ b/spec/unit/parser/ast/leaf_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') +require 'spec_helper' describe Puppet::Parser::AST::Leaf do before :each do diff --git a/spec/unit/parser/ast/match_operator_spec.rb b/spec/unit/parser/ast/match_operator_spec.rb index f2a68b676..188b837b3 100755 --- a/spec/unit/parser/ast/match_operator_spec.rb +++ b/spec/unit/parser/ast/match_operator_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') +require 'spec_helper' describe Puppet::Parser::AST::MatchOperator do before :each do diff --git a/spec/unit/parser/ast/minus_spec.rb b/spec/unit/parser/ast/minus_spec.rb index 339087e80..c8e5339a7 100755 --- a/spec/unit/parser/ast/minus_spec.rb +++ b/spec/unit/parser/ast/minus_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') +require 'spec_helper' describe Puppet::Parser::AST::Minus do before :each do diff --git a/spec/unit/parser/ast/node_spec.rb b/spec/unit/parser/ast/node_spec.rb index c4e20ca67..434cb95bf 100644..100755 --- a/spec/unit/parser/ast/node_spec.rb +++ b/spec/unit/parser/ast/node_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') +require 'spec_helper' describe Puppet::Parser::AST::Node do describe "when instantiated" do diff --git a/spec/unit/parser/ast/nop_spec.rb b/spec/unit/parser/ast/nop_spec.rb index 3fa2fc0ee..d2307c84a 100755 --- a/spec/unit/parser/ast/nop_spec.rb +++ b/spec/unit/parser/ast/nop_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') +require 'spec_helper' describe Puppet::Parser::AST::Nop do diff --git a/spec/unit/parser/ast/not_spec.rb b/spec/unit/parser/ast/not_spec.rb index 31a425132..60fc11c5c 100755 --- a/spec/unit/parser/ast/not_spec.rb +++ b/spec/unit/parser/ast/not_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') +require 'spec_helper' describe Puppet::Parser::AST::Not do before :each do diff --git a/spec/unit/parser/ast/relationship_spec.rb b/spec/unit/parser/ast/relationship_spec.rb index d8bc3a535..871b05c30 100644..100755 --- a/spec/unit/parser/ast/relationship_spec.rb +++ b/spec/unit/parser/ast/relationship_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') +require 'spec_helper' describe Puppet::Parser::AST::Relationship do before do diff --git a/spec/unit/parser/ast/resource_defaults_spec.rb b/spec/unit/parser/ast/resource_defaults_spec.rb index 36eb8df5f..7402be8ea 100755 --- a/spec/unit/parser/ast/resource_defaults_spec.rb +++ b/spec/unit/parser/ast/resource_defaults_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') +require 'spec_helper' describe Puppet::Parser::AST::ResourceDefaults do diff --git a/spec/unit/parser/ast/resource_override_spec.rb b/spec/unit/parser/ast/resource_override_spec.rb index 7ca3a7e8c..cb126ce62 100755 --- a/spec/unit/parser/ast/resource_override_spec.rb +++ b/spec/unit/parser/ast/resource_override_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') +require 'spec_helper' describe Puppet::Parser::AST::ResourceOverride do diff --git a/spec/unit/parser/ast/resource_reference_spec.rb b/spec/unit/parser/ast/resource_reference_spec.rb index 492c25490..b581e9305 100755 --- a/spec/unit/parser/ast/resource_reference_spec.rb +++ b/spec/unit/parser/ast/resource_reference_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') +require 'spec_helper' describe Puppet::Parser::AST::ResourceReference do diff --git a/spec/unit/parser/ast/resource_spec.rb b/spec/unit/parser/ast/resource_spec.rb index b00fee587..883b71866 100755 --- a/spec/unit/parser/ast/resource_spec.rb +++ b/spec/unit/parser/ast/resource_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') +require 'spec_helper' describe Puppet::Parser::AST::Resource do ast = Puppet::Parser::AST diff --git a/spec/unit/parser/ast/selector_spec.rb b/spec/unit/parser/ast/selector_spec.rb index 4c13aa7ba..787a3360f 100755 --- a/spec/unit/parser/ast/selector_spec.rb +++ b/spec/unit/parser/ast/selector_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') +require 'spec_helper' describe Puppet::Parser::AST::Selector do before :each do diff --git a/spec/unit/parser/ast/vardef_spec.rb b/spec/unit/parser/ast/vardef_spec.rb index 9c8b77905..a462e8ef5 100755 --- a/spec/unit/parser/ast/vardef_spec.rb +++ b/spec/unit/parser/ast/vardef_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') +require 'spec_helper' describe Puppet::Parser::AST::VarDef do before :each do diff --git a/spec/unit/parser/ast_spec.rb b/spec/unit/parser/ast_spec.rb index cdfb51869..ba8724242 100644..100755 --- a/spec/unit/parser/ast_spec.rb +++ b/spec/unit/parser/ast_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') +require 'spec_helper' require 'puppet/parser/ast' diff --git a/spec/unit/parser/collector_spec.rb b/spec/unit/parser/collector_spec.rb index 100a04daf..75c113eae 100755 --- a/spec/unit/parser/collector_spec.rb +++ b/spec/unit/parser/collector_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') +require 'spec_helper' require 'puppet/rails' require 'puppet/parser/collector' diff --git a/spec/unit/parser/compiler_spec.rb b/spec/unit/parser/compiler_spec.rb index e4b18e14b..0c896a4e3 100755 --- a/spec/unit/parser/compiler_spec.rb +++ b/spec/unit/parser/compiler_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') +require 'spec_helper' class CompilerTestResource attr_accessor :builtin, :virtual, :evaluated, :type, :title diff --git a/spec/unit/parser/files_spec.rb b/spec/unit/parser/files_spec.rb index 525c83697..7710871dc 100644..100755 --- a/spec/unit/parser/files_spec.rb +++ b/spec/unit/parser/files_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') +require 'spec_helper' require 'puppet/parser/files' diff --git a/spec/unit/parser/functions/create_resources_spec.rb b/spec/unit/parser/functions/create_resources_spec.rb index 366fb536c..88a67e369 100755 --- a/spec/unit/parser/functions/create_resources_spec.rb +++ b/spec/unit/parser/functions/create_resources_spec.rb @@ -1,5 +1,5 @@ require 'puppet' -require File.dirname(__FILE__) + '/../../../spec_helper' +require 'spec_helper' describe 'function for dynamically creating resources' do diff --git a/spec/unit/parser/functions/defined_spec.rb b/spec/unit/parser/functions/defined_spec.rb index 0113c3233..8b0fb4e2f 100755 --- a/spec/unit/parser/functions/defined_spec.rb +++ b/spec/unit/parser/functions/defined_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') +require 'spec_helper' describe "the 'defined' function" do before :all do diff --git a/spec/unit/parser/functions/extlookup_spec.rb b/spec/unit/parser/functions/extlookup_spec.rb index 46cd3cc27..f2560d3d9 100755 --- a/spec/unit/parser/functions/extlookup_spec.rb +++ b/spec/unit/parser/functions/extlookup_spec.rb @@ -1,6 +1,6 @@ #! /usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') +require 'spec_helper' require 'tempfile' describe "the extlookup function" do diff --git a/spec/unit/parser/functions/fqdn_rand_spec.rb b/spec/unit/parser/functions/fqdn_rand_spec.rb index be2e6fa76..d810741c5 100755 --- a/spec/unit/parser/functions/fqdn_rand_spec.rb +++ b/spec/unit/parser/functions/fqdn_rand_spec.rb @@ -1,6 +1,6 @@ #! /usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') +require 'spec_helper' describe "the fqdn_rand function" do before :all do diff --git a/spec/unit/parser/functions/generate_spec.rb b/spec/unit/parser/functions/generate_spec.rb index d25015b56..3351291d5 100755 --- a/spec/unit/parser/functions/generate_spec.rb +++ b/spec/unit/parser/functions/generate_spec.rb @@ -1,6 +1,6 @@ #! /usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') +require 'spec_helper' describe "the generate function" do before :all do diff --git a/spec/unit/parser/functions/include_spec.rb b/spec/unit/parser/functions/include_spec.rb index cfaadfbb6..b477f1439 100755 --- a/spec/unit/parser/functions/include_spec.rb +++ b/spec/unit/parser/functions/include_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') +require 'spec_helper' describe "the 'include' function" do before :all do diff --git a/spec/unit/parser/functions/inline_template_spec.rb b/spec/unit/parser/functions/inline_template_spec.rb index 712c68c69..e009870c5 100755 --- a/spec/unit/parser/functions/inline_template_spec.rb +++ b/spec/unit/parser/functions/inline_template_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') +require 'spec_helper' describe "the inline_template function" do before :all do diff --git a/spec/unit/parser/functions/realize_spec.rb b/spec/unit/parser/functions/realize_spec.rb index 3106c42b6..7a039c002 100755 --- a/spec/unit/parser/functions/realize_spec.rb +++ b/spec/unit/parser/functions/realize_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') +require 'spec_helper' describe "the realize function" do before :all do diff --git a/spec/unit/parser/functions/regsubst_spec.rb b/spec/unit/parser/functions/regsubst_spec.rb index 1fb8e410c..0cab3d18c 100755 --- a/spec/unit/parser/functions/regsubst_spec.rb +++ b/spec/unit/parser/functions/regsubst_spec.rb @@ -1,6 +1,6 @@ #! /usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') +require 'spec_helper' describe "the regsubst function" do before :all do diff --git a/spec/unit/parser/functions/require_spec.rb b/spec/unit/parser/functions/require_spec.rb index edcbc4ae6..cb89db3a1 100755 --- a/spec/unit/parser/functions/require_spec.rb +++ b/spec/unit/parser/functions/require_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') +require 'spec_helper' describe "the require function" do before :all do diff --git a/spec/unit/parser/functions/shellquote_spec.rb b/spec/unit/parser/functions/shellquote_spec.rb index 55302b97b..86181dee0 100755 --- a/spec/unit/parser/functions/shellquote_spec.rb +++ b/spec/unit/parser/functions/shellquote_spec.rb @@ -1,6 +1,6 @@ #! /usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') +require 'spec_helper' describe "the shellquote function" do before :all do diff --git a/spec/unit/parser/functions/split_spec.rb b/spec/unit/parser/functions/split_spec.rb index b892a5c2a..e321b6d9f 100755 --- a/spec/unit/parser/functions/split_spec.rb +++ b/spec/unit/parser/functions/split_spec.rb @@ -1,6 +1,6 @@ #! /usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') +require 'spec_helper' describe "the split function" do before :all do diff --git a/spec/unit/parser/functions/sprintf_spec.rb b/spec/unit/parser/functions/sprintf_spec.rb index 69fbb5e97..49c5324f8 100755 --- a/spec/unit/parser/functions/sprintf_spec.rb +++ b/spec/unit/parser/functions/sprintf_spec.rb @@ -1,6 +1,6 @@ #! /usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') +require 'spec_helper' describe "the sprintf function" do before :all do diff --git a/spec/unit/parser/functions/tag_spec.rb b/spec/unit/parser/functions/tag_spec.rb index b6bb45252..a8c57b7a4 100755 --- a/spec/unit/parser/functions/tag_spec.rb +++ b/spec/unit/parser/functions/tag_spec.rb @@ -1,6 +1,6 @@ #! /usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') +require 'spec_helper' describe "the 'tag' function" do before :all do diff --git a/spec/unit/parser/functions/template_spec.rb b/spec/unit/parser/functions/template_spec.rb index 7eaf3554d..64d992297 100755 --- a/spec/unit/parser/functions/template_spec.rb +++ b/spec/unit/parser/functions/template_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') +require 'spec_helper' describe "the template function" do before :all do diff --git a/spec/unit/parser/functions/versioncmp_spec.rb b/spec/unit/parser/functions/versioncmp_spec.rb index ddc79cd85..d7ae0152a 100755 --- a/spec/unit/parser/functions/versioncmp_spec.rb +++ b/spec/unit/parser/functions/versioncmp_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') +require 'spec_helper' describe "the versioncmp function" do before :all do diff --git a/spec/unit/parser/functions_spec.rb b/spec/unit/parser/functions_spec.rb index 51e52faee..79585f12d 100644..100755 --- a/spec/unit/parser/functions_spec.rb +++ b/spec/unit/parser/functions_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') +require 'spec_helper' describe Puppet::Parser::Functions do diff --git a/spec/unit/parser/lexer_spec.rb b/spec/unit/parser/lexer_spec.rb index bc9e22e48..2eb2581a2 100755 --- a/spec/unit/parser/lexer_spec.rb +++ b/spec/unit/parser/lexer_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') +require 'spec_helper' require 'puppet/parser/lexer' diff --git a/spec/unit/parser/parser_spec.rb b/spec/unit/parser/parser_spec.rb index 01cdcb976..cb90939fa 100755 --- a/spec/unit/parser/parser_spec.rb +++ b/spec/unit/parser/parser_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') +require 'spec_helper' describe Puppet::Parser do diff --git a/spec/unit/parser/relationship_spec.rb b/spec/unit/parser/relationship_spec.rb index 883a38d11..f44a5c844 100644..100755 --- a/spec/unit/parser/relationship_spec.rb +++ b/spec/unit/parser/relationship_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') +require 'spec_helper' require 'puppet/parser/relationship' diff --git a/spec/unit/parser/resource_spec.rb b/spec/unit/parser/resource_spec.rb index 73c4412dd..078b7de95 100755 --- a/spec/unit/parser/resource_spec.rb +++ b/spec/unit/parser/resource_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') +require 'spec_helper' # LAK: FIXME This is just new tests for resources; I have # not moved all tests over yet. diff --git a/spec/unit/parser/scope_spec.rb b/spec/unit/parser/scope_spec.rb index 32a87f1f4..44e255956 100755 --- a/spec/unit/parser/scope_spec.rb +++ b/spec/unit/parser/scope_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') +require 'spec_helper' describe Puppet::Parser::Scope do before :each do diff --git a/spec/unit/parser/templatewrapper_spec.rb b/spec/unit/parser/templatewrapper_spec.rb index aab169348..afb0032fd 100755 --- a/spec/unit/parser/templatewrapper_spec.rb +++ b/spec/unit/parser/templatewrapper_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') +require 'spec_helper' require 'puppet/parser/templatewrapper' describe Puppet::Parser::TemplateWrapper do diff --git a/spec/unit/parser/type_loader_spec.rb b/spec/unit/parser/type_loader_spec.rb index 12bc1ccd6..dfbd2f278 100644..100755 --- a/spec/unit/parser/type_loader_spec.rb +++ b/spec/unit/parser/type_loader_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') +require 'spec_helper' require 'puppet/parser/type_loader' require 'puppet_spec/files' diff --git a/spec/unit/property/ensure_spec.rb b/spec/unit/property/ensure_spec.rb index d3029c658..e1e0f0c52 100644..100755 --- a/spec/unit/property/ensure_spec.rb +++ b/spec/unit/property/ensure_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') +require 'spec_helper' require 'puppet/property/ensure' diff --git a/spec/unit/property/keyvalue_spec.rb b/spec/unit/property/keyvalue_spec.rb index a0175cfa3..9310934ea 100644..100755 --- a/spec/unit/property/keyvalue_spec.rb +++ b/spec/unit/property/keyvalue_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') +require 'spec_helper' require 'puppet/property/keyvalue' diff --git a/spec/unit/property/list_spec.rb b/spec/unit/property/list_spec.rb index 704fbe3d9..9dc8fdae4 100644..100755 --- a/spec/unit/property/list_spec.rb +++ b/spec/unit/property/list_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') +require 'spec_helper' require 'puppet/property/list' diff --git a/spec/unit/property/ordered_list_spec.rb b/spec/unit/property/ordered_list_spec.rb index 460bec79d..7a09edb68 100644..100755 --- a/spec/unit/property/ordered_list_spec.rb +++ b/spec/unit/property/ordered_list_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') +require 'spec_helper' require 'puppet/property/ordered_list' diff --git a/spec/unit/property_spec.rb b/spec/unit/property_spec.rb index 602d3c66b..f3cc79eca 100755 --- a/spec/unit/property_spec.rb +++ b/spec/unit/property_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../spec_helper') +require 'spec_helper' require 'puppet/property' describe Puppet::Property do diff --git a/spec/unit/provider/augeas/augeas_spec.rb b/spec/unit/provider/augeas/augeas_spec.rb index c65f39097..a7823f21f 100644..100755 --- a/spec/unit/provider/augeas/augeas_spec.rb +++ b/spec/unit/provider/augeas/augeas_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') +require 'spec_helper' provider_class = Puppet::Type.type(:augeas).provider(:augeas) diff --git a/spec/unit/provider/confine/exists_spec.rb b/spec/unit/provider/confine/exists_spec.rb index 1dabafb19..9ab307eb3 100755 --- a/spec/unit/provider/confine/exists_spec.rb +++ b/spec/unit/provider/confine/exists_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') +require 'spec_helper' require 'puppet/provider/confine/exists' diff --git a/spec/unit/provider/confine/false_spec.rb b/spec/unit/provider/confine/false_spec.rb index 8ea4bf740..1b4c69f2a 100755 --- a/spec/unit/provider/confine/false_spec.rb +++ b/spec/unit/provider/confine/false_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') +require 'spec_helper' require 'puppet/provider/confine/false' diff --git a/spec/unit/provider/confine/feature_spec.rb b/spec/unit/provider/confine/feature_spec.rb index 534c8c14a..88ce496a1 100755 --- a/spec/unit/provider/confine/feature_spec.rb +++ b/spec/unit/provider/confine/feature_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') +require 'spec_helper' require 'puppet/provider/confine/feature' diff --git a/spec/unit/provider/confine/true_spec.rb b/spec/unit/provider/confine/true_spec.rb index b23373b87..c26c2ca75 100755 --- a/spec/unit/provider/confine/true_spec.rb +++ b/spec/unit/provider/confine/true_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') +require 'spec_helper' require 'puppet/provider/confine/true' diff --git a/spec/unit/provider/confine/variable_spec.rb b/spec/unit/provider/confine/variable_spec.rb index 083573c3a..9156bc4cc 100755 --- a/spec/unit/provider/confine/variable_spec.rb +++ b/spec/unit/provider/confine/variable_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') +require 'spec_helper' require 'puppet/provider/confine/variable' diff --git a/spec/unit/provider/confine_collection_spec.rb b/spec/unit/provider/confine_collection_spec.rb index fc68ef7f6..ffc905b3d 100755 --- a/spec/unit/provider/confine_collection_spec.rb +++ b/spec/unit/provider/confine_collection_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') +require 'spec_helper' require 'puppet/provider/confine_collection' diff --git a/spec/unit/provider/confine_spec.rb b/spec/unit/provider/confine_spec.rb index ce969eded..060ae8dc3 100755 --- a/spec/unit/provider/confine_spec.rb +++ b/spec/unit/provider/confine_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') +require 'spec_helper' require 'puppet/provider/confine' diff --git a/spec/unit/provider/confiner_spec.rb b/spec/unit/provider/confiner_spec.rb index 15e2e6129..fe1ffd86f 100755 --- a/spec/unit/provider/confiner_spec.rb +++ b/spec/unit/provider/confiner_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') +require 'spec_helper' require 'puppet/provider/confiner' diff --git a/spec/unit/provider/exec/posix_spec.rb b/spec/unit/provider/exec/posix_spec.rb index d02099250..a1d887215 100755 --- a/spec/unit/provider/exec/posix_spec.rb +++ b/spec/unit/provider/exec/posix_spec.rb @@ -1,5 +1,5 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../../spec_helper' +require 'spec_helper' provider_class = Puppet::Type.type(:exec).provider(:posix) diff --git a/spec/unit/provider/exec/shell_spec.rb b/spec/unit/provider/exec/shell_spec.rb index 4bae354c9..b84f48fe3 100644..100755 --- a/spec/unit/provider/exec/shell_spec.rb +++ b/spec/unit/provider/exec/shell_spec.rb @@ -1,5 +1,5 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../../spec_helper' +require 'spec_helper' provider_class = Puppet::Type.type(:exec).provider(:shell) diff --git a/spec/unit/provider/group/groupadd_spec.rb b/spec/unit/provider/group/groupadd_spec.rb index 41431fb59..65cb14503 100755 --- a/spec/unit/provider/group/groupadd_spec.rb +++ b/spec/unit/provider/group/groupadd_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') +require 'spec_helper' provider_class = Puppet::Type.type(:group).provider(:groupadd) diff --git a/spec/unit/provider/group/ldap_spec.rb b/spec/unit/provider/group/ldap_spec.rb index 8454b9604..00c42ea40 100755 --- a/spec/unit/provider/group/ldap_spec.rb +++ b/spec/unit/provider/group/ldap_spec.rb @@ -3,7 +3,7 @@ # Created by Luke Kanies on 2008-3-10. # Copyright (c) 2006. All rights reserved. -require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') +require 'spec_helper' provider_class = Puppet::Type.type(:group).provider(:ldap) diff --git a/spec/unit/provider/host/parsed_spec.rb b/spec/unit/provider/host/parsed_spec.rb index 048d77ba2..b6a78e411 100755 --- a/spec/unit/provider/host/parsed_spec.rb +++ b/spec/unit/provider/host/parsed_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') +require 'spec_helper' require 'shared_behaviours/all_parsedfile_providers' require 'puppet_spec/files' diff --git a/spec/unit/provider/interface/cisco_spec.rb b/spec/unit/provider/interface/cisco_spec.rb new file mode 100644 index 000000000..7904711f5 --- /dev/null +++ b/spec/unit/provider/interface/cisco_spec.rb @@ -0,0 +1,64 @@ +#!/usr/bin/env ruby + +require File.dirname(__FILE__) + '/../../../spec_helper' + +require 'puppet/provider/interface/cisco' + +provider_class = Puppet::Type.type(:interface).provider(:cisco) + +describe provider_class do + before do + @resource = stub("resource", :name => "Fa0/1") + @provider = provider_class.new(@resource) + end + + it "should have a parent of Puppet::Provider::NetworkDevice" do + provider_class.should < Puppet::Provider::NetworkDevice + end + + it "should have an instances method" do + provider_class.should respond_to(:instances) + end + + describe "when looking up instances at prefetch" do + before do + @device = stub_everything 'device' + Puppet::Util::NetworkDevice::Cisco::Device.stubs(:new).returns(@device) + @device.stubs(:command).yields(@device) + end + + it "should initialize the network device with the given url" do + Puppet::Util::NetworkDevice::Cisco::Device.expects(:new).with(:url).returns(@device) + provider_class.lookup(:url, "Fa0/1") + end + + it "should delegate to the device interface fetcher" do + @device.expects(:interface) + provider_class.lookup("", "Fa0/1") + end + + it "should return the given interface data" do + @device.expects(:interface).returns({ :description => "thisone", :mode => :access}) + provider_class.lookup("", "Fa0").should == {:description => "thisone", :mode => :access } + end + + end + + describe "when an instance is being flushed" do + it "should call the device interface update method with current and past properties" do + @instance = provider_class.new(:ensure => :present, :name => "Fa0/1", :description => "myinterface") + @instance.description = "newdesc" + @instance.resource = @resource + @resource.stubs(:[]).with(:name).returns("Fa0/1") + device = stub_everything 'device' + @instance.stubs(:device).returns(device) + device.expects(:command).yields(device) + interface = stub 'interface' + device.expects(:new_interface).with("Fa0/1").returns(interface) + interface.expects(:update).with( {:ensure => :present, :name => "Fa0/1", :description => "myinterface"}, + {:ensure => :present, :name => "Fa0/1", :description => "newdesc"}) + + @instance.flush + end + end +end diff --git a/spec/unit/provider/ldap_spec.rb b/spec/unit/provider/ldap_spec.rb index 7ed289c62..3e0562b73 100755 --- a/spec/unit/provider/ldap_spec.rb +++ b/spec/unit/provider/ldap_spec.rb @@ -3,7 +3,7 @@ # Created by Luke Kanies on 2008-3-21. # Copyright (c) 2006. All rights reserved. -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') +require 'spec_helper' require 'puppet/provider/ldap' diff --git a/spec/unit/provider/macauthorization_spec.rb b/spec/unit/provider/macauthorization_spec.rb index 3c74334ba..cb546edbe 100755 --- a/spec/unit/provider/macauthorization_spec.rb +++ b/spec/unit/provider/macauthorization_spec.rb @@ -3,7 +3,7 @@ # Unit testing for the macauthorization provider # -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') +require 'spec_helper' require 'puppet' require 'facter/util/plist' diff --git a/spec/unit/provider/mcx/mcxcontent_spec.rb b/spec/unit/provider/mcx/mcxcontent_spec.rb index 82dbf9ac7..27aae6807 100755 --- a/spec/unit/provider/mcx/mcxcontent_spec.rb +++ b/spec/unit/provider/mcx/mcxcontent_spec.rb @@ -1,24 +1,6 @@ #! /usr/bin/env ruby -#-- -# Copyright (C) 2008 Jeffrey J McCune. -# This program and entire repository is free software; you can -# redistribute it and/or modify it under the terms of the GNU -# General Public License as published by the Free Software -# Foundation; either version 2 of the License, or any later version. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - -# Author: Jeff McCune <mccune.jeff@gmail.com> - -require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') +require 'spec_helper' provider_class = Puppet::Type.type(:mcx).provider(:mcxcontent) diff --git a/spec/unit/provider/mount/parsed_spec.rb b/spec/unit/provider/mount/parsed_spec.rb index b63c0751f..86c35f7da 100755 --- a/spec/unit/provider/mount/parsed_spec.rb +++ b/spec/unit/provider/mount/parsed_spec.rb @@ -3,7 +3,7 @@ # Created by Luke Kanies on 2007-9-12. # Copyright (c) 2006. All rights reserved. -require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') +require 'spec_helper' require 'shared_behaviours/all_parsedfile_providers' provider_class = Puppet::Type.type(:mount).provider(:parsed) diff --git a/spec/unit/provider/mount_spec.rb b/spec/unit/provider/mount_spec.rb index 9cadfc403..0db4ae918 100755 --- a/spec/unit/provider/mount_spec.rb +++ b/spec/unit/provider/mount_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') +require 'spec_helper' require 'puppet/provider/mount' diff --git a/spec/unit/provider/naginator_spec.rb b/spec/unit/provider/naginator_spec.rb index 8ae1895cc..5841bc012 100755 --- a/spec/unit/provider/naginator_spec.rb +++ b/spec/unit/provider/naginator_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') +require 'spec_helper' require 'puppet/provider/naginator' diff --git a/spec/unit/provider/nameservice/directoryservice_spec.rb b/spec/unit/provider/nameservice/directoryservice_spec.rb index 661899db9..798d511c0 100755 --- a/spec/unit/provider/nameservice/directoryservice_spec.rb +++ b/spec/unit/provider/nameservice/directoryservice_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../../spec_helper' +require 'spec_helper' # We use this as a reasonable way to obtain all the support infrastructure. [:user, :group].each do |type_for_this_round| diff --git a/spec/unit/provider/network_device_spec.rb b/spec/unit/provider/network_device_spec.rb new file mode 100644 index 000000000..3e6d382ee --- /dev/null +++ b/spec/unit/provider/network_device_spec.rb @@ -0,0 +1,148 @@ +#!/usr/bin/env ruby + +require File.dirname(__FILE__) + '/../../spec_helper' + +require 'puppet/provider/network_device' + +Puppet::Type.type(:vlan).provide :test, :parent => Puppet::Provider::NetworkDevice do + mk_resource_methods + def self.lookup(device_url, name) + end +end + +provider_class = Puppet::Type.type(:vlan).provider(:test) + +describe provider_class do + before do + @resource = stub("resource", :name => "test") + @provider = provider_class.new(@resource) + end + + it "should be able to prefetch instances from the device" do + provider_class.should respond_to(:prefetch) + end + + it "should have an instances method" do + provider_class.should respond_to(:instances) + end + + describe "when prefetching" do + before do + @resource = stub_everything 'resource' + @resources = {"200" => @resource} + provider_class.stubs(:lookup) + end + + it "should lookup an entry for each passed resource" do + provider_class.expects(:lookup).with(nil, "200").returns nil + + provider_class.stubs(:new) + @resource.stubs(:provider=) + provider_class.prefetch(@resources) + end + + describe "resources that do not exist" do + it "should create a provider with :ensure => :absent" do + provider_class.stubs(:lookup).returns(nil) + provider_class.expects(:new).with(:ensure => :absent).returns "myprovider" + @resource.expects(:provider=).with("myprovider") + provider_class.prefetch(@resources) + end + end + + describe "resources that exist" do + it "should create a provider with the results of the find and ensure at present" do + provider_class.stubs(:lookup).returns({ :name => "200", :description => "myvlan"}) + + provider_class.expects(:new).with(:name => "200", :description => "myvlan", :ensure => :present).returns "myprovider" + @resource.expects(:provider=).with("myprovider") + + provider_class.prefetch(@resources) + end + end + end + + describe "when being initialized" do + describe "with a hash" do + before do + @resource_class = mock 'resource_class' + provider_class.stubs(:resource_type).returns @resource_class + + @property_class = stub 'property_class', :array_matching => :all, :superclass => Puppet::Property + @resource_class.stubs(:attrclass).with(:one).returns(@property_class) + @resource_class.stubs(:valid_parameter?).returns true + end + + it "should store a copy of the hash as its vlan_properties" do + instance = provider_class.new(:one => :two) + instance.former_properties.should == {:one => :two} + end + end + end + + describe "when an instance" do + before do + @instance = provider_class.new + + @property_class = stub 'property_class', :array_matching => :all, :superclass => Puppet::Property + @resource_class = stub 'resource_class', :attrclass => @property_class, :valid_parameter? => true, :validproperties => [:description] + provider_class.stubs(:resource_type).returns @resource_class + end + + it "should have a method for creating the instance" do + @instance.should respond_to(:create) + end + + it "should have a method for removing the instance" do + @instance.should respond_to(:destroy) + end + + it "should indicate when the instance already exists" do + @instance = provider_class.new(:ensure => :present) + @instance.exists?.should be_true + end + + it "should indicate when the instance does not exist" do + @instance = provider_class.new(:ensure => :absent) + @instance.exists?.should be_false + end + + describe "is being flushed" do + it "should flush properties" do + @instance = provider_class.new(:ensure => :present, :name => "200", :description => "myvlan") + @instance.flush + @instance.properties.should be_empty + end + end + + describe "is being created" do + before do + @rclass = mock 'resource_class' + @rclass.stubs(:validproperties).returns([:description]) + @resource = stub_everything 'resource' + @resource.stubs(:class).returns @rclass + @resource.stubs(:should).returns nil + @instance.stubs(:resource).returns @resource + end + + it "should set its :ensure value to :present" do + @instance.create + @instance.properties[:ensure].should == :present + end + + it "should set all of the other attributes from the resource" do + @resource.expects(:should).with(:description).returns "myvlan" + + @instance.create + @instance.properties[:description].should == "myvlan" + end + end + + describe "is being destroyed" do + it "should set its :ensure value to :absent" do + @instance.destroy + @instance.properties[:ensure].should == :absent + end + end + end +end diff --git a/spec/unit/provider/package/aix_spec.rb b/spec/unit/provider/package/aix_spec.rb index 40e497c27..8feac3c55 100755 --- a/spec/unit/provider/package/aix_spec.rb +++ b/spec/unit/provider/package/aix_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') +require 'spec_helper' provider_class = Puppet::Type.type(:package).provider(:aix) diff --git a/spec/unit/provider/package/apt_spec.rb b/spec/unit/provider/package/apt_spec.rb index b0ce4f799..59342750e 100755 --- a/spec/unit/provider/package/apt_spec.rb +++ b/spec/unit/provider/package/apt_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') +require 'spec_helper' provider = Puppet::Type.type(:package).provider(:apt) diff --git a/spec/unit/provider/package/dpkg_spec.rb b/spec/unit/provider/package/dpkg_spec.rb index 444fb31c1..7c83f90ee 100755 --- a/spec/unit/provider/package/dpkg_spec.rb +++ b/spec/unit/provider/package/dpkg_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') +require 'spec_helper' provider = Puppet::Type.type(:package).provider(:dpkg) diff --git a/spec/unit/provider/package/freebsd_spec.rb b/spec/unit/provider/package/freebsd_spec.rb index 0d38a16cf..4229cba1f 100755 --- a/spec/unit/provider/package/freebsd_spec.rb +++ b/spec/unit/provider/package/freebsd_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../../spec_helper' +require 'spec_helper' provider_class = Puppet::Type.type(:package).provider(:freebsd) diff --git a/spec/unit/provider/package/gem_spec.rb b/spec/unit/provider/package/gem_spec.rb index c2bd3cc90..ef06ef5ba 100644..100755 --- a/spec/unit/provider/package/gem_spec.rb +++ b/spec/unit/provider/package/gem_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') +require 'spec_helper' provider_class = Puppet::Type.type(:package).provider(:gem) diff --git a/spec/unit/provider/package/hpux_spec.rb b/spec/unit/provider/package/hpux_spec.rb index e75ae0822..3c5b81c1b 100644..100755 --- a/spec/unit/provider/package/hpux_spec.rb +++ b/spec/unit/provider/package/hpux_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') +require 'spec_helper' provider_class = Puppet::Type.type(:package).provider(:hpux) diff --git a/spec/unit/provider/package/nim_spec.rb b/spec/unit/provider/package/nim_spec.rb index 74f903813..69538e9b9 100755 --- a/spec/unit/provider/package/nim_spec.rb +++ b/spec/unit/provider/package/nim_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') +require 'spec_helper' provider_class = Puppet::Type.type(:package).provider(:nim) diff --git a/spec/unit/provider/package/pip_spec.rb b/spec/unit/provider/package/pip_spec.rb index 8953b4b2c..2cca29b35 100644..100755 --- a/spec/unit/provider/package/pip_spec.rb +++ b/spec/unit/provider/package/pip_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') +require 'spec_helper' provider_class = Puppet::Type.type(:package).provider(:pip) diff --git a/spec/unit/provider/package/pkg_spec.rb b/spec/unit/provider/package/pkg_spec.rb index 3455c4c40..93aeac004 100644..100755 --- a/spec/unit/provider/package/pkg_spec.rb +++ b/spec/unit/provider/package/pkg_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') +require 'spec_helper' provider = Puppet::Type.type(:package).provider(:pkg) diff --git a/spec/unit/provider/package/pkgdmg_spec.rb b/spec/unit/provider/package/pkgdmg_spec.rb index 86631e596..c59a87ffd 100755 --- a/spec/unit/provider/package/pkgdmg_spec.rb +++ b/spec/unit/provider/package/pkgdmg_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') +require 'spec_helper' provider = Puppet::Type.type(:package).provider(:pkgdmg) diff --git a/spec/unit/provider/package/yum_spec.rb b/spec/unit/provider/package/yum_spec.rb index 4e2294a77..1dd4a5231 100644..100755 --- a/spec/unit/provider/package/yum_spec.rb +++ b/spec/unit/provider/package/yum_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') +require 'spec_helper' provider = Puppet::Type.type(:package).provider(:yum) diff --git a/spec/unit/provider/package/zypper_spec.rb b/spec/unit/provider/package/zypper_spec.rb index 1bf27ad97..eb17de4dd 100644..100755 --- a/spec/unit/provider/package/zypper_spec.rb +++ b/spec/unit/provider/package/zypper_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') +require 'spec_helper' provider_class = Puppet::Type.type(:package).provider(:zypper) diff --git a/spec/unit/provider/parsedfile_spec.rb b/spec/unit/provider/parsedfile_spec.rb index 7d95ef1d0..4f70111f2 100755 --- a/spec/unit/provider/parsedfile_spec.rb +++ b/spec/unit/provider/parsedfile_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') +require 'spec_helper' require 'puppet/provider/parsedfile' diff --git a/spec/unit/provider/selboolean_spec.rb b/spec/unit/provider/selboolean_spec.rb index 02a39f2a7..b45c3f713 100755 --- a/spec/unit/provider/selboolean_spec.rb +++ b/spec/unit/provider/selboolean_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') +require 'spec_helper' provider_class = Puppet::Type.type(:selboolean).provider(:getsetsebool) diff --git a/spec/unit/provider/selmodule_spec.rb b/spec/unit/provider/selmodule_spec.rb index cb143e993..9ac5a7a5d 100755 --- a/spec/unit/provider/selmodule_spec.rb +++ b/spec/unit/provider/selmodule_spec.rb @@ -5,7 +5,7 @@ # with version 1.5.0. The provided selmodule-example.pp is the first # 256 bytes taken from /usr/share/selinux/targeted/nagios.pp on Fedora 9 -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') +require 'spec_helper' provider_class = Puppet::Type.type(:selmodule).provider(:semodule) diff --git a/spec/unit/provider/service/daemontools_spec.rb b/spec/unit/provider/service/daemontools_spec.rb index 0bdb0a85d..98652cb88 100755 --- a/spec/unit/provider/service/daemontools_spec.rb +++ b/spec/unit/provider/service/daemontools_spec.rb @@ -4,7 +4,7 @@ # # author Brice Figureau # -require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') +require 'spec_helper' provider_class = Puppet::Type.type(:service).provider(:daemontools) diff --git a/spec/unit/provider/service/debian_spec.rb b/spec/unit/provider/service/debian_spec.rb index b5edf6882..174aac9ff 100755 --- a/spec/unit/provider/service/debian_spec.rb +++ b/spec/unit/provider/service/debian_spec.rb @@ -3,7 +3,7 @@ # Unit testing for the debian service provider # -require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') +require 'spec_helper' provider_class = Puppet::Type.type(:service).provider(:debian) diff --git a/spec/unit/provider/service/freebsd_spec.rb b/spec/unit/provider/service/freebsd_spec.rb index d8b751108..6c778f1dd 100644..100755 --- a/spec/unit/provider/service/freebsd_spec.rb +++ b/spec/unit/provider/service/freebsd_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') +require 'spec_helper' provider_class = Puppet::Type.type(:service).provider(:freebsd) diff --git a/spec/unit/provider/service/init_spec.rb b/spec/unit/provider/service/init_spec.rb index b54c27e8e..531f9901d 100755 --- a/spec/unit/provider/service/init_spec.rb +++ b/spec/unit/provider/service/init_spec.rb @@ -3,7 +3,7 @@ # Unit testing for the Init service Provider # -require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') +require 'spec_helper' provider_class = Puppet::Type.type(:service).provider(:init) diff --git a/spec/unit/provider/service/launchd_spec.rb b/spec/unit/provider/service/launchd_spec.rb index dfcb58fdc..9db9d5a19 100755 --- a/spec/unit/provider/service/launchd_spec.rb +++ b/spec/unit/provider/service/launchd_spec.rb @@ -3,7 +3,7 @@ # Unit testing for the launchd service provider # -require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') +require 'spec_helper' require 'puppet' diff --git a/spec/unit/provider/service/redhat_spec.rb b/spec/unit/provider/service/redhat_spec.rb index a3c6247dd..0648772b4 100755 --- a/spec/unit/provider/service/redhat_spec.rb +++ b/spec/unit/provider/service/redhat_spec.rb @@ -2,7 +2,7 @@ # # Unit testing for the RedHat service Provider # -require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') +require 'spec_helper' provider_class = Puppet::Type.type(:service).provider(:redhat) diff --git a/spec/unit/provider/service/runit_spec.rb b/spec/unit/provider/service/runit_spec.rb index 12dfeeb35..c184038d5 100755 --- a/spec/unit/provider/service/runit_spec.rb +++ b/spec/unit/provider/service/runit_spec.rb @@ -4,7 +4,7 @@ # # author Brice Figureau # -require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') +require 'spec_helper' provider_class = Puppet::Type.type(:service).provider(:runit) diff --git a/spec/unit/provider/service/smf_spec.rb b/spec/unit/provider/service/smf_spec.rb index 40e96ab23..c78847631 100755 --- a/spec/unit/provider/service/smf_spec.rb +++ b/spec/unit/provider/service/smf_spec.rb @@ -4,7 +4,7 @@ # # author Dominic Cleal # -require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') +require 'spec_helper' provider_class = Puppet::Type.type(:service).provider(:smf) diff --git a/spec/unit/provider/service/src_spec.rb b/spec/unit/provider/service/src_spec.rb index dbe073513..4502eb643 100755 --- a/spec/unit/provider/service/src_spec.rb +++ b/spec/unit/provider/service/src_spec.rb @@ -3,7 +3,7 @@ # Unit testing for the AIX System Resource Controller (src) provider # -require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') +require 'spec_helper' provider_class = Puppet::Type.type(:service).provider(:src) diff --git a/spec/unit/provider/service/upstart.rb b/spec/unit/provider/service/upstart.rb index 22cf2bdeb..61e191b8a 100644..100755 --- a/spec/unit/provider/service/upstart.rb +++ b/spec/unit/provider/service/upstart.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') +require 'spec_helper' provider_class = Puppet::Type.type(:service).provider(:upstart) diff --git a/spec/unit/provider/ssh_authorized_key/parsed_spec.rb b/spec/unit/provider/ssh_authorized_key/parsed_spec.rb index 3ac57facc..0203014a4 100755 --- a/spec/unit/provider/ssh_authorized_key/parsed_spec.rb +++ b/spec/unit/provider/ssh_authorized_key/parsed_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') +require 'spec_helper' require 'shared_behaviours/all_parsedfile_providers' require 'puppet_spec/files' diff --git a/spec/unit/provider/sshkey/parsed_spec.rb b/spec/unit/provider/sshkey/parsed_spec.rb index 7a76b02d6..664316f14 100755 --- a/spec/unit/provider/sshkey/parsed_spec.rb +++ b/spec/unit/provider/sshkey/parsed_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') +require 'spec_helper' provider_class = Puppet::Type.type(:sshkey).provider(:parsed) diff --git a/spec/unit/provider/user/hpux_spec.rb b/spec/unit/provider/user/hpux_spec.rb index b10f2847c..def7f27ba 100755 --- a/spec/unit/provider/user/hpux_spec.rb +++ b/spec/unit/provider/user/hpux_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') +require 'spec_helper' provider_class = Puppet::Type.type(:user).provider(:hpuxuseradd) diff --git a/spec/unit/provider/user/ldap_spec.rb b/spec/unit/provider/user/ldap_spec.rb index 5b2dc98b5..97290c6e4 100755 --- a/spec/unit/provider/user/ldap_spec.rb +++ b/spec/unit/provider/user/ldap_spec.rb @@ -3,7 +3,7 @@ # Created by Luke Kanies on 2008-3-10. # Copyright (c) 2006. All rights reserved. -require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') +require 'spec_helper' provider_class = Puppet::Type.type(:user).provider(:ldap) diff --git a/spec/unit/provider/user/user_role_add_spec.rb b/spec/unit/provider/user/user_role_add_spec.rb index 12a71d25a..a790c5669 100644..100755 --- a/spec/unit/provider/user/user_role_add_spec.rb +++ b/spec/unit/provider/user/user_role_add_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') +require 'spec_helper' provider_class = Puppet::Type.type(:user).provider(:user_role_add) diff --git a/spec/unit/provider/user/useradd_spec.rb b/spec/unit/provider/user/useradd_spec.rb index b1719eeaf..e7d99ac2b 100755 --- a/spec/unit/provider/user/useradd_spec.rb +++ b/spec/unit/provider/user/useradd_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') +require 'spec_helper' provider_class = Puppet::Type.type(:user).provider(:useradd) diff --git a/spec/unit/provider/vlan/cisco_spec.rb b/spec/unit/provider/vlan/cisco_spec.rb new file mode 100644 index 000000000..0951367e6 --- /dev/null +++ b/spec/unit/provider/vlan/cisco_spec.rb @@ -0,0 +1,62 @@ +#!/usr/bin/env ruby + +require File.dirname(__FILE__) + '/../../../spec_helper' + +require 'puppet/provider/vlan/cisco' + +provider_class = Puppet::Type.type(:vlan).provider(:cisco) + +describe provider_class do + before do + @resource = stub("resource", :name => "200") + @provider = provider_class.new(@resource) + end + + it "should have a parent of Puppet::Provider::NetworkDevice" do + provider_class.should < Puppet::Provider::NetworkDevice + end + + it "should have an instances method" do + provider_class.should respond_to(:instances) + end + + describe "when looking up instances at prefetch" do + before do + @device = stub_everything 'device' + Puppet::Util::NetworkDevice::Cisco::Device.stubs(:new).returns(@device) + @device.stubs(:command).yields(@device) + end + + it "should initialize the network device with the given url" do + Puppet::Util::NetworkDevice::Cisco::Device.expects(:new).with(:url).returns(@device) + provider_class.lookup(:url, "200") + end + + it "should delegate to the device vlans" do + @device.expects(:parse_vlans) + provider_class.lookup("", "200") + end + + it "should return only the given vlan" do + @device.expects(:parse_vlans).returns({"200" => { :description => "thisone" }, "1" => { :description => "nothisone" }}) + provider_class.lookup("", "200").should == {:description => "thisone" } + end + + end + + describe "when an instance is being flushed" do + it "should call the device update_vlan method with its vlan id, current attributes, and desired attributes" do + @instance = provider_class.new(:ensure => :present, :name => "200", :description => "myvlan") + @instance.description = "myvlan2" + @instance.resource = @resource + @resource.stubs(:[]).with(:name).returns("200") + device = stub_everything 'device' + @instance.stubs(:device).returns(device) + device.expects(:command).yields(device) + device.expects(:update_vlan).with(@instance.name, {:ensure => :present, :name => "200", :description => "myvlan"}, + {:ensure => :present, :name => "200", :description => "myvlan2"}) + + @instance.flush + end + end +end diff --git a/spec/unit/provider/zfs/solaris_spec.rb b/spec/unit/provider/zfs/solaris_spec.rb index 84a2be9f6..2e9b81b3c 100755 --- a/spec/unit/provider/zfs/solaris_spec.rb +++ b/spec/unit/provider/zfs/solaris_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') +require 'spec_helper' provider_class = Puppet::Type.type(:zfs).provider(:solaris) diff --git a/spec/unit/provider/zone/solaris_spec.rb b/spec/unit/provider/zone/solaris_spec.rb index 4a1d03272..669a26b4f 100755 --- a/spec/unit/provider/zone/solaris_spec.rb +++ b/spec/unit/provider/zone/solaris_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') +require 'spec_helper' provider_class = Puppet::Type.type(:zone).provider(:solaris) diff --git a/spec/unit/provider/zpool/solaris_spec.rb b/spec/unit/provider/zpool/solaris_spec.rb index e2a0e16c8..0ab0b25fa 100755 --- a/spec/unit/provider/zpool/solaris_spec.rb +++ b/spec/unit/provider/zpool/solaris_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') +require 'spec_helper' provider_class = Puppet::Type.type(:zpool).provider(:solaris) diff --git a/spec/unit/provider_spec.rb b/spec/unit/provider_spec.rb index 24f5216fe..23d8ae2af 100755 --- a/spec/unit/provider_spec.rb +++ b/spec/unit/provider_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../spec_helper') +require 'spec_helper' describe Puppet::Provider do it "should have a specifity class method" do diff --git a/spec/unit/puppet_spec.rb b/spec/unit/puppet_spec.rb index 28dbd5104..e0eb49bad 100755 --- a/spec/unit/puppet_spec.rb +++ b/spec/unit/puppet_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby" -require File.expand_path(File.dirname(__FILE__) + '/../spec_helper') +require 'spec_helper' require 'puppet' describe Puppet do diff --git a/spec/unit/rails/host_spec.rb b/spec/unit/rails/host_spec.rb index e83135c91..07399a361 100755 --- a/spec/unit/rails/host_spec.rb +++ b/spec/unit/rails/host_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') +require 'spec_helper' describe "Puppet::Rails::Host", :if => Puppet.features.rails? do def column(name, type) diff --git a/spec/unit/rails/param_value_spec.rb b/spec/unit/rails/param_value_spec.rb index 9a725cfc8..6aff12b51 100755 --- a/spec/unit/rails/param_value_spec.rb +++ b/spec/unit/rails/param_value_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') +require 'spec_helper' require 'puppet/rails' describe "Puppet::Rails::ParamValue", :if => Puppet.features.rails? do diff --git a/spec/unit/rails/resource_spec.rb b/spec/unit/rails/resource_spec.rb index 3fbbbc7b7..9791f49cb 100755 --- a/spec/unit/rails/resource_spec.rb +++ b/spec/unit/rails/resource_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') +require 'spec_helper' require 'puppet/rails' describe "Puppet::Rails::Resource", :if => Puppet.features.rails? do diff --git a/spec/unit/rails_spec.rb b/spec/unit/rails_spec.rb index a08485e4c..eba85afc7 100755 --- a/spec/unit/rails_spec.rb +++ b/spec/unit/rails_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../spec_helper') +require 'spec_helper' require 'puppet/rails' describe Puppet::Rails, "when initializing any connection", :if => Puppet.features.rails? do diff --git a/spec/unit/relationship_spec.rb b/spec/unit/relationship_spec.rb index 362d74c74..349be7c1a 100755 --- a/spec/unit/relationship_spec.rb +++ b/spec/unit/relationship_spec.rb @@ -3,7 +3,7 @@ # Created by Luke Kanies on 2007-11-1. # Copyright (c) 2006. All rights reserved. -require File.expand_path(File.dirname(__FILE__) + '/../spec_helper') +require 'spec_helper' require 'puppet/relationship' describe Puppet::Relationship do diff --git a/spec/unit/reports/http_spec.rb b/spec/unit/reports/http_spec.rb index a62793ed5..acf0c045c 100644..100755 --- a/spec/unit/reports/http_spec.rb +++ b/spec/unit/reports/http_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') +require 'spec_helper' require 'puppet/reports' diff --git a/spec/unit/reports/rrdgraph_spec.rb b/spec/unit/reports/rrdgraph_spec.rb index 5215f1dcc..1443b53e0 100644..100755 --- a/spec/unit/reports/rrdgraph_spec.rb +++ b/spec/unit/reports/rrdgraph_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') +require 'spec_helper' require 'puppet/reports' diff --git a/spec/unit/reports/store_spec.rb b/spec/unit/reports/store_spec.rb index d48f6a846..659940aa1 100644..100755 --- a/spec/unit/reports/store_spec.rb +++ b/spec/unit/reports/store_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') +require 'spec_helper' require 'puppet/reports' require 'time' diff --git a/spec/unit/reports/tagmail_spec.rb b/spec/unit/reports/tagmail_spec.rb index 716bcbc04..9d67e7acb 100755 --- a/spec/unit/reports/tagmail_spec.rb +++ b/spec/unit/reports/tagmail_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') +require 'spec_helper' require 'puppet/reports' diff --git a/spec/unit/reports_spec.rb b/spec/unit/reports_spec.rb index a9d10be17..52608aeb3 100755 --- a/spec/unit/reports_spec.rb +++ b/spec/unit/reports_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../spec_helper') +require 'spec_helper' require 'puppet/reports' diff --git a/spec/unit/resource/catalog_spec.rb b/spec/unit/resource/catalog_spec.rb index 78d1b3223..59073c351 100755 --- a/spec/unit/resource/catalog_spec.rb +++ b/spec/unit/resource/catalog_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') +require 'spec_helper' describe Puppet::Resource::Catalog, "when compiling" do diff --git a/spec/unit/resource/status_spec.rb b/spec/unit/resource/status_spec.rb index 343b8d318..d9bb2755d 100755 --- a/spec/unit/resource/status_spec.rb +++ b/spec/unit/resource/status_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') +require 'spec_helper' require 'puppet/resource/status' diff --git a/spec/unit/resource/type_collection_helper_spec.rb b/spec/unit/resource/type_collection_helper_spec.rb index 442cfd076..9bfba008f 100644..100755 --- a/spec/unit/resource/type_collection_helper_spec.rb +++ b/spec/unit/resource/type_collection_helper_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') +require 'spec_helper' require 'puppet/resource/type_collection_helper' diff --git a/spec/unit/resource/type_collection_spec.rb b/spec/unit/resource/type_collection_spec.rb index 278e629bd..914d9fbba 100644..100755 --- a/spec/unit/resource/type_collection_spec.rb +++ b/spec/unit/resource/type_collection_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') +require 'spec_helper' require 'puppet/resource/type_collection' require 'puppet/resource/type' diff --git a/spec/unit/resource/type_spec.rb b/spec/unit/resource/type_spec.rb index 41b5554d9..b6a5f6982 100755 --- a/spec/unit/resource/type_spec.rb +++ b/spec/unit/resource/type_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') +require 'spec_helper' require 'puppet/resource/type' diff --git a/spec/unit/resource_spec.rb b/spec/unit/resource_spec.rb index 916741d1a..1b1839981 100755 --- a/spec/unit/resource_spec.rb +++ b/spec/unit/resource_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../spec_helper') +require 'spec_helper' require 'puppet/resource' describe Puppet::Resource do diff --git a/spec/unit/run_spec.rb b/spec/unit/run_spec.rb index 6c5ecde65..d9a5690cb 100755 --- a/spec/unit/run_spec.rb +++ b/spec/unit/run_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../spec_helper') +require 'spec_helper' require 'puppet/agent' require 'puppet/run' diff --git a/spec/unit/simple_graph_spec.rb b/spec/unit/simple_graph_spec.rb index 99db2a55c..38d37c2e2 100755 --- a/spec/unit/simple_graph_spec.rb +++ b/spec/unit/simple_graph_spec.rb @@ -3,7 +3,7 @@ # Created by Luke Kanies on 2007-11-1. # Copyright (c) 2006. All rights reserved. -require File.expand_path(File.dirname(__FILE__) + '/../spec_helper') +require 'spec_helper' require 'puppet/simple_graph' describe Puppet::SimpleGraph do diff --git a/spec/unit/ssl/base_spec.rb b/spec/unit/ssl/base_spec.rb index 99038391f..263a3b9be 100755 --- a/spec/unit/ssl/base_spec.rb +++ b/spec/unit/ssl/base_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') +require 'spec_helper' require 'puppet/ssl/certificate' @@ -40,4 +40,4 @@ describe Puppet::SSL::Certificate do @base.fingerprint(:digest).should == "DI:GE:ST" end end -end
\ No newline at end of file +end diff --git a/spec/unit/ssl/certificate_authority/interface_spec.rb b/spec/unit/ssl/certificate_authority/interface_spec.rb index 2e4a3fc77..3e3f261e0 100755 --- a/spec/unit/ssl/certificate_authority/interface_spec.rb +++ b/spec/unit/ssl/certificate_authority/interface_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') +require 'spec_helper' require 'puppet/ssl/certificate_authority' diff --git a/spec/unit/ssl/certificate_authority_spec.rb b/spec/unit/ssl/certificate_authority_spec.rb index 76633b48f..518b4be4d 100755 --- a/spec/unit/ssl/certificate_authority_spec.rb +++ b/spec/unit/ssl/certificate_authority_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') +require 'spec_helper' require 'puppet/ssl/certificate_authority' diff --git a/spec/unit/ssl/certificate_factory_spec.rb b/spec/unit/ssl/certificate_factory_spec.rb index c2bcb19ce..7f305f768 100755 --- a/spec/unit/ssl/certificate_factory_spec.rb +++ b/spec/unit/ssl/certificate_factory_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') +require 'spec_helper' require 'puppet/ssl/certificate_factory' diff --git a/spec/unit/ssl/certificate_request_spec.rb b/spec/unit/ssl/certificate_request_spec.rb index 32c9cb51d..3a2e7f4d8 100755 --- a/spec/unit/ssl/certificate_request_spec.rb +++ b/spec/unit/ssl/certificate_request_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') +require 'spec_helper' require 'puppet/ssl/certificate_request' require 'puppet/ssl/key' diff --git a/spec/unit/ssl/certificate_revocation_list_spec.rb b/spec/unit/ssl/certificate_revocation_list_spec.rb index e83ad9cc5..e84208c5a 100755 --- a/spec/unit/ssl/certificate_revocation_list_spec.rb +++ b/spec/unit/ssl/certificate_revocation_list_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') +require 'spec_helper' require 'puppet/ssl/certificate_revocation_list' diff --git a/spec/unit/ssl/certificate_spec.rb b/spec/unit/ssl/certificate_spec.rb index b3af9f236..afee70999 100755 --- a/spec/unit/ssl/certificate_spec.rb +++ b/spec/unit/ssl/certificate_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') +require 'spec_helper' require 'puppet/ssl/certificate' diff --git a/spec/unit/ssl/host_spec.rb b/spec/unit/ssl/host_spec.rb index 885bd45e2..be53f5f8f 100755 --- a/spec/unit/ssl/host_spec.rb +++ b/spec/unit/ssl/host_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') +require 'spec_helper' require 'puppet/ssl/host' require 'puppet/sslcertificates' diff --git a/spec/unit/ssl/inventory_spec.rb b/spec/unit/ssl/inventory_spec.rb index 4d47a37c6..613f420a9 100755 --- a/spec/unit/ssl/inventory_spec.rb +++ b/spec/unit/ssl/inventory_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') +require 'spec_helper' require 'puppet/ssl/inventory' diff --git a/spec/unit/ssl/key_spec.rb b/spec/unit/ssl/key_spec.rb index e0667a5cc..aabc92c6d 100755 --- a/spec/unit/ssl/key_spec.rb +++ b/spec/unit/ssl/key_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') +require 'spec_helper' require 'puppet/ssl/key' diff --git a/spec/unit/sslcertificates/ca_spec.rb b/spec/unit/sslcertificates/ca_spec.rb index 4e44f2d90..46cdbd0e9 100644..100755 --- a/spec/unit/sslcertificates/ca_spec.rb +++ b/spec/unit/sslcertificates/ca_spec.rb @@ -1,5 +1,5 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') +require 'spec_helper' require 'puppet' require 'puppet/sslcertificates' diff --git a/spec/unit/status_spec.rb b/spec/unit/status_spec.rb index 3a9c805b3..4e8f551bc 100644..100755 --- a/spec/unit/status_spec.rb +++ b/spec/unit/status_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../spec_helper') +require 'spec_helper' describe Puppet::Status do it "should implement find" do diff --git a/spec/unit/transaction/event_manager_spec.rb b/spec/unit/transaction/event_manager_spec.rb index e45fbdf78..378948ebc 100755 --- a/spec/unit/transaction/event_manager_spec.rb +++ b/spec/unit/transaction/event_manager_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') +require 'spec_helper' require 'puppet/transaction/event_manager' diff --git a/spec/unit/transaction/event_spec.rb b/spec/unit/transaction/event_spec.rb index c77716cd6..115c30dc0 100755 --- a/spec/unit/transaction/event_spec.rb +++ b/spec/unit/transaction/event_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') +require 'spec_helper' require 'puppet/transaction/event' diff --git a/spec/unit/transaction/report_spec.rb b/spec/unit/transaction/report_spec.rb index e7bfce401..07ac62415 100755 --- a/spec/unit/transaction/report_spec.rb +++ b/spec/unit/transaction/report_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') +require 'spec_helper' require 'puppet/transaction/report' diff --git a/spec/unit/transaction/resource_harness_spec.rb b/spec/unit/transaction/resource_harness_spec.rb index 168b50287..d7b873c6b 100755 --- a/spec/unit/transaction/resource_harness_spec.rb +++ b/spec/unit/transaction/resource_harness_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') +require 'spec_helper' require 'puppet/transaction/resource_harness' diff --git a/spec/unit/transaction_spec.rb b/spec/unit/transaction_spec.rb index ab76130e3..baeab14af 100755 --- a/spec/unit/transaction_spec.rb +++ b/spec/unit/transaction_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../spec_helper') +require 'spec_helper' require 'puppet/transaction' diff --git a/spec/unit/type/augeas_spec.rb b/spec/unit/type/augeas_spec.rb index dece395e1..896c66587 100644..100755 --- a/spec/unit/type/augeas_spec.rb +++ b/spec/unit/type/augeas_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') +require 'spec_helper' augeas = Puppet::Type.type(:augeas) diff --git a/spec/unit/type/component_spec.rb b/spec/unit/type/component_spec.rb index 60abfafbf..193d82fcc 100755 --- a/spec/unit/type/component_spec.rb +++ b/spec/unit/type/component_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') +require 'spec_helper' component = Puppet::Type.type(:component) diff --git a/spec/unit/type/computer_spec.rb b/spec/unit/type/computer_spec.rb index 3177884f7..9bce5106c 100755 --- a/spec/unit/type/computer_spec.rb +++ b/spec/unit/type/computer_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') +require 'spec_helper' computer = Puppet::Type.type(:computer) diff --git a/spec/unit/type/cron_spec.rb b/spec/unit/type/cron_spec.rb index 5466b4d58..75cc0d484 100755 --- a/spec/unit/type/cron_spec.rb +++ b/spec/unit/type/cron_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') +require 'spec_helper' describe Puppet::Type.type(:cron) do before do diff --git a/spec/unit/type/exec_spec.rb b/spec/unit/type/exec_spec.rb index 86b824423..42c79e737 100755 --- a/spec/unit/type/exec_spec.rb +++ b/spec/unit/type/exec_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') +require 'spec_helper' describe Puppet::Type.type(:exec) do def exec_tester(command, exitstatus = 0, rest = {}) diff --git a/spec/unit/type/file/checksum_spec.rb b/spec/unit/type/file/checksum_spec.rb index 16e8e99e1..d4b0382ce 100644..100755 --- a/spec/unit/type/file/checksum_spec.rb +++ b/spec/unit/type/file/checksum_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') +require 'spec_helper' checksum = Puppet::Type.type(:file).attrclass(:checksum) describe checksum do diff --git a/spec/unit/type/file/content_spec.rb b/spec/unit/type/file/content_spec.rb index 7abc7c433..a63437768 100755 --- a/spec/unit/type/file/content_spec.rb +++ b/spec/unit/type/file/content_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') +require 'spec_helper' content = Puppet::Type.type(:file).attrclass(:content) describe content do diff --git a/spec/unit/type/file/ctime.rb b/spec/unit/type/file/ctime.rb index 9fb892aed..72a10b568 100644..100755 --- a/spec/unit/type/file/ctime.rb +++ b/spec/unit/type/file/ctime.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') +require 'spec_helper' describe Puppet::Type.type(:file).attrclass(:ctime) do require 'puppet_spec/files' diff --git a/spec/unit/type/file/ensure_spec.rb b/spec/unit/type/file/ensure_spec.rb index c5351309e..5f51bdcc0 100755 --- a/spec/unit/type/file/ensure_spec.rb +++ b/spec/unit/type/file/ensure_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') +require 'spec_helper' property = Puppet::Type.type(:file).attrclass(:ensure) diff --git a/spec/unit/type/file/group_spec.rb b/spec/unit/type/file/group_spec.rb index 37a6872bd..7aeb4f7eb 100755 --- a/spec/unit/type/file/group_spec.rb +++ b/spec/unit/type/file/group_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') +require 'spec_helper' property = Puppet::Type.type(:file).attrclass(:group) diff --git a/spec/unit/type/file/mtime.rb b/spec/unit/type/file/mtime.rb index fa61bc343..f00692f5e 100644..100755 --- a/spec/unit/type/file/mtime.rb +++ b/spec/unit/type/file/mtime.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') +require 'spec_helper' describe Puppet::Type.type(:file).attrclass(:mtime) do require 'puppet_spec/files' diff --git a/spec/unit/type/file/owner_spec.rb b/spec/unit/type/file/owner_spec.rb index 375faa237..bf99a99e7 100755 --- a/spec/unit/type/file/owner_spec.rb +++ b/spec/unit/type/file/owner_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') +require 'spec_helper' property = Puppet::Type.type(:file).attrclass(:owner) diff --git a/spec/unit/type/file/selinux_spec.rb b/spec/unit/type/file/selinux_spec.rb index 45e8b3b14..27a0e5863 100644..100755 --- a/spec/unit/type/file/selinux_spec.rb +++ b/spec/unit/type/file/selinux_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') +require 'spec_helper' [:seluser, :selrole, :seltype, :selrange].each do |param| diff --git a/spec/unit/type/file/source_spec.rb b/spec/unit/type/file/source_spec.rb index bb83e7531..95a3618a2 100755 --- a/spec/unit/type/file/source_spec.rb +++ b/spec/unit/type/file/source_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') +require 'spec_helper' source = Puppet::Type.type(:file).attrclass(:source) describe Puppet::Type.type(:file).attrclass(:source) do diff --git a/spec/unit/type/file/type.rb b/spec/unit/type/file/type.rb index 0d38b64cd..26ec3b5cd 100644..100755 --- a/spec/unit/type/file/type.rb +++ b/spec/unit/type/file/type.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') +require 'spec_helper' describe Puppet::Type.type(:file).attrclass(:type) do require 'puppet_spec/files' diff --git a/spec/unit/type/file_spec.rb b/spec/unit/type/file_spec.rb index b15d41d4b..d0b60e01b 100755 --- a/spec/unit/type/file_spec.rb +++ b/spec/unit/type/file_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') +require 'spec_helper' describe Puppet::Type.type(:file) do before do diff --git a/spec/unit/type/filebucket_spec.rb b/spec/unit/type/filebucket_spec.rb index 7fcbacc4f..f13fb00a5 100644..100755 --- a/spec/unit/type/filebucket_spec.rb +++ b/spec/unit/type/filebucket_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') +require 'spec_helper' describe Puppet::Type.type(:filebucket) do describe "when validating attributes" do diff --git a/spec/unit/type/group_spec.rb b/spec/unit/type/group_spec.rb index 43fdfcd4d..a16f35925 100755 --- a/spec/unit/type/group_spec.rb +++ b/spec/unit/type/group_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') +require 'spec_helper' describe Puppet::Type.type(:group) do before do diff --git a/spec/unit/type/host_spec.rb b/spec/unit/type/host_spec.rb index 60ce73c6d..b0d5a16e3 100755 --- a/spec/unit/type/host_spec.rb +++ b/spec/unit/type/host_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') +require 'spec_helper' host = Puppet::Type.type(:host) diff --git a/spec/unit/type/interface_spec.rb b/spec/unit/type/interface_spec.rb new file mode 100644 index 000000000..630e45aa9 --- /dev/null +++ b/spec/unit/type/interface_spec.rb @@ -0,0 +1,93 @@ +#!/usr/bin/env ruby + +require File.dirname(__FILE__) + '/../../spec_helper' + +describe Puppet::Type.type(:interface) do + it "should have a 'name' parameter'" do + Puppet::Type.type(:interface).new(:name => "FastEthernet 0/1")[:name].should == "FastEthernet 0/1" + end + + it "should have a 'device_url' parameter'" do + Puppet::Type.type(:interface).new(:name => "FastEthernet 0/1", :device_url => :device)[:device_url].should == :device + end + + it "should have an ensure property" do + Puppet::Type.type(:interface).attrtype(:ensure).should == :property + end + + [:description, :speed, :duplex, :native_vlan, :encapsulation, :mode, :allowed_trunk_vlans, :etherchannel, :ipaddress].each do |p| + it "should have a #{p} property" do + Puppet::Type.type(:interface).attrtype(p).should == :property + end + end + + describe "when validating attribute values" do + before do + @provider = stub 'provider', :class => Puppet::Type.type(:interface).defaultprovider, :clear => nil + Puppet::Type.type(:interface).defaultprovider.stubs(:new).returns(@provider) + end + + it "should support :present as a value to :ensure" do + Puppet::Type.type(:interface).new(:name => "FastEthernet 0/1", :ensure => :present) + end + + it "should support :shutdown as a value to :ensure" do + Puppet::Type.type(:interface).new(:name => "FastEthernet 0/1", :ensure => :shutdown) + end + + it "should support :no_shutdown as a value to :ensure" do + Puppet::Type.type(:interface).new(:name => "FastEthernet 0/1", :ensure => :no_shutdown) + end + + describe "especially speed" do + it "should allow a number" do + Puppet::Type.type(:interface).new(:name => "FastEthernet 0/1", :speed => "100") + end + + it "should allow :auto" do + Puppet::Type.type(:interface).new(:name => "FastEthernet 0/1", :speed => :auto) + end + end + + describe "especially duplex" do + it "should allow :half" do + Puppet::Type.type(:interface).new(:name => "FastEthernet 0/1", :duplex => :half) + end + + it "should allow :full" do + Puppet::Type.type(:interface).new(:name => "FastEthernet 0/1", :duplex => :full) + end + + it "should allow :auto" do + Puppet::Type.type(:interface).new(:name => "FastEthernet 0/1", :duplex => :auto) + end + end + + describe "especially ipaddress" do + it "should allow ipv4 addresses" do + Puppet::Type.type(:interface).new(:name => "FastEthernet 0/1", :ipaddress => "192.168.0.1/24") + end + + it "should allow arrays of ipv4 addresses" do + Puppet::Type.type(:interface).new(:name => "FastEthernet 0/1", :ipaddress => ["192.168.0.1/24", "192.168.1.0/24"]) + end + + it "should allow ipv6 addresses" do + Puppet::Type.type(:interface).new(:name => "FastEthernet 0/1", :ipaddress => "f0e9::/64") + end + + it "should allow ipv6 options" do + Puppet::Type.type(:interface).new(:name => "FastEthernet 0/1", :ipaddress => "f0e9::/64 link-local") + Puppet::Type.type(:interface).new(:name => "FastEthernet 0/1", :ipaddress => "f0e9::/64 eui-64") + end + + it "should allow a mix of ipv4 and ipv6" do + Puppet::Type.type(:interface).new(:name => "FastEthernet 0/1", :ipaddress => ["192.168.0.1/24", "f0e9::/64 link-local"]) + end + + it "should munge ip addresses to a computer format" do + Puppet::Type.type(:interface).new(:name => "FastEthernet 0/1", :ipaddress => "192.168.0.1/24")[:ipaddress].should == [[24, IPAddr.new('192.168.0.1'), nil]] + end + end + end +end diff --git a/spec/unit/type/macauthorization_spec.rb b/spec/unit/type/macauthorization_spec.rb index e0d3b9433..01a78f196 100755 --- a/spec/unit/type/macauthorization_spec.rb +++ b/spec/unit/type/macauthorization_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') +require 'spec_helper' macauth_type = Puppet::Type.type(:macauthorization) diff --git a/spec/unit/type/maillist_spec.rb b/spec/unit/type/maillist_spec.rb index 7e96b4760..8427f5306 100755 --- a/spec/unit/type/maillist_spec.rb +++ b/spec/unit/type/maillist_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') +require 'spec_helper' maillist = Puppet::Type.type(:maillist) diff --git a/spec/unit/type/mcx_spec.rb b/spec/unit/type/mcx_spec.rb index 4b60a5c96..b35355a29 100755 --- a/spec/unit/type/mcx_spec.rb +++ b/spec/unit/type/mcx_spec.rb @@ -1,26 +1,6 @@ #!/usr/bin/env ruby -#-- -# Copyright (C) 2008 Jeffrey J McCune. -# This program and entire repository is free software; you can -# redistribute it and/or modify it under the terms of the GNU -# General Public License as published by the Free Software -# Foundation; either version 2 of the License, or any later version. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - -# Author: Jeff McCune <mccune.jeff@gmail.com> - -# Most of this code copied from /spec/type/service.rb - -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') +require 'spec_helper' require 'puppet/type/mcx' diff --git a/spec/unit/type/mount_spec.rb b/spec/unit/type/mount_spec.rb index 4638e9a2e..5bcc438fd 100755 --- a/spec/unit/type/mount_spec.rb +++ b/spec/unit/type/mount_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') +require 'spec_helper' describe Puppet::Type.type(:mount) do it "should have a :refreshable feature that requires the :remount method" do diff --git a/spec/unit/type/nagios_spec.rb b/spec/unit/type/nagios_spec.rb index 1515c2ae9..63122b2c9 100755 --- a/spec/unit/type/nagios_spec.rb +++ b/spec/unit/type/nagios_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') +require 'spec_helper' require 'puppet/external/nagios' diff --git a/spec/unit/type/noop_metaparam_spec.rb b/spec/unit/type/noop_metaparam_spec.rb index 6f8f87e6c..5c1a9853a 100755 --- a/spec/unit/type/noop_metaparam_spec.rb +++ b/spec/unit/type/noop_metaparam_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') +require 'spec_helper' require 'puppet/type' diff --git a/spec/unit/type/package_spec.rb b/spec/unit/type/package_spec.rb index 3db9c77be..f3b9e6ac5 100755 --- a/spec/unit/type/package_spec.rb +++ b/spec/unit/type/package_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') +require 'spec_helper' describe Puppet::Type.type(:package) do before do diff --git a/spec/unit/type/resources_spec.rb b/spec/unit/type/resources_spec.rb index 020ab9b81..9e1f09588 100644..100755 --- a/spec/unit/type/resources_spec.rb +++ b/spec/unit/type/resources_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') +require 'spec_helper' resources = Puppet::Type.type(:resources) diff --git a/spec/unit/type/schedule_spec.rb b/spec/unit/type/schedule_spec.rb index 59d199812..c4189d410 100755 --- a/spec/unit/type/schedule_spec.rb +++ b/spec/unit/type/schedule_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') +require 'spec_helper' module ScheduleTesting diff --git a/spec/unit/type/selboolean_spec.rb b/spec/unit/type/selboolean_spec.rb index 41b254f25..a64724432 100755 --- a/spec/unit/type/selboolean_spec.rb +++ b/spec/unit/type/selboolean_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') +require 'spec_helper' describe Puppet::Type.type(:selboolean), "when validating attributes" do [:name, :persistent].each do |param| diff --git a/spec/unit/type/selmodule_spec.rb b/spec/unit/type/selmodule_spec.rb index 37453d8ed..a9e193f3e 100755 --- a/spec/unit/type/selmodule_spec.rb +++ b/spec/unit/type/selmodule_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') +require 'spec_helper' describe Puppet::Type.type(:selmodule), "when validating attributes" do [:name, :selmoduledir, :selmodulepath].each do |param| diff --git a/spec/unit/type/service_spec.rb b/spec/unit/type/service_spec.rb index b11c4d7e7..3391f704c 100755 --- a/spec/unit/type/service_spec.rb +++ b/spec/unit/type/service_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') +require 'spec_helper' describe Puppet::Type.type(:service) do it "should have an :enableable feature that requires the :enable, :disable, and :enabled? methods" do diff --git a/spec/unit/type/ssh_authorized_key_spec.rb b/spec/unit/type/ssh_authorized_key_spec.rb index 287fca3ab..7cbf44c28 100755 --- a/spec/unit/type/ssh_authorized_key_spec.rb +++ b/spec/unit/type/ssh_authorized_key_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') +require 'spec_helper' ssh_authorized_key = Puppet::Type.type(:ssh_authorized_key) diff --git a/spec/unit/type/sshkey_spec.rb b/spec/unit/type/sshkey_spec.rb index 8315d7ba9..d476e1908 100644..100755 --- a/spec/unit/type/sshkey_spec.rb +++ b/spec/unit/type/sshkey_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') +require 'spec_helper' sshkey = Puppet::Type.type(:sshkey) diff --git a/spec/unit/type/stage_spec.rb b/spec/unit/type/stage_spec.rb index 19922f112..a43e4bffc 100644..100755 --- a/spec/unit/type/stage_spec.rb +++ b/spec/unit/type/stage_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') +require 'spec_helper' describe Puppet::Type.type(:stage) do it "should have a 'name' parameter'" do diff --git a/spec/unit/type/tidy_spec.rb b/spec/unit/type/tidy_spec.rb index 56bdf6c19..dec1e189c 100755 --- a/spec/unit/type/tidy_spec.rb +++ b/spec/unit/type/tidy_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') +require 'spec_helper' require 'puppet/file_bucket/dipper' tidy = Puppet::Type.type(:tidy) diff --git a/spec/unit/type/user_spec.rb b/spec/unit/type/user_spec.rb index 6421e6049..92c88abfb 100755 --- a/spec/unit/type/user_spec.rb +++ b/spec/unit/type/user_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') +require 'spec_helper' user = Puppet::Type.type(:user) diff --git a/spec/unit/type/vlan_spec.rb b/spec/unit/type/vlan_spec.rb new file mode 100644 index 000000000..607d7116d --- /dev/null +++ b/spec/unit/type/vlan_spec.rb @@ -0,0 +1,40 @@ +#!/usr/bin/env ruby + +require File.dirname(__FILE__) + '/../../spec_helper' + +describe Puppet::Type.type(:vlan) do + it "should have a 'name' parameter'" do + Puppet::Type.type(:vlan).new(:name => "200")[:name].should == "200" + end + + it "should have a 'device_url' parameter'" do + Puppet::Type.type(:vlan).new(:name => "200", :device_url => :device)[:device_url].should == :device + end + + it "should have an ensure property" do + Puppet::Type.type(:vlan).attrtype(:ensure).should == :property + end + + it "should have a description property" do + Puppet::Type.type(:vlan).attrtype(:description).should == :property + end + + describe "when validating attribute values" do + before do + @provider = stub 'provider', :class => Puppet::Type.type(:vlan).defaultprovider, :clear => nil + Puppet::Type.type(:vlan).defaultprovider.stubs(:new).returns(@provider) + end + + it "should support :present as a value to :ensure" do + Puppet::Type.type(:vlan).new(:name => "200", :ensure => :present) + end + + it "should support :absent as a value to :ensure" do + Puppet::Type.type(:vlan).new(:name => "200", :ensure => :absent) + end + + it "should fail if vlan name is not a number" do + lambda { Puppet::Type.type(:vlan).new(:name => "notanumber", :ensure => :present) }.should raise_error + end + end +end diff --git a/spec/unit/type/whit_spec.rb b/spec/unit/type/whit_spec.rb index 0a3324afa..cc5365ed6 100644..100755 --- a/spec/unit/type/whit_spec.rb +++ b/spec/unit/type/whit_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') +require 'spec_helper' whit = Puppet::Type.type(:whit).new(:name => "Foo::Bar") diff --git a/spec/unit/type/zfs_spec.rb b/spec/unit/type/zfs_spec.rb index 88193fca3..a08de574f 100755 --- a/spec/unit/type/zfs_spec.rb +++ b/spec/unit/type/zfs_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') +require 'spec_helper' zfs = Puppet::Type.type(:zfs) diff --git a/spec/unit/type/zone_spec.rb b/spec/unit/type/zone_spec.rb index e479fb1e9..5c7a760e1 100755 --- a/spec/unit/type/zone_spec.rb +++ b/spec/unit/type/zone_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') +require 'spec_helper' zone = Puppet::Type.type(:zone) diff --git a/spec/unit/type/zpool_spec.rb b/spec/unit/type/zpool_spec.rb index 96e7d548c..21a5ba0c6 100755 --- a/spec/unit/type/zpool_spec.rb +++ b/spec/unit/type/zpool_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') +require 'spec_helper' zpool = Puppet::Type.type(:zpool) diff --git a/spec/unit/type_spec.rb b/spec/unit/type_spec.rb index f9372fced..9859c5e08 100755 --- a/spec/unit/type_spec.rb +++ b/spec/unit/type_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../spec_helper') +require 'spec_helper' describe Puppet::Type do it "should include the Cacher module" do diff --git a/spec/unit/util/autoload/file_cache_spec.rb b/spec/unit/util/autoload/file_cache_spec.rb index 5ad820e4c..97ca4912d 100755 --- a/spec/unit/util/autoload/file_cache_spec.rb +++ b/spec/unit/util/autoload/file_cache_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') +require 'spec_helper' require 'puppet/util/autoload/file_cache' class FileCacheTester diff --git a/spec/unit/util/autoload_spec.rb b/spec/unit/util/autoload_spec.rb index 808885dd7..59a491ba8 100755 --- a/spec/unit/util/autoload_spec.rb +++ b/spec/unit/util/autoload_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') +require 'spec_helper' require 'puppet/util/autoload' diff --git a/spec/unit/util/backups_spec.rb b/spec/unit/util/backups_spec.rb index 3d707a58c..c580a4588 100755 --- a/spec/unit/util/backups_spec.rb +++ b/spec/unit/util/backups_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') +require 'spec_helper' require 'puppet/util/backups' diff --git a/spec/unit/util/cache_accumulator_spec.rb b/spec/unit/util/cache_accumulator_spec.rb index 4ed9abf5c..f4741c530 100644..100755 --- a/spec/unit/util/cache_accumulator_spec.rb +++ b/spec/unit/util/cache_accumulator_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') +require 'spec_helper' require 'puppet/util/rails/cache_accumulator' describe Puppet::Util::CacheAccumulator do diff --git a/spec/unit/util/cacher_spec.rb b/spec/unit/util/cacher_spec.rb index 125382e84..890960693 100755 --- a/spec/unit/util/cacher_spec.rb +++ b/spec/unit/util/cacher_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') +require 'spec_helper' require 'puppet/util/cacher' diff --git a/spec/unit/util/checksums_spec.rb b/spec/unit/util/checksums_spec.rb index 954dc650b..4e7bc9d18 100755 --- a/spec/unit/util/checksums_spec.rb +++ b/spec/unit/util/checksums_spec.rb @@ -3,7 +3,7 @@ # Created by Luke Kanies on 2007-9-22. # Copyright (c) 2007. All rights reserved. -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') +require 'spec_helper' require 'puppet/util/checksums' diff --git a/spec/unit/util/command_line_spec.rb b/spec/unit/util/command_line_spec.rb index a7d261dcf..ca5f0540f 100755 --- a/spec/unit/util/command_line_spec.rb +++ b/spec/unit/util/command_line_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') +require 'spec_helper' require 'puppet/util/command_line' diff --git a/spec/unit/util/constant_inflector_spec.rb b/spec/unit/util/constant_inflector_spec.rb index 29574fd5b..20283cb59 100755 --- a/spec/unit/util/constant_inflector_spec.rb +++ b/spec/unit/util/constant_inflector_spec.rb @@ -3,7 +3,7 @@ # Created by Luke Kanies on 2008-02-12. # Copyright (c) 2007. All rights reserved. -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') +require 'spec_helper' require 'puppet/util/constant_inflector' diff --git a/spec/unit/util/errors_spec.rb b/spec/unit/util/errors_spec.rb index da1b8b0bd..9b4984ce3 100755 --- a/spec/unit/util/errors_spec.rb +++ b/spec/unit/util/errors_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') +require 'spec_helper' require 'puppet/util/errors' diff --git a/spec/unit/util/execution_spec.rb b/spec/unit/util/execution_spec.rb index 312dd3b8e..337a05ffe 100644..100755 --- a/spec/unit/util/execution_spec.rb +++ b/spec/unit/util/execution_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../spec_helper' +require 'spec_helper' describe Puppet::Util::Execution do include Puppet::Util::Execution diff --git a/spec/unit/util/execution_stub_spec.rb b/spec/unit/util/execution_stub_spec.rb index 14cf9c67a..2a478f008 100644..100755 --- a/spec/unit/util/execution_stub_spec.rb +++ b/spec/unit/util/execution_stub_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../spec_helper' +require 'spec_helper' describe Puppet::Util::ExecutionStub do it "should use the provided stub code when 'set' is called" do diff --git a/spec/unit/util/feature_spec.rb b/spec/unit/util/feature_spec.rb index 365428752..e7632fc4d 100755 --- a/spec/unit/util/feature_spec.rb +++ b/spec/unit/util/feature_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') +require 'spec_helper' require 'puppet/util/feature' diff --git a/spec/unit/util/file_locking_spec.rb b/spec/unit/util/file_locking_spec.rb index e9dbe9d7b..32712429f 100755 --- a/spec/unit/util/file_locking_spec.rb +++ b/spec/unit/util/file_locking_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') +require 'spec_helper' require 'puppet/util/file_locking' diff --git a/spec/unit/util/filetype_spec.rb b/spec/unit/util/filetype_spec.rb index 012631b91..492691e0b 100644..100755 --- a/spec/unit/util/filetype_spec.rb +++ b/spec/unit/util/filetype_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') +require 'spec_helper' require 'puppet/util/filetype' diff --git a/spec/unit/util/inline_docs_spec.rb b/spec/unit/util/inline_docs_spec.rb index 75afb57cb..3baecc426 100755 --- a/spec/unit/util/inline_docs_spec.rb +++ b/spec/unit/util/inline_docs_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') +require 'spec_helper' require 'puppet/util/inline_docs' diff --git a/spec/unit/util/ldap/connection_spec.rb b/spec/unit/util/ldap/connection_spec.rb index 91f008a2e..3fb5e388e 100755 --- a/spec/unit/util/ldap/connection_spec.rb +++ b/spec/unit/util/ldap/connection_spec.rb @@ -3,7 +3,7 @@ # Created by Luke Kanies on 2008-3-19. # Copyright (c) 2006. All rights reserved. -require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') +require 'spec_helper' require 'puppet/util/ldap/connection' diff --git a/spec/unit/util/ldap/generator_spec.rb b/spec/unit/util/ldap/generator_spec.rb index 59c05b7c7..7c820759f 100755 --- a/spec/unit/util/ldap/generator_spec.rb +++ b/spec/unit/util/ldap/generator_spec.rb @@ -3,7 +3,7 @@ # Created by Luke Kanies on 2008-3-28. # Copyright (c) 2008. All rights reserved. -require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') +require 'spec_helper' require 'puppet/util/ldap/generator' diff --git a/spec/unit/util/ldap/manager_spec.rb b/spec/unit/util/ldap/manager_spec.rb index e91582c8d..a1b3f01ea 100755 --- a/spec/unit/util/ldap/manager_spec.rb +++ b/spec/unit/util/ldap/manager_spec.rb @@ -3,7 +3,7 @@ # Created by Luke Kanies on 2008-3-19. # Copyright (c) 2006. All rights reserved. -require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') +require 'spec_helper' require 'puppet/util/ldap/manager' diff --git a/spec/unit/util/loadedfile_spec.rb b/spec/unit/util/loadedfile_spec.rb index 92daeb953..6b6949b2f 100755 --- a/spec/unit/util/loadedfile_spec.rb +++ b/spec/unit/util/loadedfile_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') +require 'spec_helper' require 'tempfile' require 'puppet/util/loadedfile' diff --git a/spec/unit/util/log/destinations_spec.rb b/spec/unit/util/log/destinations_spec.rb index b84c2ab44..a05736980 100755 --- a/spec/unit/util/log/destinations_spec.rb +++ b/spec/unit/util/log/destinations_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') +require 'spec_helper' require 'puppet/util/log' diff --git a/spec/unit/util/log_spec.rb b/spec/unit/util/log_spec.rb index 3c8577493..9eacf58ae 100755 --- a/spec/unit/util/log_spec.rb +++ b/spec/unit/util/log_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') +require 'spec_helper' require 'puppet/util/log' diff --git a/spec/unit/util/logging_spec.rb b/spec/unit/util/logging_spec.rb index 97ffc0b25..edc88f115 100755 --- a/spec/unit/util/logging_spec.rb +++ b/spec/unit/util/logging_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') +require 'spec_helper' require 'puppet/util/logging' diff --git a/spec/unit/util/metric_spec.rb b/spec/unit/util/metric_spec.rb index 425812297..b0d320478 100755 --- a/spec/unit/util/metric_spec.rb +++ b/spec/unit/util/metric_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') +require 'spec_helper' require 'puppet/util/metric' diff --git a/spec/unit/util/monkey_patches_spec.rb b/spec/unit/util/monkey_patches_spec.rb index fb2103ea9..4ff6438ce 100644..100755 --- a/spec/unit/util/monkey_patches_spec.rb +++ b/spec/unit/util/monkey_patches_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') +require 'spec_helper' require 'puppet/util/monkey_patches' diff --git a/spec/unit/util/nagios_maker_spec.rb b/spec/unit/util/nagios_maker_spec.rb index 20582525d..7245cc3fc 100755 --- a/spec/unit/util/nagios_maker_spec.rb +++ b/spec/unit/util/nagios_maker_spec.rb @@ -3,7 +3,7 @@ # Created by Luke Kanies on 2007-11-18. # Copyright (c) 2007. All rights reserved. -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') +require 'spec_helper' require 'puppet/util/nagios_maker' diff --git a/spec/unit/util/network_device/cisco/device_spec.rb b/spec/unit/util/network_device/cisco/device_spec.rb new file mode 100644 index 000000000..31aec920e --- /dev/null +++ b/spec/unit/util/network_device/cisco/device_spec.rb @@ -0,0 +1,521 @@ +#!/usr/bin/env ruby + +require File.dirname(__FILE__) + '/../../../../spec_helper' + +require 'puppet/util/network_device/cisco/device' + +describe Puppet::Util::NetworkDevice::Cisco::Device do + before(:each) do + @transport = stub_everything 'transport', :is_a? => true, :command => "" + @cisco = Puppet::Util::NetworkDevice::Cisco::Device.new("telnet://user:password@localhost:23/") + @cisco.transport = @transport + end + + describe "when creating the device" do + it "should find the enable password from the url" do + cisco = Puppet::Util::NetworkDevice::Cisco::Device.new("telnet://user:password@localhost:23/?enable=enable_password") + cisco.enable_password.should == "enable_password" + end + + it "should find the enable password from the options" do + cisco = Puppet::Util::NetworkDevice::Cisco::Device.new("telnet://user:password@localhost:23/?enable=enable_password", :enable_password => "mypass") + cisco.enable_password.should == "mypass" + end + end + + describe "when connecting to the physical device" do + it "should connect to the transport" do + @transport.expects(:connect) + @cisco.command + end + + it "should attempt to login" do + @cisco.expects(:login) + @cisco.command + end + + it "should tell the device to not page" do + @transport.expects(:command).with("terminal length 0") + @cisco.command + end + + it "should enter the enable password if returned prompt is not privileged" do + @transport.stubs(:command).yields("Switch>").returns("") + @cisco.expects(:enable) + @cisco.command + end + + it "should find device capabilities" do + @cisco.expects(:find_capabilities) + @cisco.command + end + + it "should execute given command" do + @transport.expects(:command).with("mycommand") + @cisco.command("mycommand") + end + + it "should yield to the command block if one is provided" do + @transport.expects(:command).with("mycommand") + @cisco.command do |c| + c.command("mycommand") + end + end + + it "should close the device transport" do + @transport.expects(:close) + @cisco.command + end + + describe "when login in" do + it "should not login if transport handles login" do + @transport.expects(:handles_login?).returns(true) + @transport.expects(:command).never + @transport.expects(:expect).never + @cisco.login + end + + it "should send username if one has been provided" do + @transport.expects(:command).with("user", :prompt => /^Password:/) + @cisco.login + end + + it "should send password after the username" do + @transport.expects(:command).with("user", :prompt => /^Password:/) + @transport.expects(:command).with("password") + @cisco.login + end + + it "should expect the Password: prompt if no user was sent" do + @cisco.url.user = '' + @transport.expects(:expect).with(/^Password:/) + @transport.expects(:command).with("password") + @cisco.login + end + end + + describe "when entering enable password" do + it "should raise an error if no enable password has been set" do + @cisco.enable_password = nil + lambda{ @cisco.enable }.should raise_error + end + + it "should send the enable command and expect an enable prompt" do + @cisco.enable_password = 'mypass' + @transport.expects(:command).with("enable", :prompt => /^Password:/) + @cisco.enable + end + + it "should send the enable password" do + @cisco.enable_password = 'mypass' + @transport.stubs(:command).with("enable", :prompt => /^Password:/) + @transport.expects(:command).with("mypass") + @cisco.enable + end + end + end + + describe "when finding network device capabilities" do + it "should try to execute sh vlan brief" do + @transport.expects(:command).with("sh vlan brief").returns("") + @cisco.find_capabilities + end + + it "should detect errors" do + @transport.stubs(:command).with("sh vlan brief").returns(<<eos) +Switch#sh vlan brief +% Ambiguous command: "sh vlan brief" +Switch# +eos + + @cisco.find_capabilities + @cisco.should_not be_support_vlan_brief + end + end + + + { + "Fa 0/1" => "FastEthernet0/1", + "Fa0/1" => "FastEthernet0/1", + "FastEth 0/1" => "FastEthernet0/1", + "Gi1" => "GigEthernet1", + "Di9" => "Dialer9", + "Ethernet 0/0/1" => "Ethernet0/0/1", + "E0" => "Ethernet0", + "ATM 0/1.1" => "ATM0/1.1", + "VLAN99" => "VLAN99" + }.each do |input,expected| + it "should canonicalize #{input} to #{expected}" do + @cisco.canonalize_ifname(input).should == expected + end + end + + describe "when updating device vlans" do + describe "when removing a vlan" do + it "should issue the no vlan command" do + @transport.expects(:command).with("no vlan 200") + @cisco.update_vlan("200", {:ensure => :present, :name => "200"}, { :ensure=> :absent}) + end + end + + describe "when updating a vlan" do + it "should issue the vlan command to enter global vlan modifications" do + @transport.expects(:command).with("vlan 200") + @cisco.update_vlan("200", {:ensure => :present, :name => "200"}, { :ensure=> :present, :name => "200"}) + end + + it "should issue the name command to modify the vlan description" do + @transport.expects(:command).with("name myvlan") + @cisco.update_vlan("200", {:ensure => :present, :name => "200"}, { :ensure=> :present, :name => "200", :description => "myvlan"}) + end + end + end + + describe "when parsing interface" do + + it "should parse interface output" do + @cisco.expects(:parse_interface).returns({ :ensure => :present }) + + @cisco.interface("FastEthernet0/1").should == { :ensure => :present } + end + + it "should parse trunking and merge results" do + @cisco.stubs(:parse_interface).returns({ :ensure => :present }) + @cisco.expects(:parse_trunking).returns({ :native_vlan => "100" }) + + @cisco.interface("FastEthernet0/1").should == { :ensure => :present, :native_vlan => "100" } + end + + it "should return an absent interface if parse_interface returns nothing" do + @cisco.stubs(:parse_interface).returns({}) + + @cisco.interface("FastEthernet0/1").should == { :ensure => :absent } + end + + it "should parse ip address information and merge results" do + @cisco.stubs(:parse_interface).returns({ :ensure => :present }) + @cisco.expects(:parse_interface_config).returns({ :ipaddress => [24,IPAddr.new('192.168.0.24'), nil] }) + + @cisco.interface("FastEthernet0/1").should == { :ensure => :present, :ipaddress => [24,IPAddr.new('192.168.0.24'), nil] } + end + + it "should parse the sh interface command" do + @transport.stubs(:command).with("sh interface FastEthernet0/1").returns(<<eos) +Switch#sh interfaces FastEthernet 0/1 +FastEthernet0/1 is down, line protocol is down + Hardware is Fast Ethernet, address is 00d0.bbe2.19c1 (bia 00d0.bbe2.19c1) + MTU 1500 bytes, BW 100000 Kbit, DLY 100 usec, + reliability 255/255, txload 1/255, rxload 1/255 + Encapsulation ARPA, loopback not set + Keepalive not set + Auto-duplex , Auto Speed , 100BaseTX/FX + ARP type: ARPA, ARP Timeout 04:00:00 + Last input never, output 5d04h, output hang never + Last clearing of "show interface" counters never + Queueing strategy: fifo + Output queue 0/40, 0 drops; input queue 0/75, 0 drops + 5 minute input rate 0 bits/sec, 0 packets/sec + 5 minute output rate 0 bits/sec, 0 packets/sec + 580 packets input, 54861 bytes + Received 6 broadcasts, 0 runts, 0 giants, 0 throttles + 0 input errors, 0 CRC, 0 frame, 0 overrun, 0 ignored + 0 watchdog, 1 multicast + 0 input packets with dribble condition detected + 845 packets output, 80359 bytes, 0 underruns + 0 output errors, 0 collisions, 1 interface resets + 0 babbles, 0 late collision, 0 deferred + 0 lost carrier, 0 no carrier + 0 output buffer failures, 0 output buffers swapped out +Switch# +eos + + @cisco.parse_interface("FastEthernet0/1").should == { :ensure => :absent, :duplex => :auto, :speed => :auto } + end + + it "should be able to parse the sh vlan brief command output" do + @cisco.stubs(:support_vlan_brief?).returns(true) + @transport.stubs(:command).with("sh vlan brief").returns(<<eos) +Switch#sh vlan brief +VLAN Name Status Ports +---- -------------------------------- --------- ------------------------------- +1 default active Fa0/3, Fa0/4, Fa0/5, Fa0/6, + Fa0/7, Fa0/8, Fa0/9, Fa0/10, + Fa0/11, Fa0/12, Fa0/13, Fa0/14, + Fa0/15, Fa0/16, Fa0/17, Fa0/18, + Fa0/23, Fa0/24 +10 VLAN0010 active +100 management active Fa0/1, Fa0/2 +Switch# +eos + + @cisco.parse_vlans.should == {"100"=>{:status=>"active", :interfaces=>["FastEthernet0/1", "FastEthernet0/2"], :description=>"management", :name=>"100"}, "1"=>{:status=>"active", :interfaces=>["FastEthernet0/3", "FastEthernet0/4", "FastEthernet0/5", "FastEthernet0/6", "FastEthernet0/7", "FastEthernet0/8", "FastEthernet0/9", "FastEthernet0/10", "FastEthernet0/11", "FastEthernet0/12", "FastEthernet0/13", "FastEthernet0/14", "FastEthernet0/15", "FastEthernet0/16", "FastEthernet0/17", "FastEthernet0/18", "FastEthernet0/23", "FastEthernet0/24"], :description=>"default", :name=>"1"}, "10"=>{:status=>"active", :interfaces=>[], :description=>"VLAN0010", :name=>"10"}} + end + + it "should parse trunk switchport information" do + @transport.stubs(:command).with("sh interface FastEthernet0/21 switchport").returns(<<eos) +Switch#sh interfaces FastEthernet 0/21 switchport +Name: Fa0/21 +Switchport: Enabled +Administrative mode: trunk +Operational Mode: trunk +Administrative Trunking Encapsulation: dot1q +Operational Trunking Encapsulation: dot1q +Negotiation of Trunking: Disabled +Access Mode VLAN: 0 ((Inactive)) +Trunking Native Mode VLAN: 1 (default) +Trunking VLANs Enabled: ALL +Trunking VLANs Active: 1,10,100 +Pruning VLANs Enabled: 2-1001 + +Priority for untagged frames: 0 +Override vlan tag priority: FALSE +Voice VLAN: none +Appliance trust: none +Self Loopback: No +Switch# +eos + + @cisco.parse_trunking("FastEthernet0/21").should == { :mode => :trunk, :encapsulation => :dot1q, :allowed_trunk_vlans=>:all, } + end + + it "should parse trunk switchport information with allowed vlans" do + @transport.stubs(:command).with("sh interface GigabitEthernet 0/1 switchport").returns(<<eos) +c2960#sh interfaces GigabitEthernet 0/1 switchport +Name: Gi0/1 +Switchport: Enabled +Administrative Mode: trunk +Operational Mode: trunk +Administrative Trunking Encapsulation: dot1q +Operational Trunking Encapsulation: dot1q +Negotiation of Trunking: On +Access Mode VLAN: 1 (default) +Trunking Native Mode VLAN: 1 (default) +Administrative Native VLAN tagging: enabled +Voice VLAN: none +Administrative private-vlan host-association: none +Administrative private-vlan mapping: none +Administrative private-vlan trunk native VLAN: none +Administrative private-vlan trunk Native VLAN tagging: enabled +Administrative private-vlan trunk encapsulation: dot1q +Administrative private-vlan trunk normal VLANs: none +Administrative private-vlan trunk associations: none +Administrative private-vlan trunk mappings: none +Operational private-vlan: none +Trunking VLANs Enabled: 1,99 +Pruning VLANs Enabled: 2-1001 +Capture Mode Disabled +Capture VLANs Allowed: ALL + +Protected: false +Unknown unicast blocked: disabled +Unknown multicast blocked: disabled +Appliance trust: none +c2960# +eos + + @cisco.parse_trunking("GigabitEthernet 0/1").should == { :mode => :trunk, :encapsulation => :dot1q, :allowed_trunk_vlans=>"1,99", } + end + + it "should parse access switchport information" do + @transport.stubs(:command).with("sh interface FastEthernet0/1 switchport").returns(<<eos) +Switch#sh interfaces FastEthernet 0/1 switchport +Name: Fa0/1 +Switchport: Enabled +Administrative mode: static access +Operational Mode: static access +Administrative Trunking Encapsulation: isl +Operational Trunking Encapsulation: isl +Negotiation of Trunking: Disabled +Access Mode VLAN: 100 (SHDSL) +Trunking Native Mode VLAN: 1 (default) +Trunking VLANs Enabled: NONE +Pruning VLANs Enabled: NONE + +Priority for untagged frames: 0 +Override vlan tag priority: FALSE +Voice VLAN: none +Appliance trust: none +Self Loopback: No +Switch# +eos + + @cisco.parse_trunking("FastEthernet0/1").should == { :mode => :access, :native_vlan => "100" } + end + + it "should parse ip addresses" do + @transport.stubs(:command).with("sh running-config interface Vlan 1 | begin interface").returns(<<eos) +router#sh running-config interface Vlan 1 | begin interface +interface Vlan1 + description $ETH-SW-LAUNCH$$INTF-INFO-HWIC 4ESW$$FW_INSIDE$ + ip address 192.168.0.24 255.255.255.0 secondary + ip address 192.168.0.1 255.255.255.0 + ip access-group 100 in + no ip redirects + no ip proxy-arp + ip nbar protocol-discovery + ip dns view-group dow + ip nat inside + ip virtual-reassembly + ip route-cache flow + ipv6 address 2001:7A8:71C1::/64 eui-64 + ipv6 enable + ipv6 traffic-filter DENY-ACL6 out + ipv6 mtu 1280 + ipv6 nd prefix 2001:7A8:71C1::/64 + ipv6 nd ra interval 60 + ipv6 nd ra lifetime 180 + ipv6 verify unicast reverse-path + ipv6 inspect STD6 out +end + +router# +eos + @cisco.parse_interface_config("Vlan 1").should == {:ipaddress=>[[24, IPAddr.new('192.168.0.24'), 'secondary'], + [24, IPAddr.new('192.168.0.1'), nil], + [64, IPAddr.new('2001:07a8:71c1::'), "eui-64"]]} + end + + it "should parse etherchannel membership" do + @transport.stubs(:command).with("sh running-config interface Gi0/17 | begin interface").returns(<<eos) +c2960#sh running-config interface Gi0/17 | begin interface +interface GigabitEthernet0/17 + description member of Po1 + switchport mode access + channel-protocol lacp + channel-group 1 mode passive + spanning-tree portfast + spanning-tree bpduguard enable +end + +c2960# +eos + @cisco.parse_interface_config("Gi0/17").should == {:etherchannel=>"1"} + end + end +end + +# static access +# Switch#sh interfaces FastEthernet 0/1 switchport +# Name: Fa0/1 +# Switchport: Enabled +# Administrative mode: static access +# Operational Mode: static access +# Administrative Trunking Encapsulation: isl +# Operational Trunking Encapsulation: isl +# Negotiation of Trunking: Disabled +# Access Mode VLAN: 100 (SHDSL) +# Trunking Native Mode VLAN: 1 (default) +# Trunking VLANs Enabled: NONE +# Pruning VLANs Enabled: NONE +# +# Priority for untagged frames: 0 +# Override vlan tag priority: FALSE +# Voice VLAN: none +# Appliance trust: none +# Self Loopback: No +# Switch# + +# c2960#sh interfaces GigabitEthernet 0/1 switchport +# Name: Gi0/1 +# Switchport: Enabled +# Administrative Mode: trunk +# Operational Mode: trunk +# Administrative Trunking Encapsulation: dot1q +# Operational Trunking Encapsulation: dot1q +# Negotiation of Trunking: On +# Access Mode VLAN: 1 (default) +# Trunking Native Mode VLAN: 1 (default) +# Administrative Native VLAN tagging: enabled +# Voice VLAN: none +# Administrative private-vlan host-association: none +# Administrative private-vlan mapping: none +# Administrative private-vlan trunk native VLAN: none +# Administrative private-vlan trunk Native VLAN tagging: enabled +# Administrative private-vlan trunk encapsulation: dot1q +# Administrative private-vlan trunk normal VLANs: none +# Administrative private-vlan trunk associations: none +# Administrative private-vlan trunk mappings: none +# Operational private-vlan: none +# Trunking VLANs Enabled: 1,99 +# Pruning VLANs Enabled: 2-1001 +# Capture Mode Disabled +# Capture VLANs Allowed: ALL +# +# Protected: false +# Unknown unicast blocked: disabled +# Unknown multicast blocked: disabled +# Appliance trust: none +# c2960# + +# c2960#sh interfaces GigabitEthernet 0/2 switchport +# Name: Gi0/2 +# Switchport: Enabled +# Administrative Mode: static access +# Operational Mode: static access +# Administrative Trunking Encapsulation: dot1q +# Operational Trunking Encapsulation: native +# Negotiation of Trunking: Off +# Access Mode VLAN: 99 (MGMT) +# Trunking Native Mode VLAN: 1 (default) +# Administrative Native VLAN tagging: enabled +# Voice VLAN: none +# Administrative private-vlan host-association: none +# Administrative private-vlan mapping: none +# Administrative private-vlan trunk native VLAN: none +# Administrative private-vlan trunk Native VLAN tagging: enabled +# Administrative private-vlan trunk encapsulation: dot1q +# Administrative private-vlan trunk normal VLANs: none +# Administrative private-vlan trunk associations: none +# Administrative private-vlan trunk mappings: none +# Operational private-vlan: none +# Trunking VLANs Enabled: ALL +# Pruning VLANs Enabled: 2-1001 +# Capture Mode Disabled +# Capture VLANs Allowed: ALL +# +# Protected: false +# Unknown unicast blocked: disabled +# Unknown multicast blocked: disabled +# Appliance trust: none +# c2960# + +# c877#sh interfaces FastEthernet 1 switchport +# Name: Fa1 +# Switchport: Enabled +# Administrative Mode: trunk +# Operational Mode: trunk +# Administrative Trunking Encapsulation: dot1q +# Operational Trunking Encapsulation: dot1q +# Negotiation of Trunking: Disabled +# Access Mode VLAN: 0 ((Inactive)) +# Trunking Native Mode VLAN: 1 (default) +# Trunking VLANs Enabled: ALL +# Trunking VLANs Active: 1 +# Protected: false +# Priority for untagged frames: 0 +# Override vlan tag priority: FALSE +# Voice VLAN: none +# Appliance trust: none + + +# c2960#sh etherchannel summary +# Flags: D - down P - bundled in port-channel +# I - stand-alone s - suspended +# H - Hot-standby (LACP only) +# R - Layer3 S - Layer2 +# U - in use f - failed to allocate aggregator +# +# M - not in use, minimum links not met +# u - unsuitable for bundling +# w - waiting to be aggregated +# d - default port +# +# +# Number of channel-groups in use: 1 +# Number of aggregators: 1 +# +# Group Port-channel Protocol Ports +# ------+-------------+-----------+----------------------------------------------- +# 1 Po1(SU) LACP Gi0/17(P) Gi0/18(P) +# +# c2960# diff --git a/spec/unit/util/network_device/cisco/interface_spec.rb b/spec/unit/util/network_device/cisco/interface_spec.rb new file mode 100644 index 000000000..f6aa14747 --- /dev/null +++ b/spec/unit/util/network_device/cisco/interface_spec.rb @@ -0,0 +1,89 @@ +#!/usr/bin/env ruby + +require File.dirname(__FILE__) + '/../../../../spec_helper' + +require 'puppet/util/network_device' +require 'puppet/util/network_device/cisco/interface' + +describe Puppet::Util::NetworkDevice::Cisco::Interface do + before(:each) do + @transport = stub_everything 'transport' + @interface = Puppet::Util::NetworkDevice::Cisco::Interface.new("FastEthernet0/1",@transport) + end + + it "should include IPCalc" do + @interface.class.include?(Puppet::Util::NetworkDevice::IPCalc) + end + + describe "when updating the physical device" do + it "should enter global configuration mode" do + @transport.expects(:command).with("conf t") + @interface.update + end + + it "should enter interface configuration mode" do + @transport.expects(:command).with("interface FastEthernet0/1") + @interface.update + end + + it "should 'execute' all differing properties" do + @interface.expects(:execute).with(:description, "b") + @interface.expects(:execute).with(:mode, :access).never + @interface.update({ :description => "a", :mode => :access }, { :description => "b", :mode => :access }) + end + + it "should execute in cisco ios defined order" do + speed = states('speed').starts_as('notset') + @interface.expects(:execute).with(:speed, :auto).then(speed.is('set')) + @interface.expects(:execute).with(:duplex, :auto).when(speed.is('set')) + @interface.update({ :duplex => :half, :speed => "10" }, { :duplex => :auto, :speed => :auto }) + end + + it "should execute absent properties with a no prefix" do + @interface.expects(:execute).with(:description, "a", "no ") + @interface.update({ :description => "a"}, { }) + end + + it "should exit twice" do + @transport.expects(:command).with("exit").twice + @interface.update + end + end + + describe "when executing commands" do + it "should execute string commands directly" do + @transport.expects(:command).with("speed auto") + @interface.execute(:speed, :auto) + end + + it "should execute string commands with the given prefix" do + @transport.expects(:command).with("no speed auto") + @interface.execute(:speed, :auto, "no ") + end + + it "should stop at executing the first command that works for array" do + @transport.expects(:command).with("channel-group 1").yields("% Invalid command") + @transport.expects(:command).with("port group 1") + @interface.execute(:etherchannel, "1") + end + + it "should execute the block for block commands" do + @transport.expects(:command).with("ip address 192.168.0.1 255.255.255.0") + @interface.execute(:ipaddress, [[24, IPAddr.new('192.168.0.1'), nil]]) + end + + it "should execute the block for block commands" do + @transport.expects(:command).with("ipv6 address fe08::/76 link-local") + @interface.execute(:ipaddress, [[76, IPAddr.new('fe08::'), 'link-local']]) + end + + end + + describe "when sending commands to the device" do + it "should detect errors" do + Puppet.expects(:err) + @transport.stubs(:command).yields("% Invalid Command") + @interface.command("sh ver") + end + end +end
\ No newline at end of file diff --git a/spec/unit/util/network_device/ipcalc_spec.rb b/spec/unit/util/network_device/ipcalc_spec.rb new file mode 100644 index 000000000..6f55a66e4 --- /dev/null +++ b/spec/unit/util/network_device/ipcalc_spec.rb @@ -0,0 +1,63 @@ +#!/usr/bin/env ruby + +require File.dirname(__FILE__) + '/../../../spec_helper' + +require 'puppet/util/network_device/ipcalc' + +describe Puppet::Util::NetworkDevice::IPCalc do + class TestIPCalc + include Puppet::Util::NetworkDevice::IPCalc + end + + before(:each) do + @ipcalc = TestIPCalc.new + end + + describe "when parsing ip/prefix" do + it "should parse ipv4 without prefixes" do + @ipcalc.parse('127.0.0.1').should == [32,IPAddr.new('127.0.0.1')] + end + + it "should parse ipv4 with prefixes" do + @ipcalc.parse('127.0.1.2/8').should == [8,IPAddr.new('127.0.1.2')] + end + + it "should parse ipv6 without prefixes" do + @ipcalc.parse('FE80::21A:2FFF:FE30:ECF0').should == [128,IPAddr.new('FE80::21A:2FFF:FE30:ECF0')] + end + + it "should parse ipv6 with prefixes" do + @ipcalc.parse('FE80::21A:2FFF:FE30:ECF0/56').should == [56,IPAddr.new('FE80::21A:2FFF:FE30:ECF0')] + end + end + + describe "when building netmask" do + it "should produce the correct ipv4 netmask from prefix length" do + @ipcalc.netmask(Socket::AF_INET, 27).should == IPAddr.new('255.255.255.224') + end + + it "should produce the correct ipv6 netmask from prefix length" do + @ipcalc.netmask(Socket::AF_INET6, 56).should == IPAddr.new('ffff:ffff:ffff:ff00::0') + end + end + + describe "when building wildmask" do + it "should produce the correct ipv4 wildmask from prefix length" do + @ipcalc.wildmask(Socket::AF_INET, 27).should == IPAddr.new('0.0.0.31') + end + + it "should produce the correct ipv6 wildmask from prefix length" do + @ipcalc.wildmask(Socket::AF_INET6, 126).should == IPAddr.new('::3') + end + end + + describe "when computing prefix length from netmask" do + it "should produce the correct ipv4 prefix length" do + @ipcalc.prefix_length(IPAddr.new('255.255.255.224')).should == 27 + end + + it "should produce the correct ipv6 prefix length" do + @ipcalc.prefix_length(IPAddr.new('fffe::0')).should == 15 + end + end +end
\ No newline at end of file diff --git a/spec/unit/util/network_device/transport/base_spec.rb b/spec/unit/util/network_device/transport/base_spec.rb new file mode 100644 index 000000000..5d52574f7 --- /dev/null +++ b/spec/unit/util/network_device/transport/base_spec.rb @@ -0,0 +1,42 @@ +#!/usr/bin/env ruby + +require File.dirname(__FILE__) + '/../../../../spec_helper' + +require 'puppet/util/network_device/transport/base' + +describe Puppet::Util::NetworkDevice::Transport::Base do + class TestTransport < Puppet::Util::NetworkDevice::Transport::Base + end + + before(:each) do + @transport = TestTransport.new + end + + describe "when sending commands" do + it "should send the command to the telnet session" do + @transport.expects(:send).with("line") + @transport.command("line") + end + + it "should expect an output matching the given prompt" do + @transport.expects(:expect).with(/prompt/) + @transport.command("line", :prompt => /prompt/) + end + + it "should expect an output matching the default prompt" do + @transport.default_prompt = /defprompt/ + @transport.expects(:expect).with(/defprompt/) + @transport.command("line") + end + + it "should yield telnet output to the given block" do + @transport.expects(:expect).yields("output") + @transport.command("line") { |out| out.should == "output" } + end + + it "should return telnet output to the caller" do + @transport.expects(:expect).returns("output") + @transport.command("line").should == "output" + end + end +end
\ No newline at end of file diff --git a/spec/unit/util/network_device/transport/ssh_spec.rb b/spec/unit/util/network_device/transport/ssh_spec.rb new file mode 100644 index 000000000..706dee43a --- /dev/null +++ b/spec/unit/util/network_device/transport/ssh_spec.rb @@ -0,0 +1,211 @@ +#!/usr/bin/env ruby + +require File.dirname(__FILE__) + '/../../../../spec_helper' + +require 'puppet/util/network_device/transport/ssh' + +describe Puppet::Util::NetworkDevice::Transport::Ssh, :if => Puppet.features.ssh? do + + before(:each) do + @transport = Puppet::Util::NetworkDevice::Transport::Ssh.new() + end + + it "should handle login through the transport" do + @transport.should be_handles_login + end + + it "should connect to the given host and port" do + Net::SSH.expects(:start).with { |host, user, args| host == "localhost" && args[:port] == 22 }.returns stub_everything + @transport.host = "localhost" + @transport.port = 22 + + @transport.connect + end + + it "should connect using the given username and password" do + Net::SSH.expects(:start).with { |host, user, args| user == "user" && args[:password] == "pass" }.returns stub_everything + @transport.user = "user" + @transport.password = "pass" + + @transport.connect + end + + describe "when connected" do + before(:each) do + @ssh = stub_everything 'ssh' + @channel = stub_everything 'channel' + Net::SSH.stubs(:start).returns @ssh + @ssh.stubs(:open_channel).yields(@channel) + @transport.stubs(:expect) + end + + it "should open a channel" do + @ssh.expects(:open_channel) + + @transport.connect + end + + it "should request a pty" do + @channel.expects(:request_pty) + + @transport.connect + end + + it "should create a shell channel" do + @channel.expects(:send_channel_request).with("shell") + @transport.connect + end + + it "should raise an error if shell channel creation fails" do + @channel.expects(:send_channel_request).with("shell").yields(@channel, false) + lambda { @transport.connect }.should raise_error + end + + it "should register an on_data and on_extended_data callback" do + @channel.expects(:send_channel_request).with("shell").yields(@channel, true) + @channel.expects(:on_data) + @channel.expects(:on_extended_data) + @transport.connect + end + + it "should accumulate data to the buffer on data" do + @channel.expects(:send_channel_request).with("shell").yields(@channel, true) + @channel.expects(:on_data).yields(@channel, "data") + + @transport.connect + @transport.buf.should == "data" + end + + it "should accumulate data to the buffer on extended data" do + @channel.expects(:send_channel_request).with("shell").yields(@channel, true) + @channel.expects(:on_extended_data).yields(@channel, 1, "data") + + @transport.connect + @transport.buf.should == "data" + end + + it "should mark eof on close" do + @channel.expects(:send_channel_request).with("shell").yields(@channel, true) + @channel.expects(:on_close).yields(@channel) + + @transport.connect + @transport.should be_eof + end + + it "should expect output to conform to the default prompt" do + @channel.expects(:send_channel_request).with("shell").yields(@channel, true) + @transport.expects(:default_prompt).returns("prompt") + @transport.expects(:expect).with("prompt") + @transport.connect + end + + it "should start the ssh loop" do + @ssh.expects(:loop) + @transport.connect + end + end + + describe "when closing" do + before(:each) do + @ssh = stub_everything 'ssh' + @channel = stub_everything 'channel' + Net::SSH.stubs(:start).returns @ssh + @ssh.stubs(:open_channel).yields(@channel) + @channel.stubs(:send_channel_request).with("shell").yields(@channel, true) + @transport.stubs(:expect) + @transport.connect + end + + it "should close the channel" do + @channel.expects(:close) + @transport.close + end + + it "should close the ssh session" do + @ssh.expects(:close) + @transport.close + end + end + + describe "when sending commands" do + before(:each) do + @ssh = stub_everything 'ssh' + @channel = stub_everything 'channel' + Net::SSH.stubs(:start).returns @ssh + @ssh.stubs(:open_channel).yields(@channel) + @channel.stubs(:send_channel_request).with("shell").yields(@channel, true) + @transport.stubs(:expect) + @transport.connect + end + + it "should send data to the ssh channel" do + @channel.expects(:send_data).with("data\n") + @transport.command("data") + end + + it "should expect the default prompt afterward" do + @transport.expects(:default_prompt).returns("prompt") + @transport.expects(:expect).with("prompt") + @transport.command("data") + end + + it "should expect the given prompt" do + @transport.expects(:expect).with("myprompt") + @transport.command("data", :prompt => "myprompt") + end + + it "should yield the buffer output to given block" do + @transport.expects(:expect).yields("output") + @transport.command("data") do |out| + out.should == "output" + end + end + + it "should return buffer output" do + @transport.expects(:expect).returns("output") + @transport.command("data").should == "output" + end + end + + describe "when expecting output" do + before(:each) do + @connection = stub_everything 'connection' + @socket = stub_everything 'socket' + transport = stub 'transport', :socket => @socket + @ssh = stub_everything 'ssh', :transport => transport + @channel = stub_everything 'channel', :connection => @connection + @transport.ssh = @ssh + @transport.channel = @channel + end + + it "should process the ssh event loop" do + IO.stubs(:select) + @transport.buf = "output" + @transport.expects(:process_ssh) + @transport.expect(/output/) + end + + it "should return the output" do + IO.stubs(:select) + @transport.buf = "output" + @transport.stubs(:process_ssh) + @transport.expect(/output/).should == "output" + end + + it "should return the output" do + IO.stubs(:select) + @transport.buf = "output" + @transport.stubs(:process_ssh) + @transport.expect(/output/).should == "output" + end + + describe "when processing the ssh loop" do + it "should advance one tick in the ssh event loop and exit on eof" do + @transport.buf = '' + @connection.expects(:process).then.raises(EOFError) + @transport.process_ssh + end + end + end + +end diff --git a/spec/unit/util/network_device/transport/telnet_spec.rb b/spec/unit/util/network_device/transport/telnet_spec.rb new file mode 100644 index 000000000..7499b528e --- /dev/null +++ b/spec/unit/util/network_device/transport/telnet_spec.rb @@ -0,0 +1,76 @@ +#!/usr/bin/env ruby + +require File.dirname(__FILE__) + '/../../../../spec_helper' + +require 'puppet/util/network_device/transport/telnet' + +describe Puppet::Util::NetworkDevice::Transport::Telnet do + + before(:each) do + @transport = Puppet::Util::NetworkDevice::Transport::Telnet.new() + end + + it "should not handle login through the transport" do + @transport.should_not be_handles_login + end + + it "should connect to the given host and port" do + Net::Telnet.expects(:new).with { |args| args["Host"] == "localhost" && args["Port"] == 23 }.returns stub_everything + @transport.host = "localhost" + @transport.port = 23 + + @transport.connect + end + + it "should connect and specify the default prompt" do + @transport.default_prompt = "prompt" + Net::Telnet.expects(:new).with { |args| args["Prompt"] == "prompt" }.returns stub_everything + @transport.host = "localhost" + @transport.port = 23 + + @transport.connect + end + + describe "when connected" do + before(:each) do + @telnet = stub_everything 'telnet' + Net::Telnet.stubs(:new).returns(@telnet) + @transport.connect + end + + it "should send line to the telnet session" do + @telnet.expects(:puts).with("line") + @transport.send("line") + end + + describe "when expecting output" do + it "should waitfor output on the telnet session" do + @telnet.expects(:waitfor).with(/regex/) + @transport.expect(/regex/) + end + + it "should return telnet session output" do + @telnet.expects(:waitfor).returns("output") + @transport.expect(/regex/).should == "output" + end + + it "should yield telnet session output to the given block" do + @telnet.expects(:waitfor).yields("output") + @transport.expect(/regex/) { |out| out.should == "output" } + end + end + end + + describe "when closing" do + before(:each) do + @telnet = stub_everything 'telnet' + Net::Telnet.stubs(:new).returns(@telnet) + @transport.connect + end + + it "should close the telnet session" do + @telnet.expects(:close) + @transport.close + end + end +end
\ No newline at end of file diff --git a/spec/unit/util/package_spec.rb b/spec/unit/util/package_spec.rb index e72a7ae91..3a1933bd5 100644..100755 --- a/spec/unit/util/package_spec.rb +++ b/spec/unit/util/package_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') +require 'spec_helper' require 'puppet/util/package' diff --git a/spec/unit/util/posix_spec.rb b/spec/unit/util/posix_spec.rb index 6d7351220..65f826bd4 100755 --- a/spec/unit/util/posix_spec.rb +++ b/spec/unit/util/posix_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') +require 'spec_helper' require 'puppet/util/posix' diff --git a/spec/unit/util/pson_spec.rb b/spec/unit/util/pson_spec.rb index 08758ee38..216e8b5a3 100755 --- a/spec/unit/util/pson_spec.rb +++ b/spec/unit/util/pson_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') +require 'spec_helper' require 'puppet/util/pson' diff --git a/spec/unit/util/queue/stomp_spec.rb b/spec/unit/util/queue/stomp_spec.rb index a11d5324e..76df0581f 100755 --- a/spec/unit/util/queue/stomp_spec.rb +++ b/spec/unit/util/queue/stomp_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') +require 'spec_helper' require 'puppet/util/queue' describe Puppet::Util::Queue, :if => Puppet.features.stomp? do diff --git a/spec/unit/util/queue_spec.rb b/spec/unit/util/queue_spec.rb index d356fd7bb..8ec75c3d8 100755 --- a/spec/unit/util/queue_spec.rb +++ b/spec/unit/util/queue_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') +require 'spec_helper' require 'puppet/util/queue' require 'spec/mocks' diff --git a/spec/unit/util/rdoc/parser_spec.rb b/spec/unit/util/rdoc/parser_spec.rb index f118dc99b..af2058197 100755 --- a/spec/unit/util/rdoc/parser_spec.rb +++ b/spec/unit/util/rdoc/parser_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') +require 'spec_helper' require 'puppet/resource/type_collection' require 'puppet/util/rdoc/parser' diff --git a/spec/unit/util/rdoc_spec.rb b/spec/unit/util/rdoc_spec.rb index 3b5248528..13e22eec9 100755 --- a/spec/unit/util/rdoc_spec.rb +++ b/spec/unit/util/rdoc_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') +require 'spec_helper' require 'puppet/util/rdoc' require 'rdoc/rdoc' diff --git a/spec/unit/util/reference_serializer_spec.rb b/spec/unit/util/reference_serializer_spec.rb index f72715ed6..d696dc193 100644..100755 --- a/spec/unit/util/reference_serializer_spec.rb +++ b/spec/unit/util/reference_serializer_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') +require 'spec_helper' require 'puppet/util/rails/reference_serializer' class SerializeTester diff --git a/spec/unit/util/resource_template_spec.rb b/spec/unit/util/resource_template_spec.rb index e823a9ff4..f83979607 100755 --- a/spec/unit/util/resource_template_spec.rb +++ b/spec/unit/util/resource_template_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') +require 'spec_helper' require 'puppet/util/resource_template' diff --git a/spec/unit/util/run_mode_spec.rb b/spec/unit/util/run_mode_spec.rb index 1956973ea..168936f44 100644..100755 --- a/spec/unit/util/run_mode_spec.rb +++ b/spec/unit/util/run_mode_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') +require 'spec_helper' describe Puppet::Util::RunMode do before do diff --git a/spec/unit/util/selinux_spec.rb b/spec/unit/util/selinux_spec.rb index c18be0c2f..bad52f09f 100755 --- a/spec/unit/util/selinux_spec.rb +++ b/spec/unit/util/selinux_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') +require 'spec_helper' require 'puppet/util/selinux' include Puppet::Util::SELinux diff --git a/spec/unit/util/settings/file_setting_spec.rb b/spec/unit/util/settings/file_setting_spec.rb index a2049e2ad..3d3a3ca0c 100755 --- a/spec/unit/util/settings/file_setting_spec.rb +++ b/spec/unit/util/settings/file_setting_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') +require 'spec_helper' require 'puppet/util/settings' require 'puppet/util/settings/file_setting' diff --git a/spec/unit/util/settings_spec.rb b/spec/unit/util/settings_spec.rb index 2ab31c294..a26cf86b8 100755 --- a/spec/unit/util/settings_spec.rb +++ b/spec/unit/util/settings_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') +require 'spec_helper' describe Puppet::Util::Settings do describe "when specifying defaults" do diff --git a/spec/unit/util/storage_spec.rb b/spec/unit/util/storage_spec.rb index 5359f746f..85d6596e4 100755 --- a/spec/unit/util/storage_spec.rb +++ b/spec/unit/util/storage_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') +require 'spec_helper' require 'yaml' require 'puppet/util/storage' diff --git a/spec/unit/util/tagging_spec.rb b/spec/unit/util/tagging_spec.rb index 5231be2eb..5a3cc97a5 100755 --- a/spec/unit/util/tagging_spec.rb +++ b/spec/unit/util/tagging_spec.rb @@ -3,7 +3,7 @@ # Created by Luke Kanies on 2008-01-19. # Copyright (c) 2007. All rights reserved. -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') +require 'spec_helper' require 'puppet/util/tagging' diff --git a/spec/unit/util/user_attr_spec.rb b/spec/unit/util/user_attr_spec.rb index 5acdaee58..fc7c177be 100644..100755 --- a/spec/unit/util/user_attr_spec.rb +++ b/spec/unit/util/user_attr_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') +require 'spec_helper' require 'puppet/util/user_attr' diff --git a/spec/unit/util/warnings_spec.rb b/spec/unit/util/warnings_spec.rb index a3460bccf..b0a6d027f 100755 --- a/spec/unit/util/warnings_spec.rb +++ b/spec/unit/util/warnings_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') +require 'spec_helper' describe Puppet::Util::Warnings do before(:all) do diff --git a/spec/unit/util/zaml_spec.rb b/spec/unit/util/zaml_spec.rb index 804aa8e58..b211b4b30 100755 --- a/spec/unit/util/zaml_spec.rb +++ b/spec/unit/util/zaml_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') +require 'spec_helper' require 'puppet/util/monkey_patches' diff --git a/autotest/watcher.rb b/spec/watchr.rb index 9f89a448c..bad89b088 100644 --- a/autotest/watcher.rb +++ b/spec/watchr.rb @@ -47,7 +47,7 @@ end def file2specs(file) %w{spec/unit spec/integration}.collect { |d| - file.sub('lib/puppet', d) + file.sub('lib/puppet', d).sub(".rb", "_spec.rb") }.find_all { |f| File.exist?(f) } @@ -81,7 +81,7 @@ def run_spec_files(files) files = Array(files) return if files.empty? opts = File.readlines('spec/spec.opts').collect { |l| l.chomp }.join(" ") - run_spec("spec #{files.join(' ')}") + run_spec("rspec #{opts} --tty #{files.join(' ')}") end def run_all_tests @@ -68,8 +68,8 @@ # # = Copyright # -# Copyright (c) 2005 Puppet Labs, LLC -# Licensed under the GNU Public License +# Copyright (c) 2005-2011 Puppet Labs, LLC +# Licensed under the Apache 2.0 License require 'find' require 'getoptlong' |