Skip to content

Commit

Permalink
(PUP-3809) Move code directories to /etc/puppetlabs/code
Browse files Browse the repository at this point in the history
This commit moves code related directories (environmentpath,
hiera_config, and basemodulepath) from /etc/puppetlabs/puppet to
/etc/puppetlabs/code.
  • Loading branch information
nwolfe authored and joshcooper committed Feb 20, 2015
1 parent 423f9b3 commit da5318f
Show file tree
Hide file tree
Showing 12 changed files with 54 additions and 54 deletions.
6 changes: 3 additions & 3 deletions acceptance/lib/puppet/acceptance/module_utils.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ module ModuleUtils
# Example return value:
#
# [
# "/etc/puppetlabs/puppet/environments/production/modules",
# "/etc/puppetlabs/puppet/modules",
# "/etc/puppetlabs/code/environments/production/modules",
# "/etc/puppetlabs/code/modules",
# "/opt/puppet/share/puppet/modules",
# ]
#
Expand All @@ -27,7 +27,7 @@ def get_modulepaths_for_host (host)
#
# Example return value:
#
# "/etc/puppetlabs/puppet/environments/production/modules"
# "/etc/puppetlabs/code/environments/production/modules"
#
# @param host [String] hostname
# @return [String] first path for found modulepath
Expand Down
6 changes: 3 additions & 3 deletions api/docs/http_environments.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@ None
Content-Type: application/json

