-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
CFE-3764 Added show/info command
- Loading branch information
Showing
7 changed files
with
200 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
bundle agent bar_baz | ||
{ | ||
reports: | ||
"$(this.promise_dirname) $(this.promise_filename) $(this.bundle)"; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"vars": | ||
{ | ||
"bar-my": "is-a-value" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
{ | ||
"name": "Example", | ||
"description": "Example description", | ||
"build": [ | ||
{ | ||
"name": "autorun", | ||
"description": "Enable autorun functionality", | ||
"tags": ["wip", "untested"], | ||
"repo": "https://github.com/cfengine/modules", | ||
"by": "https://github.com/cfengine", | ||
"version": "1.0.0", | ||
"commit": "2bd83b1c0d1e6799a8d7221d7e98360b1bdc99bc", | ||
"subdirectory": "management/autorun", | ||
"steps": ["json def.json def.json"], | ||
"added_by": "./foo/main.cf" | ||
}, | ||
{ | ||
"name": "./foo/main.cf", | ||
"description": "Local policy file added using cfbs command line", | ||
"tags": ["local"], | ||
"dependencies": ["autorun"], | ||
"steps": ["copy ./foo/main.cf services/autorun/main.cf"], | ||
"added_by": "cfbs add" | ||
}, | ||
{ | ||
"name": "./bar/my.json", | ||
"description": "Local augments file added using cfbs command line", | ||
"tags": ["local"], | ||
"steps": ["json ./bar/my.json def.json"], | ||
"added_by": "cfbs add" | ||
}, | ||
{ | ||
"name": "./bar/baz/main.cf", | ||
"description": "Local policy file added using cfbs command line", | ||
"tags": ["local"], | ||
"dependencies": ["autorun"], | ||
"steps": ["copy ./bar/baz/main.cf services/autorun/main.cf"], | ||
"added_by": "cfbs add" | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
bundle agent foo | ||
{ | ||
reports: | ||
"$(this.promise_dirname) $(this.promise_filename) $(this.bundle)"; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
import os | ||
import re | ||
from cfbs.commands import info_command | ||
|
||
os.chdir(os.path.join(os.path.dirname(__file__),"sample")) | ||
|
||
def test_noargs(capfd): | ||
info_command([]) | ||
out, err = capfd.readouterr() | ||
assert out == "\n" | ||
|
||
def test_showinfo(capfd): | ||
info_command("autorun masterfiles foo/main.cf bar/my.json bar/baz/main.cf nosuchfile".split(" ")) | ||
out, err = capfd.readouterr() | ||
|
||
assert re.search(r"""Module: autorun | ||
Version: \d+\.\d+\.\d+ | ||
Status: Added | ||
By: https:\/\/github.com\/cfengine | ||
Tags: wip, untested | ||
Repo: https:\/\/github.com\/cfengine\/modules | ||
Commit: [a-zA-Z0-9]+ | ||
Description: Enable autorun functionality | ||
""", out, re.M) | ||
|
||
|
||
assert re.search(r"""Module: masterfiles | ||
Version: \d+\.\d+\.\d+ | ||
Status: Not Added | ||
By: https:\/\/github.com\/cfengine | ||
Tags: official, base | ||
Repo: https:\/\/github.com\/cfengine\/masterfiles | ||
Commit: [a-zA-Z0-9]+ | ||
Description: Official CFEngine Masterfiles Policy Framework \(MPF\) | ||
""", out, re.M) | ||
|
||
assert """Module: ./foo/main.cf | ||
Status: Added | ||
Tags: local | ||
Dependencies: autorun | ||
Added By: cfbs add | ||
Description: Local policy file added using cfbs command line | ||
Module: ./bar/my.json | ||
Status: Added | ||
Tags: local | ||
Added By: cfbs add | ||
Description: Local augments file added using cfbs command line | ||
Module: ./bar/baz/main.cf | ||
Status: Added | ||
Tags: local | ||
Dependencies: autorun | ||
Added By: cfbs add | ||
Description: Local policy file added using cfbs command line | ||
Module 'nosuchfile' does not exist | ||
""" in out | ||
|
||
def __main__(): | ||
test_showinfo() |