Rex-CMDB-YAMLwithRoles

 view release on metacpan or  search on metacpan

lib/Rex/CMDB/YAMLwithRoles.pm  view on Meta::CPAN

			if ( !exists $template_vars{$key} ) {
				$template_vars{$key} = $config_values->{$key};
			}
		}
		$template_vars{environment} = Rex::Commands::environment();

		for my $file (@files) {
			Rex::Logger::debug("CMDB - Opening $file");
			if ( -f $file ) {

				my $content = eval { local ( @ARGV, $/ ) = ($file); <>; };
				my $t       = Rex::Config->get_template_function();
				$content .= "\n";    # for safety
				$content = $t->( $content, \%template_vars );

				my $ref;
				my $parse_error;
				eval { $ref = Load($content); };
				if ($@) {
					$parse_error = $@;
				}

lib/Rex/CMDB/YAMLwithRoles.pm  view on Meta::CPAN

		Rex::Logger::debug("CMDB - Starting role processing");

		# load each role
		foreach my $role ( @{ $result->{roles} } ) {
			Rex::Logger::debug( "CMDB - Processing role '" . $role . "'" );
			my $role_file = File::Spec->join( $self->{roles_path}, $role . '.yaml' );

			# if the file exists, load it
			if ( -f $role_file ) {

				my $content = eval { local ( @ARGV, $/ ) = ($role_file); <>; };
				my $t       = Rex::Config->get_template_function();
				$content .= "\n";    # for safety
				$content = $t->( $content, \%template_vars );

				my $ref;
				my $parse_error;
				eval { $ref = Load($content); };
				if ($@) {
					$parse_error = $@;
				}



( run in 0.567 second using v1.01-cache-2.11-cpan-49f99fa48dc )