{
"search_paths": ["/etc/puppetlabs/puppet/environments"]
"search_paths": ["/etc/puppetlabs/code/environments"]
"environments": {
"production": {
"settings": {
"modulepath": ["/etc/puppetlabs/puppet/environments/production/modules", "/etc/puppetlabs/puppet/environments/development/modules"],
"manifest": ["/etc/puppetlabs/puppet/environments/production/manifests"]
"modulepath": ["/etc/puppetlabs/code/environments/production/modules", "/etc/puppetlabs/code/environments/development/modules"],
"manifest": ["/etc/puppetlabs/code/environments/production/manifests"]
"environment_timeout": 180,
"config_version": "/version/of/config"
}
Expand Down
38 changes: 19 additions & 19 deletions api/docs/http_file_metadata.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ None
"links": "manage",
"mode": 420,
"owner": 501,
"path": "/etc/puppetlabs/puppet/modules/example/files/just_a_file.txt",
"path": "/etc/puppetlabs/code/modules/example/files/just_a_file.txt",
"relative_path": null,
"type": "file"
}
Expand All @@ -78,7 +78,7 @@ None
"links": "manage",
"mode": 493,
"owner": 501,
"path": "/etc/puppetlabs/puppet/modules/example/files/subdirectory",
"path": "/etc/puppetlabs/code/modules/example/files/subdirectory",
"relative_path": null,
"type": "directory"
}
Expand All @@ -95,12 +95,12 @@ None
"type": "md5",
"value": "{md5}d0a10f45491acc8743bc5a82b228f89e"
},
"destination": "/etc/puppetlabs/puppet/modules/example/files/just_a_file.txt",
"destination": "/etc/puppetlabs/code/modules/example/files/just_a_file.txt",
"group": 20,
"links": "manage",
"mode": 493,
"owner": 501,
"path": "/etc/puppetlabs/puppet/modules/example/files/link_to_file.txt",
"path": "/etc/puppetlabs/code/modules/example/files/link_to_file.txt",
"relative_path": null,
"type": "link"
}
Expand Down Expand Up @@ -154,7 +154,7 @@ Accept: pson, text/pson
"links": "manage",
"mode": 493,
"owner": 501,
"path": "/etc/puppetlabs/puppet/modules/example/files",
"path": "/etc/puppetlabs/code/modules/example/files",
"relative_path": ".",
"type": "directory"
},
Expand All @@ -168,7 +168,7 @@ Accept: pson, text/pson
"links": "manage",
"mode": 420,
"owner": 501,
"path": "/etc/puppetlabs/puppet/modules/example/files",
"path": "/etc/puppetlabs/code/modules/example/files",
"relative_path": "just_a_file.txt",
"type": "file"
},
Expand All @@ -177,12 +177,12 @@ Accept: pson, text/pson
"type": "md5",
"value": "{md5}d0a10f45491acc8743bc5a82b228f89e"
},
"destination": "/etc/puppetlabs/puppet/modules/example/files/just_a_file.txt",
"destination": "/etc/puppetlabs/code/modules/example/files/just_a_file.txt",
"group": 20,
"links": "manage",
"mode": 493,
"owner": 501,
"path": "/etc/puppetlabs/puppet/modules/example/files",
"path": "/etc/puppetlabs/code/modules/example/files",
"relative_path": "link_to_file.txt",
"type": "link"
},
Expand All @@ -196,7 +196,7 @@ Accept: pson, text/pson
"links": "manage",
"mode": 493,
"owner": 501,
"path": "/etc/puppetlabs/puppet/modules/example/files",
"path": "/etc/puppetlabs/code/modules/example/files",
"relative_path": "subdirectory",
"type": "directory"
},
Expand All @@ -210,7 +210,7 @@ Accept: pson, text/pson
"links": "manage",
"mode": 420,
"owner": 501,
"path": "/etc/puppetlabs/puppet/modules/example/files",
"path": "/etc/puppetlabs/code/modules/example/files",
"relative_path": "subdirectory/another_file.txt",
"type": "file"
}
Expand All @@ -234,7 +234,7 @@ Accept: pson, text/pson
"links": "manage",
"mode": 493,
"owner": 501,
"path": "/etc/puppetlabs/puppet/modules/example/files",
"path": "/etc/puppetlabs/code/modules/example/files",
"relative_path": ".",
"type": "directory"
},
Expand All @@ -248,7 +248,7 @@ Accept: pson, text/pson
"links": "manage",
"mode": 420,
"owner": 501,
"path": "/etc/puppetlabs/puppet/modules/example/files",
"path": "/etc/puppetlabs/code/modules/example/files",
"relative_path": "just_a_file.txt",
"type": "file"
},
Expand All @@ -257,12 +257,12 @@ Accept: pson, text/pson
"type": "md5",
"value": "{md5}d0a10f45491acc8743bc5a82b228f89e"
},
"destination": "/etc/puppetlabs/puppet/modules/example/files/just_a_file.txt",
"destination": "/etc/puppetlabs/code/modules/example/files/just_a_file.txt",
"group": 20,
"links": "manage",
"mode": 493,
"owner": 501,
"path": "/etc/puppetlabs/puppet/modules/example/files",
"path": "/etc/puppetlabs/code/modules/example/files",
"relative_path": "link_to_file.txt",
"type": "link"
}
Expand Down Expand Up @@ -297,7 +297,7 @@ is identical to the above example, except for:
"links": "follow",
"mode": 493,
"owner": 501,
"path": "/etc/puppetlabs/puppet/modules/example/files",
"path": "/etc/puppetlabs/code/modules/example/files",
"relative_path": ".",
"type": "directory"
},
Expand All @@ -311,7 +311,7 @@ is identical to the above example, except for:
"links": "follow",
"mode": 420,
"owner": 501,
"path": "/etc/puppetlabs/puppet/modules/example/files",
"path": "/etc/puppetlabs/code/modules/example/files",
"relative_path": "just_a_file.txt",
"type": "file"
},
Expand All @@ -325,7 +325,7 @@ is identical to the above example, except for:
"links": "follow",
"mode": 420,
"owner": 501,
"path": "/etc/puppetlabs/puppet/modules/example/files",
"path": "/etc/puppetlabs/code/modules/example/files",
"relative_path": "link_to_file.txt",
"type": "file"
}
Expand All @@ -341,9 +341,9 @@ Sample Module

The examples above use this (faux) module:

/etc/puppetlabs/puppet/modules/example/
/etc/puppetlabs/code/modules/example/
files/
just_a_file.txt
link_to_file.txt -> /etc/puppetlabs/puppet/modules/example/files/just_a_file.txt
link_to_file.txt -> /etc/puppetlabs/code/modules/example/files/just_a_file.txt
subdirectory/
another_file.txt
2 changes: 1 addition & 1 deletion ext/README.environment
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
This is an example environment directory. The environment's modules can be
placed in a "modules" subdirectory. The environments initial manifests are
placed in a "manifests" subdirectory. By default the environment also has any
modules that are installed globally (normally in /etc/puppetlabs/puppet/modules) for the
modules that are installed globally (normally in /etc/puppetlabs/code/modules) for the
puppet master.

