facter 3.11.2.cfacter.20180612 → 3.11.3.cfacter.20180716
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/ext/facter/cpp-hocon/CMakeLists.txt +1 -1
- data/ext/facter/cpp-hocon/README.md +7 -0
- data/ext/facter/cpp-hocon/appveyor.yml +28 -21
- data/ext/facter/cpp-hocon/lib/inc/hocon/config_value.hpp +3 -3
- data/ext/facter/cpp-hocon/lib/inc/internal/values/config_delayed_merge_object.hpp +3 -1
- data/ext/facter/cpp-hocon/lib/src/simple_includer.cc +1 -1
- data/ext/facter/cpp-hocon/lib/src/tokenizer.cc +1 -1
- data/ext/facter/cpp-hocon/lib/src/values/config_delayed_merge_object.cc +10 -0
- data/ext/facter/cpp-hocon/lib/src/values/config_value.cc +2 -2
- data/ext/facter/cpp-hocon/lib/src/values/simple_config_list.cc +1 -1
- data/ext/facter/cpp-hocon/lib/src/values/simple_config_object.cc +2 -2
- data/ext/facter/cpp-hocon/lib/tests/conf_parser_test.cc +8 -3
- data/ext/facter/cpp-hocon/lib/tests/config_document_parser_test.cc +2 -2
- data/ext/facter/cpp-hocon/lib/tests/config_document_tests.cc +2 -2
- data/ext/facter/cpp-hocon/lib/tests/config_substitution_test.cc +16 -20
- data/ext/facter/cpp-hocon/lib/tests/test_utils.cc +6 -6
- data/ext/facter/cpp-hocon/lib/tests/test_utils.hpp +7 -6
- data/ext/facter/cpp-hocon/lib/tests/tokenizer_test.cc +1 -1
- data/ext/facter/cpp-hocon/locales/cpp-hocon.pot +1 -1
- data/ext/facter/facter/CMakeLists.txt +1 -1
- data/ext/facter/facter/acceptance/lib/facter/acceptance/base_fact_utils.rb +2 -2
- data/ext/facter/facter/lib/Doxyfile +1 -1
- data/ext/facter/facter/lib/src/facts/linux/os_linux.cc +3 -1
- data/ext/facter/facter/lib/src/util/solaris/k_stat.cc +22 -30
- data/ext/facter/facter/locales/FACTER.pot +1 -5
- data/ext/facter/leatherman/CMakeLists.txt +1 -1
- data/ext/facter/leatherman/curl/inc/leatherman/curl/client.hpp +9 -0
- data/ext/facter/leatherman/curl/src/client.cc +15 -0
- data/ext/facter/leatherman/curl/tests/client_test.cc +15 -0
- data/ext/facter/leatherman/curl/tests/mock_curl.cc +8 -0
- data/ext/facter/leatherman/curl/tests/mock_curl.hpp +2 -1
- data/ext/facter/leatherman/locales/leatherman.pot +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 59604eb95692d9fe7a11d3c65c28f32a4b807e11
|
4
|
+
data.tar.gz: e11014d9bfff774641b5fe5c75f81c831671bbe1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dee599e4596509d648066b32ade20990dbe4d430c6a7b8364f3ee75423827e65a6194f871541301a05aed4c28b0e1f79c0590c3d1eabb0f7f12749b91389c6ff
|
7
|
+
data.tar.gz: 68e4ab3e73b07dbba067e591582199a996a6fd2b58c5f887e010e0dbb4c220d31bed3d7da7eae085c1800233aa96791fb80fa34a6d2c91b9a94de1c17ce8324d
|
@@ -4,7 +4,7 @@ cmake_minimum_required(VERSION 3.2.2)
|
|
4
4
|
# Project Setup - modify to match project naming
|
5
5
|
## Source code for a simple command-line executable for a dynamic library will be generated from the project name.
|
6
6
|
## The command-line and library names will be based off the project name.
|
7
|
-
project(cpp-hocon VERSION 0.1.
|
7
|
+
project(cpp-hocon VERSION 0.1.7)
|
8
8
|
|
9
9
|
string(MAKE_C_IDENTIFIER ${PROJECT_NAME} PROJECT_C_NAME)
|
10
10
|
string(TOUPPER ${PROJECT_C_NAME} PROJECT_NAME_UPPER)
|
@@ -37,6 +37,13 @@ M=MMMMMMMM++ FOR HUMANS ++M8MMMMMM7M
|
|
37
37
|
7MM MMMDMMMM?MM88MM?MMMMOMM8 MM8
|
38
38
|
```
|
39
39
|
|
40
|
+
## Caveats
|
41
|
+
|
42
|
+
This is a mostly complete implementation of the HOCON format. It currently has some known limitations
|
43
|
+
|
44
|
+
* Include requires the location specifier, i.e. `include "foo"` won't work but `include file("foo")` will. URL is not yet implemented, and classpath won't be supported as it makes less sense outside of the JVM.
|
45
|
+
* Unicode testing is absent so support is unknown. There are likely things that won't work.
|
46
|
+
|
40
47
|
|
41
48
|
## Build Requirements
|
42
49
|
|
@@ -1,31 +1,37 @@
|
|
1
1
|
environment:
|
2
|
-
LEATHERMAN_VERSION:
|
3
|
-
|
4
|
-
-
|
5
|
-
|
6
|
-
|
7
|
-
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
2
|
+
LEATHERMAN_VERSION: 1.4.0
|
3
|
+
matrix:
|
4
|
+
- shared: OFF
|
5
|
+
|
6
|
+
init:
|
7
|
+
- |
|
8
|
+
choco install -y mingw-w64 -Version 5.2.0 -source https://www.myget.org/F/puppetlabs
|
9
|
+
choco install -y cmake -Version 3.2.2 -source https://www.myget.org/F/puppetlabs
|
10
|
+
choco install -y gettext -Version 0.19.6 -source https://www.myget.org/F/puppetlabs
|
11
|
+
choco install -y pl-toolchain-x64 -Version 2015.12.01.1 -source https://www.myget.org/F/puppetlabs
|
12
|
+
choco install -y pl-boost-x64 -Version 1.58.0.2 -source https://www.myget.org/F/puppetlabs
|
13
|
+
choco install -y pl-openssl-x64 -Version 1.0.24.1 -source https://www.myget.org/F/puppetlabs
|
14
|
+
choco install -y pl-curl-x64 -Version 7.46.0.1 -source https://www.myget.org/F/puppetlabs
|
12
15
|
|
13
|
-
|
14
|
-
- ps:
|
15
|
-
|
16
|
-
|
17
|
-
- ps: 7z.exe x "curl-7.42.1-x86_64_mingw-w64_4.8.3_win32_seh.7z" -oC:\tools | FIND /V "ing "
|
16
|
+
install:
|
17
|
+
- ps: |
|
18
|
+
wget "https://github.com/puppetlabs/leatherman/releases/download/$env:LEATHERMAN_VERSION/leatherman.7z" -OutFile "$pwd\leatherman.7z"
|
19
|
+
7z.exe x leatherman.7z -oC:\tools | FIND /V "ing "
|
18
20
|
|
19
|
-
|
20
|
-
|
21
|
+
# Minimize environment polution; previously we were linking against the wrong OpenSSL DLLs.
|
22
|
+
# Include Ruby and Powershell for unit tests.
|
23
|
+
- SET PATH=C:\tools\pl-build-tools\bin;C:\tools\mingw64\bin;C:\ProgramData\chocolatey\bin;C:\Ruby22-x64\bin;C:\Program Files\7-Zip;C:\Windows\system32;C:\Windows;C:\Windows\System32\WindowsPowerShell\v1.0
|
21
24
|
|
22
25
|
build_script:
|
23
|
-
- ps:
|
24
|
-
|
25
|
-
|
26
|
+
- ps: |
|
27
|
+
cmake -G "MinGW Makefiles" -DCMAKE_TOOLCHAIN_FILE="C:\tools\pl-build-tools\pl-build-toolchain.cmake" -DCMAKE_PREFIX_PATH="C:\tools\leatherman" -DCMAKE_INSTALL_PREFIX=C:\tools\cpp-hocon -DBOOST_STATIC=ON -DBUILD_SHARED_LIBS="$env:shared" .
|
28
|
+
mingw32-make -j2
|
26
29
|
|
27
30
|
test_script:
|
28
|
-
- ps:
|
31
|
+
- ps: |
|
32
|
+
ctest -V 2>&1 | %{ if ($_ -is [System.Management.Automation.ErrorRecord]) { $_ | c++filt } else { $_ } }
|
33
|
+
mingw32-make install
|
34
|
+
7z.exe a -t7z cpp-hocon.7z C:\tools\cpp-hocon\
|
29
35
|
|
30
36
|
artifacts:
|
31
37
|
- path: cpp-hocon.7z
|
@@ -39,3 +45,4 @@ deploy:
|
|
39
45
|
artifact: cpp-hocon.7z
|
40
46
|
on:
|
41
47
|
appveyor_repo_tag: true
|
48
|
+
shared: OFF
|
@@ -211,15 +211,15 @@ namespace hocon {
|
|
211
211
|
|
212
212
|
class modifier {
|
213
213
|
public:
|
214
|
-
virtual shared_value modify_child_may_throw(std::string key_or_null, shared_value v) = 0;
|
214
|
+
virtual shared_value modify_child_may_throw(std::string const& key_or_null, shared_value v) = 0;
|
215
215
|
};
|
216
216
|
|
217
217
|
class no_exceptions_modifier : public modifier {
|
218
218
|
public:
|
219
219
|
no_exceptions_modifier(std::string prefix);
|
220
220
|
|
221
|
-
shared_value modify_child_may_throw(std::string key_or_null, shared_value v) override;
|
222
|
-
shared_value modify_child(std::string key, shared_value v) const;
|
221
|
+
shared_value modify_child_may_throw(std::string const &key_or_null, shared_value v) override;
|
222
|
+
shared_value modify_child(std::string const& key, shared_value v) const;
|
223
223
|
private:
|
224
224
|
std::string _prefix;
|
225
225
|
};
|
@@ -7,10 +7,12 @@
|
|
7
7
|
|
8
8
|
namespace hocon {
|
9
9
|
|
10
|
-
class config_delayed_merge_object : public config_object, public replaceable_merge_stack {
|
10
|
+
class config_delayed_merge_object : public config_object, public unmergeable, public replaceable_merge_stack {
|
11
11
|
public:
|
12
12
|
config_delayed_merge_object(shared_origin origin, std::vector<shared_value> const& stack);
|
13
13
|
|
14
|
+
resolve_result<shared_value> resolve_substitutions(resolve_context const& context, resolve_source const& source) const override;
|
15
|
+
std::vector<shared_value> unmerged_values() const override;
|
14
16
|
shared_value make_replacement(resolve_context const& context, int skipping) const override;
|
15
17
|
|
16
18
|
shared_object with_value(path raw_path, shared_value value) const override;
|
@@ -58,7 +58,7 @@ namespace hocon {
|
|
58
58
|
}
|
59
59
|
|
60
60
|
shared_object simple_includer::include_file_without_fallback(shared_include_context context, std::string what) {
|
61
|
-
return config::parse_file_any_syntax(move(what), context->parse_options())->root();
|
61
|
+
return config::parse_file_any_syntax(move(what), context->parse_options())->resolve(config_resolve_options(true, true))->root();
|
62
62
|
}
|
63
63
|
|
64
64
|
config_parse_options simple_includer::clear_for_include(config_parse_options const& options) {
|
@@ -304,7 +304,7 @@ namespace hocon {
|
|
304
304
|
utf[i] = _input->get();
|
305
305
|
}
|
306
306
|
original += string(utf);
|
307
|
-
short character;
|
307
|
+
unsigned short character;
|
308
308
|
sscanf(utf, "%hx", &character);
|
309
309
|
wchar_t buffer[] { static_cast<wchar_t>(character), '\0'};
|
310
310
|
parsed += boost::nowide::narrow(buffer);
|
@@ -1,6 +1,7 @@
|
|
1
1
|
#include <internal/values/config_delayed_merge_object.hpp>
|
2
2
|
#include <internal/values/config_delayed_merge.hpp>
|
3
3
|
#include <internal/values/simple_config_list.hpp>
|
4
|
+
#include <internal/resolve_result.hpp>
|
4
5
|
#include <hocon/config_exception.hpp>
|
5
6
|
#include <leatherman/locale/locale.hpp>
|
6
7
|
|
@@ -28,6 +29,15 @@ namespace hocon {
|
|
28
29
|
}
|
29
30
|
}
|
30
31
|
|
32
|
+
resolve_result<shared_value> config_delayed_merge_object::resolve_substitutions(resolve_context const& context,
|
33
|
+
resolve_source const& source) const {
|
34
|
+
return config_delayed_merge::resolve_substitutions(dynamic_pointer_cast<const replaceable_merge_stack>(shared_from_this()), _stack, context, source);
|
35
|
+
}
|
36
|
+
|
37
|
+
vector<shared_value> config_delayed_merge_object::unmerged_values() const {
|
38
|
+
return _stack;
|
39
|
+
}
|
40
|
+
|
31
41
|
shared_value config_delayed_merge_object::make_replacement(resolve_context const &context, int skipping) const {
|
32
42
|
return config_delayed_merge::make_replacement(move(context), _stack, move(skipping));
|
33
43
|
}
|
@@ -164,7 +164,7 @@ namespace hocon {
|
|
164
164
|
|
165
165
|
config_value::no_exceptions_modifier::no_exceptions_modifier(string prefix): _prefix(std::move(prefix)) {}
|
166
166
|
|
167
|
-
shared_value config_value::no_exceptions_modifier::modify_child_may_throw(string key_or_null, shared_value v) {
|
167
|
+
shared_value config_value::no_exceptions_modifier::modify_child_may_throw(string const& key_or_null, shared_value v) {
|
168
168
|
try {
|
169
169
|
return modify_child(key_or_null, v);
|
170
170
|
} catch (runtime_error& e) {
|
@@ -174,7 +174,7 @@ namespace hocon {
|
|
174
174
|
}
|
175
175
|
}
|
176
176
|
|
177
|
-
shared_value config_value::no_exceptions_modifier::modify_child(string key, shared_value v) const {
|
177
|
+
shared_value config_value::no_exceptions_modifier::modify_child(string const& key, shared_value v) const {
|
178
178
|
return v->relativized(_prefix);
|
179
179
|
}
|
180
180
|
|
@@ -19,7 +19,7 @@ namespace hocon {
|
|
19
19
|
struct simple_config_list::resolve_modifier : public modifier {
|
20
20
|
resolve_modifier(resolve_context c, resolve_source s) : context(move(c)), source(move(s)) {}
|
21
21
|
|
22
|
-
shared_value modify_child_may_throw(string key, shared_value v) override
|
22
|
+
shared_value modify_child_may_throw(string const& key, shared_value v) override
|
23
23
|
{
|
24
24
|
resolve_result<shared_value> result = context.resolve(v, source);
|
25
25
|
context = result.context;
|
@@ -23,13 +23,13 @@ namespace hocon {
|
|
23
23
|
resolve_modifier(resolve_context c, resolve_source s)
|
24
24
|
: context(move(c)), source(move(s)), original_restrict(context.restrict_to_child()) {}
|
25
25
|
|
26
|
-
shared_value modify_child_may_throw(string key, shared_value v) override
|
26
|
+
shared_value modify_child_may_throw(string const& key, shared_value v) override
|
27
27
|
{
|
28
28
|
if (context.is_restricted_to_child()) {
|
29
29
|
if (key == *context.restrict_to_child().first()) {
|
30
30
|
auto remainder = context.restrict_to_child().remainder();
|
31
31
|
|
32
|
-
if (remainder.empty()) {
|
32
|
+
if (!remainder.empty()) {
|
33
33
|
auto result = context.restrict(remainder).resolve(v, source);
|
34
34
|
context = result.context.unrestricted().restrict(original_restrict);
|
35
35
|
return result.value;
|
@@ -310,15 +310,15 @@ TEST_CASE("to string for parseables") {
|
|
310
310
|
// TODO: are other APIs needed?
|
311
311
|
}
|
312
312
|
|
313
|
-
static void assert_comments(vector<string> comments, shared_config conf) {
|
313
|
+
static void assert_comments(vector<string> const& comments, shared_config conf) {
|
314
314
|
REQUIRE(comments == conf->root()->origin()->comments());
|
315
315
|
}
|
316
316
|
|
317
|
-
static void assert_comments(vector<string> comments, shared_config conf, string path) {
|
317
|
+
static void assert_comments(vector<string> const& comments, shared_config conf, string const& path) {
|
318
318
|
REQUIRE(comments == conf->get_value(path)->origin()->comments());
|
319
319
|
}
|
320
320
|
|
321
|
-
static void assert_comments(vector<string> comments, shared_config conf, string path, int index) {
|
321
|
+
static void assert_comments(vector<string> const& comments, shared_config conf, string const& path, int index) {
|
322
322
|
// TODO:
|
323
323
|
// auto v = conf->get_list(path)->get(index);
|
324
324
|
// REQUIRE(comments == v->origin()->comments());
|
@@ -632,6 +632,11 @@ TEST_CASE("include file") {
|
|
632
632
|
REQUIRE(1u == conf->get_int("fromJson1"));
|
633
633
|
}
|
634
634
|
|
635
|
+
TEST_CASE("include file relative paths") {
|
636
|
+
auto conf = config::parse_string("root { include file(\"" + fixture_path("test01.conf") + "\") }");
|
637
|
+
REQUIRE("abcd" == conf->get_string("root.strings.abcdAgain"));
|
638
|
+
}
|
639
|
+
|
635
640
|
TEST_CASE("include file with extension") {
|
636
641
|
auto conf = config::parse_string("include file(\"" + fixture_path("test01.conf") + "\")");
|
637
642
|
|
@@ -91,7 +91,7 @@ TEST_CASE("parse values", "[doc-parser]") {
|
|
91
91
|
}
|
92
92
|
}
|
93
93
|
|
94
|
-
void invalid_json_test(string original_text, string message) {
|
94
|
+
void invalid_json_test(string const& original_text, string const& message) {
|
95
95
|
try {
|
96
96
|
json_parse(original_text);
|
97
97
|
} catch (parse_exception& ex) {
|
@@ -144,7 +144,7 @@ TEST_CASE("parse empty document", "[doc-parser]") {
|
|
144
144
|
REQUIRE(dynamic_pointer_cast<const config_node_object>(node2->value()));
|
145
145
|
}
|
146
146
|
|
147
|
-
void parse_test_string(string original_text) {
|
147
|
+
void parse_test_string(string const& original_text) {
|
148
148
|
auto node = conf_parse(original_text);
|
149
149
|
REQUIRE(original_text == node->render());
|
150
150
|
}
|
@@ -6,8 +6,8 @@
|
|
6
6
|
using namespace hocon;
|
7
7
|
using namespace std;
|
8
8
|
|
9
|
-
void replace_test(string original_text, string final_text, string new_value,
|
10
|
-
string replace_path, config_syntax syntax) {
|
9
|
+
void replace_test(string const& original_text, string const& final_text, string const& new_value,
|
10
|
+
string const& replace_path, config_syntax syntax) {
|
11
11
|
auto config_doc = config_document_factory::parse_string(original_text,
|
12
12
|
config_parse_options().set_syntax(syntax));
|
13
13
|
REQUIRE(original_text == config_doc->render());
|
@@ -320,9 +320,7 @@ TEST_CASE("ignore hidden circular subst") {
|
|
320
320
|
REQUIRE(42u == resolved->get_int("a"));
|
321
321
|
}
|
322
322
|
|
323
|
-
|
324
|
-
|
325
|
-
TEST_CASE("(pending HC-78) avoid delayed merge object problem 1", "[!shouldfail]") {
|
323
|
+
TEST_CASE("avoid delayed merge object problem 1") {
|
326
324
|
auto problem = parse_object(R"(
|
327
325
|
defaults {
|
328
326
|
a = 1
|
@@ -346,9 +344,9 @@ TEST_CASE("(pending HC-78) avoid delayed merge object problem 1", "[!shouldfail]
|
|
346
344
|
REQUIRE(3 == resolved->get_int("item2.b"));
|
347
345
|
}
|
348
346
|
|
349
|
-
TEST_CASE("
|
347
|
+
TEST_CASE("avoid delayed merge object resolve problem 2") {
|
350
348
|
auto problem = parse_object(R"(
|
351
|
-
defaults {
|
349
|
+
defaults {
|
352
350
|
a = 1
|
353
351
|
b = 2
|
354
352
|
}
|
@@ -365,7 +363,7 @@ defaults {
|
|
365
363
|
REQUIRE(dynamic_pointer_cast<const config_delayed_merge_object>(problem->attempt_peek_with_partial_resolve("item1")));
|
366
364
|
|
367
365
|
auto resolved = resolve_without_fallbacks(problem);
|
368
|
-
REQUIRE(parse_object("{ c : 43 }") == resolved->get_object("item1.b"));
|
366
|
+
REQUIRE(*parse_object("{ c : 43 }") == *resolved->get_object("item1.b"));
|
369
367
|
REQUIRE(43 == resolved->get_int("item1.b.c"));
|
370
368
|
REQUIRE(43 == resolved->get_int("item2.b.c"));
|
371
369
|
|
@@ -373,7 +371,7 @@ defaults {
|
|
373
371
|
|
374
372
|
TEST_CASE("(pending HC-78) avoid delayed merge object resolve problem 3", "[!shouldfail]") {
|
375
373
|
auto problem = parse_object(R"(
|
376
|
-
item1.b.c = 100
|
374
|
+
item1.b.c = 100
|
377
375
|
defaults {
|
378
376
|
// we depend on item1.b.c
|
379
377
|
a = ${item1.b.c}
|
@@ -392,15 +390,15 @@ item1.b.c = 100
|
|
392
390
|
REQUIRE(dynamic_pointer_cast<const config_delayed_merge_object>(problem->attempt_peek_with_partial_resolve("item1")));
|
393
391
|
|
394
392
|
auto resolved = resolve_without_fallbacks(problem);
|
395
|
-
REQUIRE(parse_object("{ c : 43 }") == resolved->get_object("item1.b"));
|
393
|
+
REQUIRE(*parse_object("{ c : 43 }") == *resolved->get_object("item1.b"));
|
396
394
|
REQUIRE(43 == resolved->get_int("item1.b.c"));
|
397
395
|
REQUIRE(43 == resolved->get_int("item2.b.c"));
|
398
396
|
REQUIRE(100 == resolved->get_int("defaults.a"));
|
399
397
|
}
|
400
398
|
|
401
|
-
TEST_CASE("
|
399
|
+
TEST_CASE("avoid delayed merge object resolve problem 4") {
|
402
400
|
auto problem = parse_object(R"(
|
403
|
-
defaults {
|
401
|
+
defaults {
|
404
402
|
a = 1
|
405
403
|
b = 2
|
406
404
|
}
|
@@ -422,7 +420,7 @@ defaults {
|
|
422
420
|
|
423
421
|
TEST_CASE("(pending HC-78) avoid delayed merge object resolve problem 5", "[!shouldfail]") {
|
424
422
|
auto problem = parse_object(R"(
|
425
|
-
defaults {
|
423
|
+
defaults {
|
426
424
|
a = ${item1.b} // tricky cycle - we won't see ${defaults}
|
427
425
|
// as we resolve this
|
428
426
|
b = 2
|
@@ -441,12 +439,12 @@ defaults {
|
|
441
439
|
auto resolved = resolve_without_fallbacks(problem);
|
442
440
|
REQUIRE(2 == resolved->get_int("item1.b"));
|
443
441
|
REQUIRE(2 == resolved->get_int("item2.b"));
|
444
|
-
REQUIRE(7 == resolved->get_int("
|
442
|
+
REQUIRE(7 == resolved->get_int("defaults.a"));
|
445
443
|
}
|
446
444
|
|
447
445
|
TEST_CASE("(pending HC-78) avoid delayed merge object resolve problem 6", "[!shouldfail]") {
|
448
446
|
auto problem = parse_object(R"(
|
449
|
-
z = 15
|
447
|
+
z = 15
|
450
448
|
defaults-defaults-defaults {
|
451
449
|
m = ${z}
|
452
450
|
n.o.p = ${z}
|
@@ -480,12 +478,12 @@ z = 15
|
|
480
478
|
|
481
479
|
REQUIRE(dynamic_pointer_cast<const config_delayed_merge_object>(problem->attempt_peek_with_partial_resolve("item1")));
|
482
480
|
|
483
|
-
unwrapped_value expected(
|
481
|
+
unwrapped_value expected(101);
|
484
482
|
bool test = expected == problem->to_config()->get_object("item1")->attempt_peek_with_partial_resolve("xyz")->unwrapped();
|
485
483
|
REQUIRE(test);
|
486
484
|
|
487
485
|
auto resolved = resolve_without_fallbacks(problem);
|
488
|
-
REQUIRE(parse_object("{ c : 43 }") == resolved->get_object("item1.b"));
|
486
|
+
REQUIRE(*parse_object("{ c : 43 }") == *resolved->get_object("item1.b"));
|
489
487
|
REQUIRE(43 == resolved->get_int("item1.b.c"));
|
490
488
|
REQUIRE(43 == resolved->get_int("item2.b.c"));
|
491
489
|
REQUIRE(15 == resolved->get_int("item1.n.o.p"));
|
@@ -493,7 +491,7 @@ z = 15
|
|
493
491
|
|
494
492
|
TEST_CASE("Fetch known value from delayed merge object") {
|
495
493
|
auto obj = parse_object(R"(
|
496
|
-
defaults {
|
494
|
+
defaults {
|
497
495
|
a = 1
|
498
496
|
b = 2
|
499
497
|
}
|
@@ -524,7 +522,7 @@ TEST_CASE("Fail to fetch from delayed merge object needs full resolve") {
|
|
524
522
|
REQUIRE_THROWS(obj->to_config()->get_object("item1.b"));
|
525
523
|
}
|
526
524
|
|
527
|
-
TEST_CASE("
|
525
|
+
TEST_CASE("resolve delayed merge object embrace") {
|
528
526
|
auto obj = parse_object(R"(
|
529
527
|
defaults {
|
530
528
|
a = 1
|
@@ -599,8 +597,7 @@ TEST_CASE("use relative to root when relativized") {
|
|
599
597
|
REQUIRE("in parent" == resolved->get_string("a.bar"));
|
600
598
|
}
|
601
599
|
|
602
|
-
|
603
|
-
TEST_CASE("pending HC-73: complex resolve (pending)", "[!shouldfail]") {
|
600
|
+
TEST_CASE("complex resolve") {
|
604
601
|
auto resolved = resolve_without_fallbacks(subst_complex_object());
|
605
602
|
|
606
603
|
REQUIRE(57u == resolved->get_int("foo"));
|
@@ -610,7 +607,6 @@ TEST_CASE("pending HC-73: complex resolve (pending)", "[!shouldfail]") {
|
|
610
607
|
REQUIRE(57u == resolved->get_int("objB.d"));
|
611
608
|
}
|
612
609
|
|
613
|
-
|
614
610
|
// TODO: env variable fallback legitimately fails: HC-74
|
615
611
|
TEST_CASE("pending HC-74: fallback to env (pending)", "[!shouldfail]") {
|
616
612
|
auto resolved = resolve(subst_env_var_object());
|
@@ -109,7 +109,7 @@ namespace hocon { namespace test_utils {
|
|
109
109
|
return make_shared<config_node_simple_value>(bool_token(value));
|
110
110
|
}
|
111
111
|
|
112
|
-
shared_ptr<config_node_simple_value> string_node(string text) {
|
112
|
+
shared_ptr<config_node_simple_value> string_node(string const& text) {
|
113
113
|
return make_shared<config_node_simple_value>(string_token(text));
|
114
114
|
}
|
115
115
|
|
@@ -117,7 +117,7 @@ namespace hocon { namespace test_utils {
|
|
117
117
|
return make_shared<config_node_simple_value>(null_token());
|
118
118
|
}
|
119
119
|
|
120
|
-
shared_ptr<config_node_simple_value> unquoted_text_node(string text) {
|
120
|
+
shared_ptr<config_node_simple_value> unquoted_text_node(string const& text) {
|
121
121
|
return make_shared<config_node_simple_value>(unquoted_text_token(text));
|
122
122
|
}
|
123
123
|
|
@@ -129,11 +129,11 @@ namespace hocon { namespace test_utils {
|
|
129
129
|
return make_shared<config_node_single_token>(line_token(line_number));
|
130
130
|
}
|
131
131
|
|
132
|
-
shared_ptr<config_node_single_token> whitespace_node(string whitespace) {
|
132
|
+
shared_ptr<config_node_single_token> whitespace_node(string const& whitespace) {
|
133
133
|
return make_shared<config_node_single_token>(whitespace_token(whitespace));
|
134
134
|
}
|
135
135
|
|
136
|
-
shared_ptr<config_node_comment> double_slash_comment_node(string text) {
|
136
|
+
shared_ptr<config_node_comment> double_slash_comment_node(string const& text) {
|
137
137
|
return make_shared<config_node_comment>(double_slash_comment_token(text));
|
138
138
|
}
|
139
139
|
|
@@ -161,7 +161,7 @@ namespace hocon { namespace test_utils {
|
|
161
161
|
return make_shared<config_reference>(fake_origin(), make_shared<substitution_expression>(path::new_path(ref), optional));
|
162
162
|
}
|
163
163
|
|
164
|
-
shared_ptr<config_concatenation> subst_in_string(string ref, bool optional) {
|
164
|
+
shared_ptr<config_concatenation> subst_in_string(string const& ref, bool optional) {
|
165
165
|
auto pieces = vector<shared_value> {string_value("start<"), subst(ref, optional), string_value(">end")};
|
166
166
|
return make_shared<config_concatenation>(fake_origin(), pieces);
|
167
167
|
}
|
@@ -446,7 +446,7 @@ namespace hocon { namespace test_utils {
|
|
446
446
|
return new_tests;
|
447
447
|
}
|
448
448
|
|
449
|
-
std::string fixture_path(std::string fixture_name) {
|
449
|
+
std::string fixture_path(std::string const& fixture_name) {
|
450
450
|
return string(TEST_FILE_DIR) + "/fixtures/" + fixture_name;
|
451
451
|
}
|
452
452
|
}} // namespace hocon::test_utils
|
@@ -75,21 +75,21 @@ namespace hocon { namespace test_utils {
|
|
75
75
|
|
76
76
|
std::shared_ptr<config_node_simple_value> double_node(double number);
|
77
77
|
|
78
|
-
std::shared_ptr<config_node_simple_value> string_node(std::string text);
|
78
|
+
std::shared_ptr<config_node_simple_value> string_node(std::string const& text);
|
79
79
|
|
80
80
|
std::shared_ptr<config_node_simple_value> null_node();
|
81
81
|
|
82
82
|
std::shared_ptr<config_node_simple_value> bool_node(bool value);
|
83
83
|
|
84
|
-
std::shared_ptr<config_node_simple_value> unquoted_text_node(std::string text);
|
84
|
+
std::shared_ptr<config_node_simple_value> unquoted_text_node(std::string const& text);
|
85
85
|
|
86
86
|
std::shared_ptr<config_node_simple_value> substitution_node(shared_token key, bool optional);
|
87
87
|
|
88
88
|
std::shared_ptr<config_node_single_token> line_node(int line_number);
|
89
89
|
|
90
|
-
std::shared_ptr<config_node_single_token> whitespace_node(std::string whitespace);
|
90
|
+
std::shared_ptr<config_node_single_token> whitespace_node(std::string const& whitespace);
|
91
91
|
|
92
|
-
std::shared_ptr<config_node_comment> double_slash_comment_node(std::string text);
|
92
|
+
std::shared_ptr<config_node_comment> double_slash_comment_node(std::string const& text);
|
93
93
|
|
94
94
|
// it's important that these do NOT use the public API to create the
|
95
95
|
// instances, because we may be testing that the public API returns the
|
@@ -108,7 +108,7 @@ namespace hocon { namespace test_utils {
|
|
108
108
|
|
109
109
|
std::shared_ptr<config_reference> subst(std::string ref, bool optional = false);
|
110
110
|
|
111
|
-
std::shared_ptr<config_concatenation> subst_in_string(std::string ref, bool optional = false);
|
111
|
+
std::shared_ptr<config_concatenation> subst_in_string(std::string const& ref, bool optional = false);
|
112
112
|
|
113
113
|
/** Paths */
|
114
114
|
path test_path(std::initializer_list<std::string> path_elements);
|
@@ -118,6 +118,7 @@ namespace hocon { namespace test_utils {
|
|
118
118
|
shared_config parse_config(std::string);
|
119
119
|
|
120
120
|
struct parse_test {
|
121
|
+
// cppcheck-suppress passedByValue
|
121
122
|
parse_test(std::string t, bool lbe = false, bool wm = false)
|
122
123
|
: test(move(t)), lift_behavior_unexpected(lbe), whitespace_matters(wm) { }
|
123
124
|
|
@@ -135,5 +136,5 @@ namespace hocon { namespace test_utils {
|
|
135
136
|
|
136
137
|
std::vector<parse_test> whitespace_variations(std::vector<parse_test> const& tests, bool valid_in_lift);
|
137
138
|
|
138
|
-
std::string fixture_path(std::string fixture_name);
|
139
|
+
std::string fixture_path(std::string const& fixture_name);
|
139
140
|
}} // namespace hocon::test_utils
|
@@ -17,7 +17,7 @@ token_list tokenize_as_list(string const& source) {
|
|
17
17
|
return tokens;
|
18
18
|
}
|
19
19
|
|
20
|
-
void tokenizer_test(string source, token_list expected) {
|
20
|
+
void tokenizer_test(string const& source, token_list expected) {
|
21
21
|
token_list result = tokenize_as_list(source);
|
22
22
|
for (size_t i = 0; i < expected.size(); i++) {
|
23
23
|
if (!(*expected[i] == *result[i])) {
|
@@ -227,9 +227,9 @@ module Facter
|
|
227
227
|
'os.family' => 'RedHat',
|
228
228
|
'os.hardware' => os_hardware,
|
229
229
|
'os.name' => os_name,
|
230
|
-
'os.release.full' => /#{os_version}\.\d+(\.\d+)?/,
|
230
|
+
'os.release.full' => /#{os_version}(\.\d+)?(\.\d+)?/,
|
231
231
|
'os.release.major' => os_version,
|
232
|
-
'os.release.minor' =>
|
232
|
+
'os.release.minor' => /(\d+)?/,
|
233
233
|
'processors.count' => /[1-9]/,
|
234
234
|
'processors.physicalcount' => /[1-9]/,
|
235
235
|
'processors.isa' => os_hardware,
|
@@ -38,7 +38,7 @@ PROJECT_NAME = facter
|
|
38
38
|
# could be handy for archiving the generated documentation or if some version
|
39
39
|
# control system is used.
|
40
40
|
|
41
|
-
PROJECT_NUMBER = 3.11.
|
41
|
+
PROJECT_NUMBER = 3.11.3
|
42
42
|
|
43
43
|
# Using the PROJECT_BRIEF tag one can provide an optional one line description
|
44
44
|
# for a project that appears at the top of each page and should give viewer a
|
@@ -285,8 +285,10 @@ namespace facter { namespace facts { namespace linux {
|
|
285
285
|
})) {
|
286
286
|
if (boost::ends_with(contents, "(Rawhide)")) {
|
287
287
|
value = "Rawhide";
|
288
|
-
} else {
|
288
|
+
} else if (contents.find("release") != string::npos) {
|
289
289
|
re_search(contents, boost::regex("release (\\d[\\d.]*)"), &value);
|
290
|
+
} else {
|
291
|
+
re_search(contents, boost::regex("Amazon Linux (\\d+)"), &value);
|
290
292
|
}
|
291
293
|
}
|
292
294
|
}
|
@@ -30,44 +30,36 @@ namespace facter { namespace util { namespace solaris {
|
|
30
30
|
return lookup(entry.first, -1, entry.second);
|
31
31
|
}
|
32
32
|
|
33
|
+
// I believe precedence to be sufficiently obvious in this function,
|
34
|
+
// but this is a worthwhile diagnostic in most cases. We disable it
|
35
|
+
// here, instead of globally.
|
36
|
+
#pragma GCC diagnostic push
|
37
|
+
#pragma GCC diagnostic ignored "-Wparentheses"
|
33
38
|
vector<k_stat_entry> k_stat::lookup(string const& module, int instance, string const& name)
|
34
39
|
{
|
35
|
-
kstat_t* kp =
|
36
|
-
if (kp == nullptr) {
|
37
|
-
throw kstat_exception(_("kstat_lookup of module {1}/{2}/{3} failed: {4} ({5})",
|
38
|
-
module,
|
39
|
-
to_string(instance),
|
40
|
-
name,
|
41
|
-
string(strerror(errno)),
|
42
|
-
to_string(errno)));
|
43
|
-
}
|
44
|
-
|
40
|
+
kstat_t* kp = static_cast<kstat_ctl_t*>(ctrl)->kc_chain;
|
45
41
|
vector<k_stat_entry> arr;
|
46
|
-
|
47
|
-
if (
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
}
|
52
|
-
|
53
|
-
bool insert = true;
|
54
|
-
if (!module.empty() && module != kp->ks_module) {
|
55
|
-
insert = false;
|
42
|
+
do {
|
43
|
+
if (!module.empty() && module != kp->ks_module ||
|
44
|
+
!name.empty() && name != kp->ks_name ||
|
45
|
+
instance != -1 && instance != kp->ks_instance) {
|
46
|
+
continue;
|
56
47
|
}
|
57
|
-
|
58
|
-
|
48
|
+
while (kstat_read(ctrl, kp, 0) == -1) {
|
49
|
+
if (errno == EAGAIN) {
|
50
|
+
continue;
|
51
|
+
} else {
|
52
|
+
throw kstat_exception(_("kstat_read failed: {1} ({2})",
|
53
|
+
string(strerror(errno)),
|
54
|
+
to_string(errno)));
|
55
|
+
}
|
59
56
|
}
|
60
|
-
|
61
|
-
|
62
|
-
}
|
63
|
-
if (insert) {
|
64
|
-
arr.push_back(k_stat_entry(kp));
|
65
|
-
}
|
66
|
-
kp = kp->ks_next;
|
67
|
-
}
|
57
|
+
arr.push_back(k_stat_entry(kp));
|
58
|
+
} while (kp = kp->ks_next);
|
68
59
|
|
69
60
|
return arr;
|
70
61
|
}
|
62
|
+
#pragma GCC diagnostic pop
|
71
63
|
|
72
64
|
k_stat_entry::k_stat_entry(kstat_t* kp) :
|
73
65
|
k_stat(kp)
|
@@ -6,7 +6,7 @@
|
|
6
6
|
#, fuzzy
|
7
7
|
msgid ""
|
8
8
|
msgstr ""
|
9
|
-
"Project-Id-Version: FACTER 3.11.
|
9
|
+
"Project-Id-Version: FACTER 3.11.3\n"
|
10
10
|
"Report-Msgid-Bugs-To: docs@puppet.com\n"
|
11
11
|
"POT-Creation-Date: \n"
|
12
12
|
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
@@ -1497,10 +1497,6 @@ msgstr ""
|
|
1497
1497
|
msgid "kstat_open failed"
|
1498
1498
|
msgstr ""
|
1499
1499
|
|
1500
|
-
#: lib/src/util/solaris/k_stat.cc
|
1501
|
-
msgid "kstat_lookup of module {1}/{2}/{3} failed: {4} ({5})"
|
1502
|
-
msgstr ""
|
1503
|
-
|
1504
1500
|
#: lib/src/util/solaris/k_stat.cc
|
1505
1501
|
msgid "kstat_read failed: {1} ({2})"
|
1506
1502
|
msgstr ""
|
@@ -350,6 +350,13 @@ namespace leatherman { namespace curl {
|
|
350
350
|
*/
|
351
351
|
void set_client_cert(std::string const& client_cert, std::string const& client_key);
|
352
352
|
|
353
|
+
/**
|
354
|
+
* Set proxy information.
|
355
|
+
* @param proxy String with following components [scheme]://[hostname]:[port].
|
356
|
+
* (see more: https://curl.haxx.se/libcurl/c/CURLOPT_PROXY.html)
|
357
|
+
*/
|
358
|
+
void set_proxy(std::string const& proxy);
|
359
|
+
|
353
360
|
/**
|
354
361
|
* Set and limit what protocols curl will support
|
355
362
|
* @param client_protocols bitmask of CURLPROTO_*
|
@@ -387,6 +394,7 @@ namespace leatherman { namespace curl {
|
|
387
394
|
std::string _ca_cert;
|
388
395
|
std::string _client_cert;
|
389
396
|
std::string _client_key;
|
397
|
+
std::string _proxy;
|
390
398
|
long _client_protocols = CURLPROTO_ALL;
|
391
399
|
|
392
400
|
response perform(http_method method, request const& req);
|
@@ -407,6 +415,7 @@ namespace leatherman { namespace curl {
|
|
407
415
|
LEATHERMAN_CURL_NO_EXPORT void set_client_info(context &ctx);
|
408
416
|
LEATHERMAN_CURL_NO_EXPORT void set_ca_info(context& ctx);
|
409
417
|
LEATHERMAN_CURL_NO_EXPORT void set_client_protocols(context& ctx);
|
418
|
+
LEATHERMAN_CURL_NO_EXPORT void set_proxy_info(context& ctx);
|
410
419
|
|
411
420
|
template <typename ParamType>
|
412
421
|
LEATHERMAN_CURL_NO_EXPORT void curl_easy_setopt_maybe(
|
@@ -231,6 +231,7 @@ namespace leatherman { namespace curl {
|
|
231
231
|
set_ca_info(ctx);
|
232
232
|
set_client_info(ctx);
|
233
233
|
set_client_protocols(ctx);
|
234
|
+
set_proxy_info(ctx);
|
234
235
|
|
235
236
|
// Perform the request
|
236
237
|
auto result = curl_easy_perform(_handle);
|
@@ -275,6 +276,7 @@ namespace leatherman { namespace curl {
|
|
275
276
|
set_ca_info(ctx);
|
276
277
|
set_client_info(ctx);
|
277
278
|
set_client_protocols(ctx);
|
279
|
+
set_proxy_info(ctx);
|
278
280
|
|
279
281
|
// More detailed error messages
|
280
282
|
curl_easy_setopt_maybe(ctx, CURLOPT_ERRORBUFFER, errbuf);
|
@@ -305,6 +307,11 @@ namespace leatherman { namespace curl {
|
|
305
307
|
_ca_cert = cert_file;
|
306
308
|
}
|
307
309
|
|
310
|
+
void client::set_proxy(string const& proxy)
|
311
|
+
{
|
312
|
+
_proxy = proxy;
|
313
|
+
}
|
314
|
+
|
308
315
|
void client::set_client_cert(string const& client_cert, string const& client_key)
|
309
316
|
{
|
310
317
|
_client_cert = client_cert;
|
@@ -430,6 +437,14 @@ namespace leatherman { namespace curl {
|
|
430
437
|
curl_easy_setopt_maybe(ctx, CURLOPT_SSLKEY, _client_key.c_str());
|
431
438
|
}
|
432
439
|
|
440
|
+
void client::set_proxy_info(context &ctx) {
|
441
|
+
if (_proxy == "") {
|
442
|
+
return;
|
443
|
+
}
|
444
|
+
|
445
|
+
curl_easy_setopt_maybe(ctx, CURLOPT_PROXY, _proxy.c_str());
|
446
|
+
}
|
447
|
+
|
433
448
|
void client::set_client_protocols(context& ctx) {
|
434
449
|
curl_easy_setopt_maybe(ctx, CURLOPT_PROTOCOLS, _client_protocols);
|
435
450
|
}
|
@@ -236,6 +236,21 @@ TEST_CASE("curl::client CA bundle and SSL setup") {
|
|
236
236
|
REQUIRE(test_impl->cacert == "cacert");
|
237
237
|
}
|
238
238
|
|
239
|
+
SECTION("Proxy should be unspecified by default") {
|
240
|
+
auto resp = test_client.get(test_request);
|
241
|
+
CURL* const& handle = test_client.get_handle();
|
242
|
+
auto test_impl = reinterpret_cast<curl_impl* const>(handle);
|
243
|
+
REQUIRE(test_impl->proxy == "");
|
244
|
+
}
|
245
|
+
|
246
|
+
SECTION("cURL should receive the proxy specified in the request") {
|
247
|
+
test_client.set_proxy("proxy");
|
248
|
+
auto resp = test_client.get(test_request);
|
249
|
+
CURL* const& handle = test_client.get_handle();
|
250
|
+
auto test_impl = reinterpret_cast<curl_impl* const>(handle);
|
251
|
+
REQUIRE(test_impl->proxy == "proxy");
|
252
|
+
}
|
253
|
+
|
239
254
|
SECTION("Client cert name should be unspecified by default") {
|
240
255
|
auto resp = test_client.get(test_request);
|
241
256
|
CURL* const& handle = test_client.get_handle();
|
@@ -217,6 +217,14 @@ CURLcode curl_easy_setopt(CURL *handle, CURLoption option, ...)
|
|
217
217
|
}
|
218
218
|
h->client_cert = va_arg(vl, char*);
|
219
219
|
break;
|
220
|
+
case CURLOPT_PROXY:
|
221
|
+
// Set the mock curl proxy to that which was passed in the request.
|
222
|
+
if (h->test_failure_mode == curl_impl::error_mode::proxy_error) {
|
223
|
+
va_end(vl);
|
224
|
+
return CURLE_OUT_OF_MEMORY;
|
225
|
+
}
|
226
|
+
h->proxy = va_arg(vl, char*);
|
227
|
+
break;
|
220
228
|
case CURLOPT_SSLKEY:
|
221
229
|
// Set the mock curl private keyfile name to that which was passed in the request.
|
222
230
|
if (h->test_failure_mode == curl_impl::error_mode::ssl_key_error) {
|
@@ -40,6 +40,7 @@ struct curl_impl
|
|
40
40
|
ssl_cert_error,
|
41
41
|
ssl_key_error,
|
42
42
|
protocol_error,
|
43
|
+
proxy_error
|
43
44
|
};
|
44
45
|
|
45
46
|
error_mode test_failure_mode = error_mode::success;
|
@@ -56,7 +57,7 @@ struct curl_impl
|
|
56
57
|
std::function<size_t(char*, size_t, size_t, void*)> read_function;
|
57
58
|
void* read_data; // Where to read the request body from
|
58
59
|
|
59
|
-
std::string request_url, cookie, cacert, client_cert, client_key;
|
60
|
+
std::string request_url, cookie, cacert, client_cert, client_key, proxy;
|
60
61
|
long protocols;
|
61
62
|
long connect_timeout;
|
62
63
|
http_method method = http_method::get;
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: facter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.11.
|
4
|
+
version: 3.11.3.cfacter.20180716
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Puppet
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2018-
|
12
|
+
date: 2018-07-16 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description:
|
15
15
|
email: info@puppet.com
|