Skip to content

Commit

Permalink
fips: add pre_enable prompt indicating that additional debs required
Browse files Browse the repository at this point in the history
Addresses the last remaining FIPS-related prompt and message when
running: ua enable fips.

Fixes: canonical#1031
  • Loading branch information
blackboxsw committed Apr 30, 2020
1 parent 56d9412 commit 99d3def
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 0 deletions.
9 changes: 9 additions & 0 deletions uaclient/entitlements/fips.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,15 @@ def messaging(
self
) -> "Dict[str, List[Union[str, Tuple[Callable, Dict]]]]":
return {
"pre_enable": [
(
util.prompt_for_confirmation,
{
"msg": status.PROMPT_FIPS_PRE_ENABLE,
"assume_yes": self.assume_yes,
},
)
],
"post_enable": [
status.MESSAGE_ENABLE_REBOOT_REQUIRED_TMPL.format(
operation="install"
Expand Down
9 changes: 9 additions & 0 deletions uaclient/entitlements/tests/test_fips.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,15 @@ def test_messaging_passes_assume_yes(
entitlement = fips_entitlement_factory(assume_yes=assume_yes)
expected_msging = {
"fips": {
"pre_enable": [
(
util.prompt_for_confirmation,
{
"assume_yes": assume_yes,
"msg": status.PROMPT_FIPS_PRE_ENABLE,
},
)
],
"post_enable": [
status.MESSAGE_ENABLE_REBOOT_REQUIRED_TMPL.format(
operation="install"
Expand Down
7 changes: 7 additions & 0 deletions uaclient/status.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,13 @@ class UserFacingStatus(enum.Enum):
Ubuntu Advantage server provided no aptURL directive for {entitlement_name}"""

PROMPT_YES_NO = """Are you sure? (y/N) """
PROMPT_FIPS_PRE_ENABLE = (
"""\
Installation of additional packages are required to make this system FIPS
compliant.
"""
+ PROMPT_YES_NO
)
PROMPT_FIPS_UPDATES_PRE_ENABLE = (
"""\
This system will NOT be considered FIPS certified, but will include security
Expand Down

0 comments on commit 99d3def

Please sign in to comment.