For more information see
Expand Down
8 changes: 4 additions & 4 deletions lib/puppet/defaults.rb
Original file line number Diff line number Diff line change
Expand Up @@ -263,13 +263,13 @@ def self.default_diffargs
this provides the default environment for nodes we know nothing about."
},
:environmentpath => {
:default => "$confdir/environments",
:default => "$codedir/environments",
:desc => "A search path for directory environments, as a list of directories
separated by the system path separator character. (The POSIX path separator
is ':', and the Windows path separator is ';'.)
This setting must have a value set to enable **directory environments.** The
recommended value is `$confdir/environments`. For more details, see
recommended value is `$codedir/environments`. For more details, see
http://docs.puppetlabs.com/puppet/latest/reference/environments.html",
:type => :path,
},
Expand Down Expand Up @@ -356,7 +356,7 @@ def self.default_diffargs
:desc => "Where to retrive information about data.",
},
:hiera_config => {
:default => "$confdir/hiera.yaml",
:default => "$codedir/hiera.yaml",
:desc => "The hiera configuration file. Puppet only reads this file on startup, so you must restart the puppet master every time you edit it.",
:type => :file,
},
Expand Down Expand Up @@ -1054,7 +1054,7 @@ def self.default_diffargs
:desc => "File that provides mapping between custom SSL oids and user-friendly names"
},
:basemodulepath => {
:default => "$confdir/modules#{File::PATH_SEPARATOR}/usr/share/puppet/modules",
:default => "$codedir/modules#{File::PATH_SEPARATOR}/usr/share/puppet/modules",
:type => :path,
:desc => "The search path for **global** modules. Should be specified as a
list of directories separated by the system path separator character. (The
Expand Down
2 changes: 1 addition & 1 deletion lib/puppet/face/module/changes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
examples <<-EOT
Show modified files of an installed module:
$ puppet module changes /etc/puppetlabs/puppet/modules/vcsrepo/
$ puppet module changes /etc/puppetlabs/code/modules/vcsrepo/
warning: 1 files modified
lib/puppet/provider/vcsrepo.rb
EOT
Expand Down
20 changes: 10 additions & 10 deletions lib/puppet/face/module/install.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,19 @@
Install a module:
$ puppet module install puppetlabs-vcsrepo
Preparing to install into /etc/puppetlabs/puppet/modules ...
Preparing to install into /etc/puppetlabs/code/modules ...
Downloading from http://forgeapi.puppetlabs.com ...
Installing -- do not interrupt ...
/etc/puppetlabs/puppet/modules
/etc/puppetlabs/code/modules
└── puppetlabs-vcsrepo (v0.0.4)
Install a module to a specific environment:
$ puppet module install puppetlabs-vcsrepo --environment development
Preparing to install into /etc/puppetlabs/puppet/environments/development/modules ...
Preparing to install into /etc/puppetlabs/code/environments/development/modules ...
Downloading from http://forgeapi.puppetlabs.com ...
Installing -- do not interrupt ...
/etc/puppetlabs/puppet/environments/development/modules
/etc/puppetlabs/code/environments/development/modules
└── puppetlabs-vcsrepo (v0.0.4)
Install a specific module version:
Expand All @@ -41,7 +41,7 @@
Preparing to install into /etc/puppetlabs/modules ...
Downloading from http://forgeapi.puppetlabs.com ...
Installing -- do not interrupt ...
/etc/puppetlabs/puppet/modules
/etc/puppetlabs/code/modules
└── puppetlabs-vcsrepo (v0.0.4)
Install a module into a specific directory:
Expand All @@ -55,7 +55,7 @@
Install a module into a specific directory and check for dependencies in other directories:
$ puppet module install puppetlabs-vcsrepo --target-dir=/usr/share/puppet/modules --modulepath /etc/puppetlabs/puppet/modules
$ puppet module install puppetlabs-vcsrepo --target-dir=/usr/share/puppet/modules --modulepath /etc/puppetlabs/code/modules
Preparing to install into /usr/share/puppet/modules ...
Downloading from http://forgeapi.puppetlabs.com ...
Installing -- do not interrupt ...
Expand All @@ -65,18 +65,18 @@
Install a module from a release archive:
$ puppet module install puppetlabs-vcsrepo-0.0.4.tar.gz
Preparing to install into /etc/puppetlabs/puppet/modules ...
Preparing to install into /etc/puppetlabs/code/modules ...
Downloading from http://forgeapi.puppetlabs.com ...
Installing -- do not interrupt ...
/etc/puppetlabs/puppet/modules
/etc/puppetlabs/code/modules
└── puppetlabs-vcsrepo (v0.0.4)
Install a module from a release archive and ignore dependencies:
$ puppet module install puppetlabs-vcsrepo-0.0.4.tar.gz --ignore-dependencies
Preparing to install into /etc/puppetlabs/puppet/modules ...
Preparing to install into /etc/puppetlabs/code/modules ...
Installing -- do not interrupt ...
/etc/puppetlabs/puppet/modules
/etc/puppetlabs/code/modules
└── puppetlabs-vcsrepo (v0.0.4)
EOT
Expand Down
8 changes: 4 additions & 4 deletions lib/puppet/face/module/list.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
List installed modules:
$ puppet module list
/etc/puppetlabs/puppet/modules
/etc/puppetlabs/code/modules
├── bodepd-create_resources (v0.0.1)
├── puppetlabs-bacula (v0.0.2)
├── puppetlabs-mysql (v0.0.1)
Expand All @@ -32,7 +32,7 @@
List installed modules in a tree view:
$ puppet module list --tree
/etc/puppetlabs/puppet/modules
/etc/puppetlabs/code/modules
└─┬ puppetlabs-bacula (v0.0.2)
├── puppetlabs-stdlib (v2.2.1)
├─┬ puppetlabs-mysql (v0.0.1)
Expand All @@ -43,7 +43,7 @@
List installed modules from a specified environment:
$ puppet module list --environment production
/etc/puppetlabs/puppet/modules
/etc/puppetlabs/code/modules
├── bodepd-create_resources (v0.0.1)
├── puppetlabs-bacula (v0.0.2)
├── puppetlabs-mysql (v0.0.1)
Expand Down Expand Up @@ -207,7 +207,7 @@ def warn_unmet_dependencies(environment)
# When the above data structure is passed to Puppet::ModuleTool.build_tree
# you end up with something like this:
#
# /etc/puppetlabs/puppet/modules
# /etc/puppetlabs/code/modules
# └─┬ puppetlabs-bacula (v0.0.2)
# ├── puppetlabs-stdlib (v2.2.1)
# ├─┬ puppetlabs-mysql (v1.0.0)
Expand Down
6 changes: 3 additions & 3 deletions lib/puppet/face/module/uninstall.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
Uninstall a module:
$ puppet module uninstall puppetlabs-ssh
Removed /etc/puppetlabs/puppet/modules/ssh (v1.0.0)
Removed /etc/puppetlabs/code/modules/ssh (v1.0.0)
Uninstall a module from a specific directory:
Expand All @@ -22,12 +22,12 @@
Uninstall a module from a specific environment:
$ puppet module uninstall puppetlabs-ssh --environment development
Removed /etc/puppetlabs/puppet/environments/development/modules/ssh (v1.0.0)
Removed /etc/puppetlabs/code/environments/development/modules/ssh (v1.0.0)
Uninstall a specific version of a module:
$ puppet module uninstall puppetlabs-ssh --version 2.0.0
Removed /etc/puppetlabs/puppet/modules/ssh (v2.0.0)
Removed /etc/puppetlabs/code/modules/ssh (v2.0.0)
EOT

arguments "<name>"
Expand Down
4 changes: 2 additions & 2 deletions lib/puppet/type/file/source.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ module Puppet
This will fetch a file from a module on the puppet master (or from a
local module when using puppet apply). Given a `modulepath` of
`/etc/puppetlabs/puppet/modules`, the example above would resolve to
`/etc/puppetlabs/puppet/modules/name_of_module/files/filename`.
`/etc/puppetlabs/code/modules`, the example above would resolve to
`/etc/puppetlabs/code/modules/name_of_module/files/filename`.
Unlike `content`, the `source` attribute can be used to recursively copy
directories if the `recurse` attribute is set to `true` or `remote`. If
Expand Down
6 changes: 3 additions & 3 deletions spec/unit/hiera_puppet_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -63,14 +63,14 @@
expect(HieraPuppet.send(:hiera_config_file)).to eq(Puppet[:hiera_config])
end

it "should use Puppet.settings[:confdir] as the base directory when hiera_config is not set" do
it "should use Puppet.settings[:codedir] as the base directory when hiera_config is not set" do
begin
Puppet.settings[:hiera_config] = nil
rescue ArgumentError => detail
raise unless detail.message =~ /unknown setting/
end
Puppet.settings[:confdir] = "/dev/null/puppet"
hiera_config = File.join(Puppet[:confdir], 'hiera.yaml')
Puppet.settings[:codedir] = "/dev/null/puppet"
hiera_config = File.join(Puppet[:codedir], 'hiera.yaml')
Puppet::FileSystem.stubs(:exist?).with(hiera_config).returns(true)

expect(HieraPuppet.send(:hiera_config_file)).to eq(hiera_config)
Expand Down
Loading

0 comments on commit da5318f

Please sign in to comment.