Skip to content

Commit

Permalink
Merge pull request #1521 from oalbrigt/dummypy-build-fixes
Browse files Browse the repository at this point in the history
dummypy: build fixes to generate the agent from the .in and generate manpage
  • Loading branch information
oalbrigt authored Jun 18, 2020
2 parents 53055ff + d881c9a commit 4b5cecb
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 7 deletions.
1 change: 1 addition & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -1012,6 +1012,7 @@ AC_CONFIG_FILES([heartbeat/aws-vpc-route53], [chmod +x heartbeat/aws-vpc-route53
AC_CONFIG_FILES([heartbeat/clvm], [chmod +x heartbeat/clvm])
AC_CONFIG_FILES([heartbeat/conntrackd], [chmod +x heartbeat/conntrackd])
AC_CONFIG_FILES([heartbeat/dnsupdate], [chmod +x heartbeat/dnsupdate])
AC_CONFIG_FILES([heartbeat/dummypy], [chmod +x heartbeat/dummypy])
AC_CONFIG_FILES([heartbeat/eDir88], [chmod +x heartbeat/eDir88])
AC_CONFIG_FILES([heartbeat/fio], [chmod +x heartbeat/fio])
AC_CONFIG_FILES([heartbeat/gcp-pd-move], [chmod +x heartbeat/gcp-pd-move])
Expand Down
1 change: 1 addition & 0 deletions doc/man/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ man_MANS = ocf_heartbeat_AoEtarget.7 \
ocf_heartbeat_docker-compose.7 \
ocf_heartbeat_dovecot.7 \
ocf_heartbeat_dnsupdate.7 \
ocf_heartbeat_dummypy.7 \
ocf_heartbeat_eDir88.7 \
ocf_heartbeat_ethmonitor.7 \
ocf_heartbeat_exportfs.7 \
Expand Down
1 change: 1 addition & 0 deletions heartbeat/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ ocf_SCRIPTS = AoEtarget \
db2 \
dhcpd \
dnsupdate \
dummypy \
docker \
docker-compose \
dovecot \
Expand Down
14 changes: 7 additions & 7 deletions heartbeat/dummypy.in
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ import ocf # noqa: E402

PARAM_HA_RSCTMP = ocf.get_parameter("HA_RSCTMP")
PARAM_INSTANCE = ocf.get_parameter("OCF_RESOURCE_INSTANCE")
OCF_RESKEY_state_default = f'{PARAM_HA_RSCTMP}/dummypy-{PARAM_INSTANCE}.state'
OCF_RESKEY_state_default = '{}/dummypy-{}.state'.format(PARAM_HA_RSCTMP, PARAM_INSTANCE)
OCF_RESKEY_fake_default = "dummy"

LONG_DESC = '''This is a Dummy Resource Agent. It does absolutely nothing
Expand Down Expand Up @@ -94,12 +94,12 @@ def dummy_monitor(state, fake):

def dummy_validate(state, fake):
state_dir = os.path.dirname(state)
file_test = f'{state_dir if state_dir != "" else "."}/$$'
file_test = '{}/{}'.format(state_dir if state_dir != "" else ".", PARAM_INSTANCE)

try:
touch(file_test)
except: # noqa: E722
ocf.ocf_exit_reason(f'State file "{state}" is not writable')
ocf.ocf_exit_reason('State file "{}" is not writable'.format(state))
return ocf.OCF_ERR_ARGS

os.remove(file_test)
Expand All @@ -109,27 +109,27 @@ def dummy_validate(state, fake):
def dummy_migrate_to(state, fake):
INSTANCE = ocf.OCF_RESOURCE_INSTANCE
TARGET = ocf.get_parameter("CRM_meta_migrate_target")
ocf.logger.info(f'Migrating {INSTANCE} to {TARGET}.')
ocf.logger.info('Migrating {} to {}.'.format(INSTANCE, TARGET))
dummy_stop(state, fake)


def dummy_migrate_from(state, fake):
INSTANCE = ocf.OCF_RESOURCE_INSTANCE
SOURCE = ocf.get_parameter("CRM_meta_migrate_source")
ocf.logger.info(f'Migrating {INSTANCE} from {SOURCE}.')
ocf.logger.info('Migrating {} from {}.'.format(INSTANCE, SOURCE))
dummy_start(state, fake)


def dummy_reload(state, fake):
ocf.logger.info(f'Reloading {ocf.OCF_RESOURCE_INSTANCE} ...')
ocf.logger.info('Reloading {} ...'.format(ocf.OCF_RESOURCE_INSTANCE))


def dummy_validate_all(state, fake):
dummy_validate(state, fake)


def main():
dummy_agent = ocf.Agent('dummy', SHORT_DESC, LONG_DESC)
dummy_agent = ocf.Agent('dummypy', SHORT_DESC, LONG_DESC)

dummy_agent.add_parameter(
name="state",
Expand Down

0 comments on commit 4b5cecb

Please sign in to comment.