Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ProfileCache: prepare_profile_cache checks for valid object template #127

Merged
merged 1 commit into from Feb 9, 2017

Conversation

stdweird
Copy link
Member

Depends on #125
Fixes #126

@stdweird stdweird added this to the 17.2 milestone Jan 31, 2017
$profile .= ".pan" if ($profile !~ m/\.pan$/ );
$profile = "$resourcesdir/$profile" if $resourcesdir && $profile !~ m/^\//;
my $ok;
open(my $TPL, '<', $profile) or croak("is_object_template failed to open $profile: $!");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd suggest is_object_template() failed... to make clearer in the message that a function failed to do something...

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm. i originially tought that open would be the exception and thus used croak, but now that i think about, a type in the use Quattor qw() might be a lot more common, so i'll add a additional check for the existence of the file with proper clean handling. if the open then still fails, croak provides plenty of information

@jouvin
Copy link
Contributor

jouvin commented Feb 2, 2017

Thanks for this. I have one minor comment: I think it'd be good to have a doc somewhere (can be on the web site and thus be done outside this PR) documenting how Perl::Critic::Policy::Quattor::UseCAFProcess is supposed to be used.

Also I'd suggest to change the title to something reflecting more the contents of the PR where the prepare_profile_cache() checks seem only one part of the PR...

@stdweird
Copy link
Member Author

stdweird commented Feb 3, 2017

@jouvin wrt more code than title, this is based on #125. i'll rebase.
wrt to using critic, once new maven tools are released, we can switch to tqu style testing, see eg quattor/CCM#160, which includes critic.

@stdweird stdweird force-pushed the object_template_check branch 2 times, most recently from cd5279d to 7e127e5 Compare February 3, 2017 17:38
@stdweird
Copy link
Member Author

stdweird commented Feb 6, 2017

@jrha another one best included before new build-tools are released

@jrha jrha merged commit cb5a0f8 into quattor:master Feb 9, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants